[
  {
    "path": ".gitignore",
    "content": "*.iml\n.idea/misc.xml\n*.xml\n.buildpath\n.project\n.settings/org.eclipse.php.core.prefs"
  },
  {
    "path": "CONTRIBUTING.md",
    "content": "![](http://cdn.pocketmine.net/img/PocketMine-MP-h.png)\n\n# PocketMine-MP Contribution Guidelines\n\nYou must follow these guidelines if you wish to contribute to the PocketMine-MP code base, or participate in issue tracking.\n\n## I have a question\n* For questions, please refer to the _#pmmp_ or _#pocketmine_ IRC channel on Freenode. There is a [WebIRC](http://webchat.freenode.net?channels=pmmp,pocketmine&uio=d4) if you do not want to install an IRC client.\n* You can ask directly to _[@PocketMine](https://twitter.com/PocketMine)_ in Twitter, but don't expect an immediate reply.\n* You may use our [Forum](http://forums.pocketmine.net) to ask questions.\n* We do not accept questions or support requests in our issue tracker.\n\n## Creating an Issue\n* First, use the [Issue Search](https://github.com/pmmp/PocketMine-MP/search?ref=cmdform&type=Issues) to check if anyone has reported it. Check also closed issues, as an issue you think is valid may actually be invalid.\n  * If an issue has been _fixed_ and closed, create another issue.\n* If your issue is related to a plugin, do **not** report here. Contact the plugin's original author instead.\n* **Support requests are not bugs.** Issues such as \"How do I do this\" are not bugs and are closed as soon as a collaborator spots it. They are referred to our Forum to seek assistance. Please refer to the section [I have a quesetion](#i-have-a-question) instead.\n* **No generic titles** such as \"Question\", \"Help\", \"Crash Report\" etc.\n  * If you just got a crash report but you don't understand it, please look for a line starting with `Message`. It summarizes the bug.\n* Information must be provided in the issue body, not in the title. No tags like `[BUG]` are allowed in the title, including `[SOLVED]` for solved issues.\n* Similarly, no generic issue reports. For bugs, it is the issue author's responsibility to provide us an issue that is **trackable, debuggable, reproducible, reported professionally and is an actual bug**. If you do not provide us with a summary or instructions on how to reproduce the issue, it is a support request until the actual bug has been found and therefore the issue is closed.\n  * In simple words, if your issue does not appear to be a bug or a feature request, or if the issue cannot be properly confirmed to be valid, the issue will be closed until further information is provided.\n* To express appreciation, objection, confusion or other supported reactions on pull requests, issues or comments on them, use GitHub [reactions](https://github.com/blog/2119-add-reactions-to-pull-requests-issues-and-comments) rather than posting an individual comment with an emoji only. This helps keeping the issue/pull rqeuest conversation clean and readable.\n* If your issue is related to the Pocketmine-MP website, forums, etc., please [talk to a human directly](#i-have-a-question).\n\n## Contributing Code\n* Use the [Pull Request](https://github.com/pmmp/PocketMine-MP/pull/new) system, your request will be checked and discussed.\n* Create each pull request on a new branch. Do not create a pull request on commits that exist in another pull request.\n* Code should use the same syntax as in PocketMine-MP. See below for an example.\n* The code must be clear and written in English, comments included.\n* Use descriptive commit titles\n* **Keep each pull request only contain one feature**. The only exception is when all features in the pull request are related to each other, and share the same core changes.\n* **Do not create pull requests that only bump the MCPE version**. If it is ready to be updated, the team will update the values directly. Do not change the MCPE version or protocol version in a pull request, unless you have updated the protocol (all packets) entirely.\n\n**Thanks for contributing to PocketMine-MP!**\n\n### Code Syntax\n\nIt is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) with a few exceptions.\n\n* Opening braces MUST go on the same line, and MUST NOT have spaces before.\n* `else if` MUST be written as `elseif`. _(It is in PSR-2, but using a SHOULD)_\n* Control structure keywords or opening braces MUST NOT have one space before or after them.\n* Code MUST use tabs for indenting.\n* Long arrays MAY be split across multiple lines, where each subsequent line is indented once. \n* Files MUST use only the `<?php` tag.\n* Files MUST NOT have an ending `?>` tag.\n* Code MUST use namespaces.\n* Strings SHOULD use the double quote `\"` except when the single quote is required.\n\n```php\n<?php \n\nnamespace pocketmine\\example;\n\nclass ExampleClass{\n\tconst EXAMPLE_CLASS_CONSTANT = 1;\n\tpublic $examplePublicVariable = \"defaultValue\";\n\tprivate $examplePrivateVariable;\n\t\n\t/**\n\t * Creates an instance of ExampleClass\n\t * @param string      $firstArgument  the first argument\n\t * @param string|null $secondArgument default null\n\t */\n\tpublic function __construct($firstArgument, &$secondArgument = null){\n\t\tif($firstArgument === \"exampleValue\"){ //Remember to use === instead == when possible\n\t\t\t//do things\n\t\t}elseif($firstArgument === \"otherValue\"){\n\t\t\t$secondArgument = function(){\n\t\t\t\t$this->examplePrivateVariable = [\n\t\t\t\t\t0 => \"value1\",\n\t\t\t\t\t1 => \"value2\",\n\t\t\t\t\t2 => \"value3\",\n\t\t\t\t\t3 => \"value4\",\n\t\t\t\t\t4 => \"value5\",\n\t\t\t\t\t5 => \"value6\",\n\t\t\t\t];\n\t\t\t};\n\t\t}\n\t}\n\n}\n```\n\n### RFC and Voting\n* These are big Pull Requests or contributions that change important behavior.\n* RFCs will be tagged with the *PR: RFC* label\n* A vote will be held once the RFC is ready. All users can vote commenting on the Pull Request\n* Comments MUST use \"Yes\" or \"No\" on the FIRST sentence to signify the vote, except when they don't want it to be counted.\n* If your comment is a voting comment, specify the reason of your vote or it won't be counted.\n* After voting has been closed, no further votes will be counted.\n* An RFC will be rejected if less than 50% + 1 (simple majority) has voted Yes.\n* If the RFC is approved, Team Members have the final word on its implementation or rejection.\n* RFCs with complex voting options will specify the vote percentage or other details.\n\n\n## Bug Tracking for Collaborators\n\n### Labels\nTo provide a concise bug tracking environment, prevent the issue tracker from over flowing and to keep support requests out of the bug tracker, PocketMine-MP uses a label scheme a bit different from the default GitHub Issues labels.\n\nPocketMine-MP uses Labels to identify the types and status of issues and pull requests.\n\n#### Categories\nCategory labels are prefixed by `Related:`. Multiple category labels may be applied to a single issue(but try to keep this to a minimum and do not overuse category labels).\n\n* `Related: Core` - This label is applied when the bug results in a fatal crash, or is related to neither Gameplay nor Plugin API.\n* `Related: Gameplay` - This label is applied when the bug effects the gameplay.\n* `Related: Plugin API` - This label is applied when the bug effects the Plugin API.\n\n#### Pull Requests\nPull Requests are prefixed by `PR:`. Only one label may be applied for a Pull Request.\n\n* PR: Bug Fix - This label is applied when the Pull Request fixes a bug. \n* PR: Addition - This label is applied when the Pull Request contributes new features or improvements, but does not fix a bug, nor controversial enough to be an RFC.\n* PR: RFC - Request for Comments. Refer to [RFC and Voting](#rfc-and-voting).\n\n#### Status\nStatus labels show the status of the issue. Multiple status labels may be applied.\n\n* `Status: Reproduced` - This label is applied when the bug has been reproduced, or multiple people are reporting the same issue and symptoms in which case it is automatically assumed that the bug has been reproduced in different environments.\n* `Status: Debugged` - This label is applied when the cause of the bug has been found.\n* `Status: High Priority` - This label is applied when the bug is easy to fix, or if the scale of the bug is global.\n* `Status: Insufficiently tested` - This label is applied for pull requests that have not undergone tests strict enough.\n\n#### Miscellaneous\nMiscellaneous labels are labels that show status not related to debugging that bug. The To-Do label and the Mojang label may not be applied to a single issue at the same time.\n\n* `Affiliation: Mojang` - This label is applied when the issue is suspected of being caused by the Minecraft client, but has not been confirmed.\n* `Affiliation: MCPE` - Same as `Affiliated: Mojang`, but only applied if the issue is only specific to the Pocket Edition (but not the Windows 10 Edition)\n* `Affiliation: Windows 10` - Same as `Affiliated: Mojang`, but only applied if the issue is only specific to the Windows 10 Edition (but not the Pocket Edition)\n* `Affiliation: Meta` - This label is applied for issues or pull requests that are related to this GitHub repo. **Still, do not report bugs related to other parts of PocketMine-MP.**\n* `Category: Bug` - This label is applied to issues that are bugs, but not necessarily reproduced.\n* `Category: To-Do` - This label is applied when the issue is not a bug, but a feature request or a list of features to be implemented that count towards a milestone.\n* `Category: Protocol update` - This label is applied if the issue or pull request is related to client protocol updates.\n* `Category: Invalid` - This label is applied when the issue is reporting a false bug that works as intended, a support request, etc. *This label may only be applied to a closed issue.*\n* `Category: Won't fix` - This label is applied if the bug has been decided not be fixed for some reason. e.g. when the bug benefits gameplay. _This label may only be applied to a closed issue._\n\n### Closing Issues\nTo keep the bug tracker clear of non-related issues and to prevent it from overflowing, **issues must be closed as soon as possible** (This may sound unethical, but it is MUCH better than having the BUG TRACKER filled with SUPPORT REQUESTS and \"I NEED HELP\").\n\nIf an issue does not conform to the \"Creating an Issue\" guidelines above, the issue should be closed.\n\n### Milestones\nPocketMine-MP uses GitHub Milestones to set a goal for a new release. A milestone is set on the following occasions.\n\n- A new Beta release\n- A new Stable release\n\nA milestone must use the following format:\n```\nAlpha_<version_number> [release_title][release_version]\n```\nFor example:\n```\nAlpha_1.4 beta2\n```\n"
  },
  {
    "path": "LICENSE",
    "content": "                   GNU LESSER GENERAL PUBLIC LICENSE\n                       Version 3, 29 June 2007\n\n Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>\n Everyone is permitted to copy and distribute verbatim copies\n of this license document, but changing it is not allowed.\n\n\n  This version of the GNU Lesser General Public License incorporates\nthe terms and conditions of version 3 of the GNU General Public\nLicense, supplemented by the additional permissions listed below.\n\n  0. Additional Definitions.\n\n  As used herein, \"this License\" refers to version 3 of the GNU Lesser\nGeneral Public License, and the \"GNU GPL\" refers to version 3 of the GNU\nGeneral Public License.\n\n  \"The Library\" refers to a covered work governed by this License,\nother than an Application or a Combined Work as defined below.\n\n  An \"Application\" is any work that makes use of an interface provided\nby the Library, but which is not otherwise based on the Library.\nDefining a subclass of a class defined by the Library is deemed a mode\nof using an interface provided by the Library.\n\n  A \"Combined Work\" is a work produced by combining or linking an\nApplication with the Library.  The particular version of the Library\nwith which the Combined Work was made is also called the \"Linked\nVersion\".\n\n  The \"Minimal Corresponding Source\" for a Combined Work means the\nCorresponding Source for the Combined Work, excluding any source code\nfor portions of the Combined Work that, considered in isolation, are\nbased on the Application, and not on the Linked Version.\n\n  The \"Corresponding Application Code\" for a Combined Work means the\nobject code and/or source code for the Application, including any data\nand utility programs needed for reproducing the Combined Work from the\nApplication, but excluding the System Libraries of the Combined Work.\n\n  1. Exception to Section 3 of the GNU GPL.\n\n  You may convey a covered work under sections 3 and 4 of this License\nwithout being bound by section 3 of the GNU GPL.\n\n  2. Conveying Modified Versions.\n\n  If you modify a copy of the Library, and, in your modifications, a\nfacility refers to a function or data to be supplied by an Application\nthat uses the facility (other than as an argument passed when the\nfacility is invoked), then you may convey a copy of the modified\nversion:\n\n   a) under this License, provided that you make a good faith effort to\n   ensure that, in the event an Application does not supply the\n   function or data, the facility still operates, and performs\n   whatever part of its purpose remains meaningful, or\n\n   b) under the GNU GPL, with none of the additional permissions of\n   this License applicable to that copy.\n\n  3. Object Code Incorporating Material from Library Header Files.\n\n  The object code form of an Application may incorporate material from\na header file that is part of the Library.  You may convey such object\ncode under terms of your choice, provided that, if the incorporated\nmaterial is not limited to numerical parameters, data structure\nlayouts and accessors, or small macros, inline functions and templates\n(ten or fewer lines in length), you do both of the following:\n\n   a) Give prominent notice with each copy of the object code that the\n   Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the object code with a copy of the GNU GPL and this license\n   document.\n\n  4. Combined Works.\n\n  You may convey a Combined Work under terms of your choice that,\ntaken together, effectively do not restrict modification of the\nportions of the Library contained in the Combined Work and reverse\nengineering for debugging such modifications, if you also do each of\nthe following:\n\n   a) Give prominent notice with each copy of the Combined Work that\n   the Library is used in it and that the Library and its use are\n   covered by this License.\n\n   b) Accompany the Combined Work with a copy of the GNU GPL and this license\n   document.\n\n   c) For a Combined Work that displays copyright notices during\n   execution, include the copyright notice for the Library among\n   these notices, as well as a reference directing the user to the\n   copies of the GNU GPL and this license document.\n\n   d) Do one of the following:\n\n       0) Convey the Minimal Corresponding Source under the terms of this\n       License, and the Corresponding Application Code in a form\n       suitable for, and under terms that permit, the user to\n       recombine or relink the Application with a modified version of\n       the Linked Version to produce a modified Combined Work, in the\n       manner specified by section 6 of the GNU GPL for conveying\n       Corresponding Source.\n\n       1) Use a suitable shared library mechanism for linking with the\n       Library.  A suitable mechanism is one that (a) uses at run time\n       a copy of the Library already present on the user's computer\n       system, and (b) will operate properly with a modified version\n       of the Library that is interface-compatible with the Linked\n       Version.\n\n   e) Provide Installation Information, but only if you would otherwise\n   be required to provide such information under section 6 of the\n   GNU GPL, and only to the extent that such information is\n   necessary to install and execute a modified version of the\n   Combined Work produced by recombining or relinking the\n   Application with a modified version of the Linked Version. (If\n   you use option 4d0, the Installation Information must accompany\n   the Minimal Corresponding Source and Corresponding Application\n   Code. If you use option 4d1, you must provide the Installation\n   Information in the manner specified by section 6 of the GNU GPL\n   for conveying Corresponding Source.)\n\n  5. Combined Libraries.\n\n  You may place library facilities that are a work based on the\nLibrary side by side in a single library together with other library\nfacilities that are not Applications and are not covered by this\nLicense, and convey such a combined library under terms of your\nchoice, if you do both of the following:\n\n   a) Accompany the combined library with a copy of the same work based\n   on the Library, uncombined with any other library facilities,\n   conveyed under the terms of this License.\n\n   b) Give prominent notice with the combined library that part of it\n   is a work based on the Library, and explaining where to find the\n   accompanying uncombined form of the same work.\n\n  6. Revised Versions of the GNU Lesser General Public License.\n\n  The Free Software Foundation may publish revised and/or new versions\nof the GNU Lesser General Public License from time to time. Such new\nversions will be similar in spirit to the present version, but may\ndiffer in detail to address new problems or concerns.\n\n  Each version is given a distinguishing version number. If the\nLibrary as you received it specifies that a certain numbered version\nof the GNU Lesser General Public License \"or any later version\"\napplies to it, you have the option of following the terms and\nconditions either of that published version or of any later version\npublished by the Free Software Foundation. If the Library as you\nreceived it does not specify a version number of the GNU Lesser\nGeneral Public License, you may choose any version of the GNU Lesser\nGeneral Public License ever published by the Free Software Foundation.\n\n  If the Library as you received it specifies that a proxy can decide\nwhether future versions of the GNU Lesser General Public License shall\napply, that proxy's public statement of acceptance of any version is\npermanent authorization for you to choose that version for the\nLibrary."
  },
  {
    "path": "README.md",
    "content": "##Elywing has been discontinued. Thanks for everything !\n"
  },
  {
    "path": "src/pocketmine/Achievement.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\utils\\TextFormat;\n\n/**\n * Handles the achievement list and a bit more\n */\nabstract class Achievement{\n\t/**\n\t * @var array[]\n\t */\n\tpublic static $list = [\n\t\t/*\"openInventory\" => array(\n\t\t\t\"name\" => \"Taking Inventory\",\n\t\t\t\"requires\" => [],\n\t\t),*/\n\t\t\"mineWood\" => [\n\t\t\t\"name\" => \"Getting Wood\",\n\t\t\t\"requires\" => [ //\"openInventory\",\n\t\t\t],\n\t\t],\n\t\t\"buildWorkBench\" => [\n\t\t\t\"name\" => \"Benchmarking\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"mineWood\",\n\t\t\t],\n\t\t],\n\t\t\"buildPickaxe\" => [\n\t\t\t\"name\" => \"Time to Mine!\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildWorkBench\",\n\t\t\t],\n\t\t],\n\t\t\"buildFurnace\" => [\n\t\t\t\"name\" => \"Hot Topic\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildPickaxe\",\n\t\t\t],\n\t\t],\n\t\t\"acquireIron\" => [\n\t\t\t\"name\" => \"Acquire hardware\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildFurnace\",\n\t\t\t],\n\t\t],\n\t\t\"buildHoe\" => [\n\t\t\t\"name\" => \"Time to Farm!\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildWorkBench\",\n\t\t\t],\n\t\t],\n\t\t\"makeBread\" => [\n\t\t\t\"name\" => \"Bake Bread\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildHoe\",\n\t\t\t],\n\t\t],\n\t\t\"bakeCake\" => [\n\t\t\t\"name\" => \"The Lie\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildHoe\",\n\t\t\t],\n\t\t],\n\t\t\"buildBetterPickaxe\" => [\n\t\t\t\"name\" => \"Getting an Upgrade\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildPickaxe\",\n\t\t\t],\n\t\t],\n\t\t\"buildSword\" => [\n\t\t\t\"name\" => \"Time to Strike!\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"buildWorkBench\",\n\t\t\t],\n\t\t],\n\t\t\"diamonds\" => [\n\t\t\t\"name\" => \"DIAMONDS!\",\n\t\t\t\"requires\" => [\n\t\t\t\t\"acquireIron\",\n\t\t\t],\n\t\t],\n\n\t];\n\n\n\tpublic static function broadcast(Player $player, $achievementId){\n\t\tif(isset(Achievement::$list[$achievementId])){\n\t\t\t$translation = new TranslationContainer(\"chat.type.achievement\", [$player->getDisplayName(), TextFormat::GREEN . Achievement::$list[$achievementId][\"name\"]]);\n\t\t\tif(Server::getInstance()->getConfigString(\"announce-player-achievements\", true) === true){\n\t\t\t\tServer::getInstance()->broadcastMessage($translation);\n\t\t\t}else{\n\t\t\t\t$player->sendMessage($translation);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic static function add($achievementId, $achievementName, array $requires = []){\n\t\tif(!isset(Achievement::$list[$achievementId])){\n\t\t\tAchievement::$list[$achievementId] = [\n\t\t\t\t\"name\" => $achievementName,\n\t\t\t\t\"requires\" => $requires,\n\t\t\t];\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\n}\n"
  },
  {
    "path": "src/pocketmine/Collectable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nabstract class Collectable extends \\Threaded implements \\Collectable{\n\n\tprivate $isGarbage = false;\n\n\tpublic function isGarbage() : bool{\n\t\treturn $this->isGarbage;\n\t}\n\n\tpublic function setGarbage(){\n\t\t$this->isGarbage = true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/CompatibleClassLoader.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nclass CompatibleClassLoader extends \\BaseClassLoader{\n\n}"
  },
  {
    "path": "src/pocketmine/CrashDump.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nuse pocketmine\\network\\protocol\\Info;\nuse pocketmine\\plugin\\PluginBase;\nuse pocketmine\\plugin\\PluginLoadOrder;\nuse pocketmine\\utils\\Utils;\nuse pocketmine\\utils\\VersionString;\nuse raklib\\RakLib;\n\nclass CrashDump{\n\n\t/** @var Server */\n\tprivate $server;\n\tprivate $fp;\n\tprivate $time;\n\tprivate $data = [];\n\tprivate $encodedData = null;\n\tprivate $path;\n\n\tpublic function __construct(Server $server){\n\t\t$this->time = time();\n\t\t$this->server = $server;\n\t\t$this->path = $this->server->getCrashPath() . \"CrashDump_\" . date(\"D_M_j-H.i.s-T_Y\", $this->time) . \".log\";\n\t\t$this->fp = @fopen($this->path, \"wb\");\n\t\tif(!is_resource($this->fp)){\n\t\t\tthrow new \\RuntimeException(\"Could not create Crash Dump\");\n\t\t}\n\t\t$this->data[\"time\"] = $this->time;\n\t\t$this->addLine($this->server->getName() . \" Crash Dump \" . date(\"D M j H:i:s T Y\", $this->time));\n\t\t$this->addLine();\n\t\ttry{\n\t\t\t$this->baseCrash();\n\t\t}catch(\\Exception $e){\n\t\t\t//Attempt to fix incomplete crashdumps\n\t\t\t$this->addLine(\"CrashDump crashed while generating base crash data\");\n\t\t\t$this->addLine();\n\t\t}\n\t\t\n\t\t$this->generalData();\n\t\t$this->pluginsData();\n\n\t\t$this->extraData();\n\n\t\t//$this->encodeData();\n\t}\n\n\tpublic function getPath(){\n\t\treturn $this->path;\n\t}\n\n\tpublic function getEncodedData(){\n\t\treturn $this->encodedData;\n\t}\n\n\tpublic function getData(){\n\t\treturn $this->data;\n\t}\n\n\tprivate function encodeData(){\n\t\t$this->addLine();\n\t\t$this->addLine(\"----------------------REPORT THE DATA BELOW THIS LINE-----------------------\");\n\t\t$this->addLine();\n\t\t$this->addLine(\"===BEGIN CRASH DUMP===\");\n\t\t$this->encodedData = zlib_encode(json_encode($this->data, JSON_UNESCAPED_SLASHES), ZLIB_ENCODING_DEFLATE, 9);\n\t\tforeach(str_split(base64_encode($this->encodedData), 76) as $line){\n\t\t\t$this->addLine($line);\n\t\t}\n\t\t$this->addLine(\"===END CRASH DUMP===\");\n\t}\n\n\tprivate function pluginsData(){\n\t\tif(class_exists(\"pocketmine\\\\plugin\\\\PluginManager\", false)){\n\t\t\t$this->addLine();\n\t\t\t$this->addLine(\"Loaded plugins:\");\n\t\t\t$this->data[\"plugins\"] = [];\n\t\t\tforeach($this->server->getPluginManager()->getPlugins() as $p){\n\t\t\t\t$d = $p->getDescription();\n\t\t\t\t$this->data[\"plugins\"][$d->getName()] = [\n\t\t\t\t\t\"name\" => $d->getName(),\n\t\t\t\t\t\"version\" => $d->getVersion(),\n\t\t\t\t\t\"authors\" => $d->getAuthors(),\n\t\t\t\t\t\"api\" => $d->getCompatibleApis(),\n\t\t\t\t\t\"enabled\" => $p->isEnabled(),\n\t\t\t\t\t\"depends\" => $d->getDepend(),\n\t\t\t\t\t\"softDepends\" => $d->getSoftDepend(),\n\t\t\t\t\t\"main\" => $d->getMain(),\n\t\t\t\t\t\"load\" => $d->getOrder() === PluginLoadOrder::POSTWORLD ? \"POSTWORLD\" : \"STARTUP\",\n\t\t\t\t\t\"website\" => $d->getWebsite()\n\t\t\t\t];\n\t\t\t\t$this->addLine($d->getName() . \" \" . $d->getVersion() . \" by \" . implode(\", \", $d->getAuthors()) . \" for API(s) \" . implode(\", \", $d->getCompatibleApis()));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function extraData(){\n\t\tglobal $arguments;\n\n\t\tif($this->server->getProperty(\"auto-report.send-settings\", true) !== false){\n\t\t\t$this->data[\"parameters\"] = (array) $arguments;\n\t\t\t$this->data[\"server.properties\"] = @file_get_contents($this->server->getDataPath() . \"server.properties\");\n\t\t\t$this->data[\"server.properties\"] = preg_replace(\"#^rcon\\\\.password=(.*)$#m\", \"rcon.password=******\", $this->data[\"server.properties\"]);\n\t\t\t$this->data[\"pocketmine.yml\"] = @file_get_contents($this->server->getDataPath() . \"pocketmine.yml\");\n\t\t}else{\n\t\t\t$this->data[\"pocketmine.yml\"] = \"\";\n\t\t\t$this->data[\"server.properties\"] = \"\";\n\t\t\t$this->data[\"parameters\"] = [];\n\t\t}\n\t\t$extensions = [];\n\t\tforeach(get_loaded_extensions() as $ext){\n\t\t\t$extensions[$ext] = phpversion($ext);\n\t\t}\n\t\t$this->data[\"extensions\"] = $extensions;\n\n\t\tif($this->server->getProperty(\"auto-report.send-phpinfo\", true) !== false){\n\t\t\tob_start();\n\t\t\tphpinfo();\n\t\t\t$this->data[\"phpinfo\"] = ob_get_contents();\n\t\t\tob_end_clean();\n\t\t}\n\t}\n\n\tprivate function baseCrash(){\n\t\tglobal $lastExceptionError, $lastError;\n\n\t\tif(isset($lastExceptionError)){\n\t\t\t$error = $lastExceptionError;\n\t\t}else{\n\t\t\t$error = (array) error_get_last();\n\t\t\t$error[\"trace\"] = @getTrace(3);\n\t\t\t$errorConversion = [\n\t\t\t\tE_ERROR => \"E_ERROR\",\n\t\t\t\tE_WARNING => \"E_WARNING\",\n\t\t\t\tE_PARSE => \"E_PARSE\",\n\t\t\t\tE_NOTICE => \"E_NOTICE\",\n\t\t\t\tE_CORE_ERROR => \"E_CORE_ERROR\",\n\t\t\t\tE_CORE_WARNING => \"E_CORE_WARNING\",\n\t\t\t\tE_COMPILE_ERROR => \"E_COMPILE_ERROR\",\n\t\t\t\tE_COMPILE_WARNING => \"E_COMPILE_WARNING\",\n\t\t\t\tE_USER_ERROR => \"E_USER_ERROR\",\n\t\t\t\tE_USER_WARNING => \"E_USER_WARNING\",\n\t\t\t\tE_USER_NOTICE => \"E_USER_NOTICE\",\n\t\t\t\tE_STRICT => \"E_STRICT\",\n\t\t\t\tE_RECOVERABLE_ERROR => \"E_RECOVERABLE_ERROR\",\n\t\t\t\tE_DEPRECATED => \"E_DEPRECATED\",\n\t\t\t\tE_USER_DEPRECATED => \"E_USER_DEPRECATED\",\n\t\t\t];\n\t\t\t$error[\"fullFile\"] = $error[\"file\"];\n\t\t\t$error[\"file\"] = cleanPath($error[\"file\"]);\n\t\t\t$error[\"type\"] = isset($errorConversion[$error[\"type\"]]) ? $errorConversion[$error[\"type\"]] : $error[\"type\"];\n\t\t\tif(($pos = strpos($error[\"message\"], \"\\n\")) !== false){\n\t\t\t\t$error[\"message\"] = substr($error[\"message\"], 0, $pos);\n\t\t\t}\n\t\t}\n\n\t\tif(isset($lastError)){\n\t\t\t$this->data[\"lastError\"] = $lastError;\n\t\t}\n\n\t\t$this->data[\"error\"] = $error;\n\t\tunset($this->data[\"error\"][\"fullFile\"]);\n\t\tunset($this->data[\"error\"][\"trace\"]);\n\t\t$this->addLine(\"Error: \" . $error[\"message\"]);\n\t\t$this->addLine(\"File: \" . $error[\"file\"]);\n\t\t$this->addLine(\"Line: \" . $error[\"line\"]);\n\t\t$this->addLine(\"Type: \" . $error[\"type\"]);\n\t\t\n\t\tif(strpos($error[\"file\"], \"src/pocketmine/\") === false and strpos($error[\"file\"], \"src/raklib/\") === false and file_exists($error[\"fullFile\"])){\n\t\t\t$this->addLine();\n\t\t\t$this->addLine(\"THIS CRASH WAS CAUSED BY A PLUGIN\");\n\t\t\t$this->data[\"plugin\"] = true;\n\n\t\t\t$reflection = new \\ReflectionClass(PluginBase::class);\n\t\t\t$file = $reflection->getProperty(\"file\");\n\t\t\t$file->setAccessible(true);\n\t\t\tforeach($this->server->getPluginManager()->getPlugins() as $plugin){\n\t\t\t\t$filePath = \\pocketmine\\cleanPath($file->getValue($plugin));\n\t\t\t\tif(strpos($error[\"file\"], $filePath) === 0){\n\t\t\t\t\t$this->data[\"plugin\"] = $plugin->getName();\n\t\t\t\t\t$this->addLine(\"BAD PLUGIN : \" . $plugin->getDescription()->getFullName());\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$this->data[\"plugin\"] = false;\n\t\t}\n\n\t\t$this->addLine();\n\t\t$this->addLine(\"Code:\");\n\t\t$this->data[\"code\"] = [];\n\n\t\tif($this->server->getProperty(\"auto-report.send-code\", true) !== false){\n\t\t\t$file = @file($error[\"fullFile\"], FILE_IGNORE_NEW_LINES);\n\t\t\tfor($l = max(0, $error[\"line\"] - 10); $l < $error[\"line\"] + 10; ++$l){\n\t\t\t\t$this->addLine(\"[\" . ($l + 1) . \"] \" . @$file[$l]);\n\t\t\t\t$this->data[\"code\"][$l + 1] = @$file[$l];\n\t\t\t}\n\t\t}\n\n\t\t$this->addLine();\n\t\t$this->addLine(\"Backtrace:\");\n\t\tforeach(($this->data[\"trace\"] = $error[\"trace\"]) as $line){\n\t\t\t$this->addLine($line);\n\t\t}\n\t\t$this->addLine();\n\t}\n\n\tprivate function generalData(){\n\t\t$version = new VersionString();\n\t\t$this->data[\"general\"] = [];\n\t\t$this->data[\"general\"][\"protocol\"] = Info::CURRENT_PROTOCOL;\n\t\t$this->data[\"general\"][\"api\"] = \\pocketmine\\API_VERSION;\n\t\t$this->data[\"general\"][\"git\"] = \\pocketmine\\GIT_COMMIT;\n\t\t$this->data[\"general\"][\"raklib\"] = RakLib::VERSION;\n\t\t$this->data[\"general\"][\"uname\"] = php_uname(\"a\");\n\t\t$this->data[\"general\"][\"php\"] = phpversion();\n\t\t$this->data[\"general\"][\"zend\"] = zend_version();\n\t\t$this->data[\"general\"][\"php_os\"] = PHP_OS;\n\t\t$this->data[\"general\"][\"os\"] = Utils::getOS();\n\t\t$this->addLine(\"Genisys version: \" . \\pocketmine\\GIT_COMMIT . \" [Protocol \" . Info::CURRENT_PROTOCOL . \"; API \" . API_VERSION . \"]\");\n\t\t$this->addLine(\"uname -a: \" . php_uname(\"a\"));\n\t\t$this->addLine(\"PHP version: \" . phpversion());\n\t\t$this->addLine(\"Zend version: \" . zend_version());\n\t\t$this->addLine(\"OS : \" . PHP_OS . \", \" . Utils::getOS());\n\t\t$this->addLine();\n\t\t$this->addLine(\"Server uptime: \" . $this->server->getUptime());\n\t\t$this->addLine(\"Number of loaded worlds: \" . count($this->server->getLevels()));\n\t\t$this->addLine(\"Players online: \".count($this->server->getOnlinePlayers()).\"/\".$this->server->getMaxPlayers());\n\t}\n\n\tpublic function addLine($line = \"\"){\n\t\tfwrite($this->fp, $line . PHP_EOL);\n\t}\n\n\tpublic function add($str){\n\t\tfwrite($this->fp, $str);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/IPlayer.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nuse pocketmine\\permission\\ServerOperator;\n\ninterface IPlayer extends ServerOperator{\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isOnline();\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName();\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isBanned();\n\n\t/**\n\t * @param bool $banned\n\t */\n\tpublic function setBanned($banned);\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isWhitelisted();\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setWhitelisted($value);\n\n\t/**\n\t * @return Player|null\n\t */\n\tpublic function getPlayer();\n\n\t/**\n\t * @return int|double\n\t */\n\tpublic function getFirstPlayed();\n\n\t/**\n\t * @return int|double\n\t */\n\tpublic function getLastPlayed();\n\n\t/**\n\t * @return mixed\n\t */\n\tpublic function hasPlayedBefore();\n\n}\n"
  },
  {
    "path": "src/pocketmine/MemoryManager.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nuse pocketmine\\event\\server\\LowMemoryEvent;\nuse pocketmine\\event\\Timings;\nuse pocketmine\\scheduler\\GarbageCollectionTask;\nuse pocketmine\\utils\\Utils;\n\n\nclass MemoryManager{\n\n\t/** @var Server */\n\tprivate $server;\n\n\tprivate $memoryLimit;\n\tprivate $globalMemoryLimit;\n\tprivate $checkRate;\n\tprivate $checkTicker = 0;\n\tprivate $lowMemory = false;\n\n\tprivate $continuousTrigger = true;\n\tprivate $continuousTriggerRate;\n\tprivate $continuousTriggerCount = 0;\n\tprivate $continuousTriggerTicker = 0;\n\n\tprivate $garbageCollectionPeriod;\n\tprivate $garbageCollectionTicker = 0;\n\tprivate $garbageCollectionTrigger;\n\tprivate $garbageCollectionAsync;\n\n\tprivate $chunkLimit;\n\tprivate $chunkCollect;\n\tprivate $chunkTrigger;\n\n\tprivate $chunkCache;\n\tprivate $cacheTrigger;\n\n\t/** @var \\WeakRef[] */\n\tprivate $leakWatch = [];\n\n\tprivate $leakInfo = [];\n\n\tprivate $leakSeed = 0;\n\n\tpublic function __construct(Server $server){\n\t\t$this->server = $server;\n\n\t\t$this->init();\n\t}\n\n\tprivate function init(){\n\t\t$this->memoryLimit = ((int) $this->server->getProperty(\"memory.main-limit\", 0)) * 1024 * 1024;\n\n\t\t$defaultMemory = 1024;\n\n\t\tif(preg_match(\"/([0-9]+)([KMGkmg])/\", $this->server->getConfigString(\"memory-limit\", \"\"), $matches) > 0){\n\t\t\t$m = (int) $matches[1];\n\t\t\tif($m <= 0){\n\t\t\t\t$defaultMemory = 0;\n\t\t\t}else{\n\t\t\t\tswitch(strtoupper($matches[2])){\n\t\t\t\t\tcase \"K\":\n\t\t\t\t\t\t$defaultMemory = $m / 1024;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"M\":\n\t\t\t\t\t\t$defaultMemory = $m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"G\":\n\t\t\t\t\t\t$defaultMemory = $m * 1024;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$defaultMemory = $m;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$hardLimit = ((int) $this->server->getProperty(\"memory.main-hard-limit\", $defaultMemory));\n\n\t\tif($hardLimit <= 0){\n\t\t\tini_set(\"memory_limit\", -1);\n\t\t}else{\n\t\t\tini_set(\"memory_limit\", $hardLimit . \"M\");\n\t\t}\n\n\t\t$this->globalMemoryLimit = ((int) $this->server->getProperty(\"memory.global-limit\", 0)) * 1024 * 1024;\n\t\t$this->checkRate = (int) $this->server->getProperty(\"memory.check-rate\", 20);\n\t\t$this->continuousTrigger = (bool) $this->server->getProperty(\"memory.continuous-trigger\", true);\n\t\t$this->continuousTriggerRate = (int) $this->server->getProperty(\"memory.continuous-trigger-rate\", 30);\n\n\t\t$this->garbageCollectionPeriod = (int) $this->server->getProperty(\"memory.garbage-collection.period\", 36000);\n\t\t$this->garbageCollectionTrigger = (bool) $this->server->getProperty(\"memory.garbage-collection.low-memory-trigger\", true);\n\t\t$this->garbageCollectionAsync = (bool) $this->server->getProperty(\"memory.garbage-collection.collect-async-worker\", true);\n\n\t\t$this->chunkLimit = (int) $this->server->getProperty(\"memory.max-chunks.trigger-limit\", 96);\n\t\t$this->chunkCollect = (bool) $this->server->getProperty(\"memory.max-chunks.trigger-chunk-collect\", true);\n\t\t$this->chunkTrigger = (bool) $this->server->getProperty(\"memory.max-chunks.low-memory-trigger\", true);\n\n\t\t$this->chunkCache = (bool) $this->server->getProperty(\"memory.world-caches.disable-chunk-cache\", true);\n\t\t$this->cacheTrigger = (bool) $this->server->getProperty(\"memory.world-caches.low-memory-trigger\", true);\n\n\t\tgc_enable();\n\t}\n\n\tpublic function isLowMemory(){\n\t\treturn $this->lowMemory;\n\t}\n\n\tpublic function canUseChunkCache(){\n\t\treturn !($this->lowMemory and $this->chunkTrigger);\n\t}\n\n\tpublic function getViewDistance($distance){\n\t\treturn $this->lowMemory ? min($this->chunkLimit, $distance) : $distance;\n\t}\n\n\tpublic function trigger($memory, $limit, $global = false, $triggerCount = 0){\n\t\t$this->server->getLogger()->debug(\"[Memory Manager] \".($global ? \"Global \" : \"\") .\"Low memory triggered, limit \". round(($limit / 1024) / 1024, 2).\"MB, using \". round(($memory / 1024) / 1024, 2).\"MB\");\n\n\t\tif($this->cacheTrigger){\n\t\t\tforeach($this->server->getLevels() as $level){\n\t\t\t\t$level->clearCache(true);\n\t\t\t}\n\t\t}\n\n\t\tif($this->chunkTrigger and $this->chunkCollect){\n\t\t\tforeach($this->server->getLevels() as $level){\n\t\t\t\t$level->doChunkGarbageCollection();\n\t\t\t}\n\t\t}\n\n\t\t$ev = new LowMemoryEvent($memory, $limit, $global, $triggerCount);\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\n\t\t$cycles = 0;\n\t\tif($this->garbageCollectionTrigger){\n\t\t\t$cycles = $this->triggerGarbageCollector();\n\t\t}\n\n\t\t$this->server->getLogger()->debug(\"[Memory Manager] Freed \" . round(($ev->getMemoryFreed() / 1024) / 1024, 2).\"MB, $cycles cycles\");\n\t}\n\n\tpublic function check(){\n\t\tTimings::$memoryManagerTimer->startTiming();\n\n\t\tif(($this->memoryLimit > 0 or $this->globalMemoryLimit > 0) and ++$this->checkTicker >= $this->checkRate){\n\t\t\t$this->checkTicker = 0;\n\t\t\t$memory = Utils::getMemoryUsage(true);\n\t\t\t$trigger = false;\n\t\t\tif($this->memoryLimit > 0 and $memory[0] > $this->memoryLimit){\n\t\t\t\t$trigger = 0;\n\t\t\t}elseif($this->globalMemoryLimit > 0 and $memory[1] > $this->globalMemoryLimit){\n\t\t\t\t$trigger = 1;\n\t\t\t}\n\n\t\t\tif($trigger !== false){\n\t\t\t\tif($this->lowMemory and $this->continuousTrigger){\n\t\t\t\t\tif(++$this->continuousTriggerTicker >= $this->continuousTriggerRate){\n\t\t\t\t\t\t$this->continuousTriggerTicker = 0;\n\t\t\t\t\t\t$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0, ++$this->continuousTriggerCount);\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$this->lowMemory = true;\n\t\t\t\t\t$this->continuousTriggerCount = 0;\n\t\t\t\t\t$this->trigger($memory[$trigger], $this->memoryLimit, $trigger > 0);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->lowMemory = false;\n\t\t\t}\n\t\t}\n\n\t\tif($this->garbageCollectionPeriod > 0 and ++$this->garbageCollectionTicker >= $this->garbageCollectionPeriod){\n\t\t\t$this->garbageCollectionTicker = 0;\n\t\t\t$this->triggerGarbageCollector();\n\t\t}\n\n\t\tTimings::$memoryManagerTimer->stopTiming();\n\t}\n\n\tpublic function triggerGarbageCollector(){\n\t\tTimings::$garbageCollectorTimer->startTiming();\n\n\t\tif($this->garbageCollectionAsync){\n\t\t\t$size = $this->server->getScheduler()->getAsyncTaskPoolSize();\n\t\t\tfor($i = 0; $i < $size; ++$i){\n\t\t\t\t$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GarbageCollectionTask(), $i);\n\t\t\t}\n\t\t}\n\n\t\t$cycles = gc_collect_cycles();\n\n\t\tforeach($this->server->getLevels() as $level){\n\t\t\t$level->doChunkGarbageCollection();\n\t\t}\n\n\t\tTimings::$garbageCollectorTimer->stopTiming();\n\n\t\treturn $cycles;\n\t}\n\n\t/**\n\t * @param object $object\n\t *\n\t * @return string Object identifier for future checks\n\t */\n\tpublic function addObjectWatcher($object){\n\t\tif(!is_object($object)){\n\t\t\tthrow new \\InvalidArgumentException(\"Not an object!\");\n\t\t}\n\n\n\t\t$identifier = spl_object_hash($object) . \":\" . get_class($object);\n\n\t\tif(isset($this->leakInfo[$identifier])){\n\t\t\treturn $this->leakInfo[\"id\"];\n\t\t}\n\n\t\t$this->leakInfo[$identifier] = [\n\t\t\t\"id\" => $id = md5($identifier . \":\" . $this->leakSeed++),\n\t\t\t\"class\" => get_class($object),\n\t\t\t\"hash\" => $identifier\n\t\t];\n\t\t$this->leakInfo[$id] = $this->leakInfo[$identifier];\n\n\t\t$this->leakWatch[$id] = new \\WeakRef($object);\n\n\t\treturn $id;\n\t}\n\n\tpublic function isObjectAlive($id){\n\t\tif(isset($this->leakWatch[$id])){\n\t\t\treturn $this->leakWatch[$id]->valid();\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function removeObjectWatch($id){\n\t\tif(!isset($this->leakWatch[$id])){\n\t\t\treturn;\n\t\t}\n\t\tunset($this->leakInfo[$this->leakInfo[$id][\"hash\"]]);\n\t\tunset($this->leakInfo[$id]);\n\t\tunset($this->leakWatch[$id]);\n\t}\n\n\tpublic function doObjectCleanup(){\n\t\tforeach($this->leakWatch as $id => $w){\n\t\t\tif(!$w->valid()){\n\t\t\t\t$this->removeObjectWatch($id);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getObjectInformation($id, $includeObject = false){\n\t\tif(!isset($this->leakWatch[$id])){\n\t\t\treturn null;\n\t\t}\n\n\t\t$valid = false;\n\t\t$references = 0;\n\t\t$object = null;\n\n\t\tif($this->leakWatch[$id]->acquire()){\n\t\t\t$object = $this->leakWatch[$id]->get();\n\t\t\t$this->leakWatch[$id]->release();\n\n\t\t\t$valid = true;\n\t\t\t$references = getReferenceCount($object, false);\n\t\t}\n\n\t\treturn [\n\t\t\t\"id\" => $id,\n\t\t\t\"class\" => $this->leakInfo[$id][\"class\"],\n\t\t\t\"hash\" => $this->leakInfo[$id][\"hash\"],\n\t\t\t\"valid\" => $valid,\n\t\t\t\"references\" => $references,\n\t\t\t\"object\" => $includeObject ? $object : null\n\t\t];\n\t}\n\n\tpublic function dumpServerMemory($outputFolder, $maxNesting, $maxStringSize){\n\t\tgc_disable();\n\t\tini_set(\"memory_limit\",-1);\n\t\tif(!file_exists($outputFolder)){\n\t\t\tmkdir($outputFolder, 0777, true);\n\t\t}\n\t\t$this->server->getLogger()->notice(\"[Dump] After the memory dump is done, the server will shut down\");\n\n\t\t$obData = fopen($outputFolder . \"/objects.js\", \"wb+\");\n\n\t\t$staticProperties = [];\n\n\t\t$data = [];\n\n\t\t$objects = [];\n\n\t\t$refCounts = [];\n\n\t\t$this->continueDump($this->server, $data, $objects, $refCounts, 0, $maxNesting, $maxStringSize);\n\n\t\tdo{\n\t\t\t$continue = false;\n\t\t\tforeach($objects as $hash => $object){\n\t\t\t\tif(!is_object($object)){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$continue = true;\n\n\t\t\t\t$className = get_class($object);\n\n\t\t\t\t$objects[$hash] = true;\n\n\t\t\t\t$reflection = new \\ReflectionObject($object);\n\n\t\t\t\t$info = [\n\t\t\t\t\t\"information\" => \"$hash@$className\",\n\t\t\t\t\t\"properties\" => []\n\t\t\t\t];\n\n\t\t\t\tif($reflection->getParentClass()){\n\t\t\t\t\t$info[\"parent\"] = $reflection->getParentClass()->getName();\n\t\t\t\t}\n\n\t\t\t\tif(count($reflection->getInterfaceNames()) > 0){\n\t\t\t\t\t$info[\"implements\"] = implode(\", \", $reflection->getInterfaceNames());\n\t\t\t\t}\n\n\t\t\t\tforeach($reflection->getProperties() as $property){\n\t\t\t\t\tif($property->isStatic()){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!$property->isPublic()){\n\t\t\t\t\t\t$property->setAccessible(true);\n\t\t\t\t\t}\n\t\t\t\t\t$this->continueDump($property->getValue($object), $info[\"properties\"][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);\n\t\t\t\t}\n\n\t\t\t\tfwrite($obData, \"$hash@$className: \". json_encode($info, JSON_UNESCAPED_SLASHES) . \"\\n\");\n\n\t\t\t\tif(!isset($objects[\"staticProperties\"][$className])){\n\t\t\t\t\t$staticProperties[$className] = [];\n\t\t\t\t\tforeach($reflection->getProperties() as $property){\n\t\t\t\t\t\tif(!$property->isStatic() or $property->getDeclaringClass()->getName() !== $className){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(!$property->isPublic()){\n\t\t\t\t\t\t\t$property->setAccessible(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->continueDump($property->getValue($object), $staticProperties[$className][$property->getName()], $objects, $refCounts, 0, $maxNesting, $maxStringSize);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\techo \"[Dump] Wrote \" . count($objects) . \" objects\\n\";\n\t\t}while($continue);\n\n\t\tfile_put_contents($outputFolder . \"/staticProperties.js\", json_encode($staticProperties, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));\n\t\tfile_put_contents($outputFolder . \"/serverEntry.js\", json_encode($data, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));\n\t\tfile_put_contents($outputFolder . \"/referenceCounts.js\", json_encode($refCounts, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));\n\n\t\techo \"[Dump] Finished!\\n\";\n\n\t\tgc_enable();\n\n\t\t$this->server->forceShutdown();\n\t}\n\n\tprivate function continueDump($from, &$data, &$objects, &$refCounts, $recursion, $maxNesting, $maxStringSize){\n\t\tif($maxNesting <= 0){\n\t\t\t$data = \"(error) NESTING LIMIT REACHED\";\n\t\t\treturn;\n\t\t}\n\n\t\t--$maxNesting;\n\n\t\tif(is_object($from)){\n\t\t\tif(!isset($objects[$hash = spl_object_hash($from)])){\n\t\t\t\t$objects[$hash] = $from;\n\t\t\t\t$refCounts[$hash] = 0;\n\t\t\t}\n\n\t\t\t++$refCounts[$hash];\n\n\t\t\t$data = \"(object) $hash@\" . get_class($from);\n\t\t}elseif(is_array($from)){\n\t\t\tif($recursion >= 5){\n\t\t\t\t$data = \"(error) ARRAY RECURSION LIMIT REACHED\";\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$data = [];\n\t\t\tforeach($from as $key => $value){\n\t\t\t\t$this->continueDump($value, $data[$key], $objects, $refCounts, $recursion + 1, $maxNesting, $maxStringSize);\n\t\t\t}\n\t\t}elseif(is_string($from)){\n\t\t\t$data = \"(string) len(\". strlen($from) .\") \" . substr(Utils::printable($from), 0, $maxStringSize);\n\t\t}elseif(is_resource($from)){\n\t\t\t$data = \"(resource) \" . print_r($from, true);\n\t\t}else{\n\t\t\t$data = $from;\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/OfflinePlayer.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\n\nuse pocketmine\\metadata\\MetadataValue;\nuse pocketmine\\metadata\\Metadatable;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\plugin\\Plugin;\n\nclass OfflinePlayer implements IPlayer, Metadatable{\n\n\tprivate $name;\n\tprivate $server;\n\tprivate $namedtag;\n\n\t/**\n\t * @param Server $server\n\t * @param string $name\n\t */\n\tpublic function __construct(Server $server, $name){\n\t\t$this->server = $server;\n\t\t$this->name = $name;\n\t\tif(file_exists($this->server->getDataPath() . \"players/\" . strtolower($this->getName()) . \".dat\")){\n\t\t\t$this->namedtag = $this->server->getOfflinePlayerData($this->name);\n\t\t}else{\n\t\t\t$this->namedtag = null;\n\t\t}\n\t}\n\n\tpublic function isOnline(){\n\t\treturn $this->getPlayer() !== null;\n\t}\n\n\tpublic function getName(){\n\t\treturn $this->name;\n\t}\n\n\tpublic function getServer(){\n\t\treturn $this->server;\n\t}\n\n\tpublic function isOp(){\n\t\treturn $this->server->isOp(strtolower($this->getName()));\n\t}\n\n\tpublic function setOp($value){\n\t\tif($value === $this->isOp()){\n\t\t\treturn;\n\t\t}\n\n\t\tif($value === true){\n\t\t\t$this->server->addOp(strtolower($this->getName()));\n\t\t}else{\n\t\t\t$this->server->removeOp(strtolower($this->getName()));\n\t\t}\n\t}\n\n\tpublic function isBanned(){\n\t\treturn $this->server->getNameBans()->isBanned(strtolower($this->getName()));\n\t}\n\n\tpublic function setBanned($value){\n\t\tif($value === true){\n\t\t\t$this->server->getNameBans()->addBan($this->getName(), null, null, null);\n\t\t}else{\n\t\t\t$this->server->getNameBans()->remove($this->getName());\n\t\t}\n\t}\n\n\tpublic function isWhitelisted(){\n\t\treturn $this->server->isWhitelisted(strtolower($this->getName()));\n\t}\n\n\tpublic function setWhitelisted($value){\n\t\tif($value === true){\n\t\t\t$this->server->addWhitelist(strtolower($this->getName()));\n\t\t}else{\n\t\t\t$this->server->removeWhitelist(strtolower($this->getName()));\n\t\t}\n\t}\n\n\tpublic function getPlayer(){\n\t\treturn $this->server->getPlayerExact($this->getName());\n\t}\n\n\tpublic function getFirstPlayed(){\n\t\treturn $this->namedtag instanceof CompoundTag ? $this->namedtag[\"firstPlayed\"] : null;\n\t}\n\n\tpublic function getLastPlayed(){\n\t\treturn $this->namedtag instanceof CompoundTag ? $this->namedtag[\"lastPlayed\"] : null;\n\t}\n\n\tpublic function hasPlayedBefore(){\n\t\treturn $this->namedtag instanceof CompoundTag;\n\t}\n\n\tpublic function setMetadata($metadataKey, MetadataValue $metadataValue){\n\t\t$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $metadataValue);\n\t}\n\n\tpublic function getMetadata($metadataKey){\n\t\treturn $this->server->getPlayerMetadata()->getMetadata($this, $metadataKey);\n\t}\n\n\tpublic function hasMetadata($metadataKey){\n\t\treturn $this->server->getPlayerMetadata()->hasMetadata($this, $metadataKey);\n\t}\n\n\tpublic function removeMetadata($metadataKey, Plugin $plugin){\n\t\t$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $plugin);\n\t}\n\n\n}\n"
  },
  {
    "path": "src/pocketmine/Player.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nuse pocketmine\\block\\Air;\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Fire;\nuse pocketmine\\block\\PressurePlate;\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\entity\\Animal;\nuse pocketmine\\entity\\Arrow;\nuse pocketmine\\entity\\Attribute;\nuse pocketmine\\entity\\Boat;\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\FishingHook;\nuse pocketmine\\entity\\Human;\nuse pocketmine\\entity\\Item as DroppedItem;\nuse pocketmine\\entity\\Living;\nuse pocketmine\\entity\\Minecart;\nuse pocketmine\\entity\\Projectile;\nuse pocketmine\\entity\\ThrownExpBottle;\nuse pocketmine\\entity\\ThrownPotion;\nuse pocketmine\\event\\block\\BlockBreakEvent;\nuse pocketmine\\event\\block\\ItemFrameDropItemEvent;\nuse pocketmine\\event\\block\\SignChangeEvent;\nuse pocketmine\\event\\entity\\EntityCombustByEntityEvent;\nuse pocketmine\\event\\entity\\EntityDamageByBlockEvent;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\event\\entity\\EntityShootBowEvent;\nuse pocketmine\\event\\entity\\ProjectileLaunchEvent;\nuse pocketmine\\event\\inventory\\CraftItemEvent;\nuse pocketmine\\event\\inventory\\InventoryCloseEvent;\nuse pocketmine\\event\\inventory\\InventoryPickupArrowEvent;\nuse pocketmine\\event\\inventory\\InventoryPickupItemEvent;\nuse pocketmine\\event\\player\\PlayerExhaustEvent;\nuse pocketmine\\event\\player\\PlayerTextPreSendEvent;\nuse pocketmine\\event\\player\\PlayerAchievementAwardedEvent;\nuse pocketmine\\event\\player\\PlayerAnimationEvent;\nuse pocketmine\\event\\player\\PlayerBedEnterEvent;\nuse pocketmine\\event\\player\\PlayerBedLeaveEvent;\nuse pocketmine\\event\\player\\PlayerChatEvent;\nuse pocketmine\\event\\player\\PlayerCommandPreprocessEvent;\nuse pocketmine\\event\\player\\PlayerDeathEvent;\nuse pocketmine\\event\\player\\PlayerDropItemEvent;\nuse pocketmine\\event\\player\\PlayerGameModeChangeEvent;\nuse pocketmine\\event\\player\\PlayerInteractEvent;\nuse pocketmine\\event\\player\\PlayerItemConsumeEvent;\nuse pocketmine\\event\\player\\PlayerJoinEvent;\nuse pocketmine\\event\\player\\PlayerKickEvent;\nuse pocketmine\\event\\player\\PlayerLoginEvent;\nuse pocketmine\\event\\player\\PlayerMoveEvent;\nuse pocketmine\\event\\player\\PlayerPreLoginEvent;\nuse pocketmine\\event\\player\\PlayerQuitEvent;\nuse pocketmine\\event\\player\\PlayerRespawnEvent;\nuse pocketmine\\event\\player\\PlayerToggleFlightEvent;\nuse pocketmine\\event\\player\\PlayerToggleSneakEvent;\nuse pocketmine\\event\\player\\PlayerToggleSprintEvent;\nuse pocketmine\\event\\player\\PlayerUseFishingRodEvent;\nuse pocketmine\\event\\server\\DataPacketReceiveEvent;\nuse pocketmine\\event\\server\\DataPacketSendEvent;\nuse pocketmine\\event\\player\\PlayerToggleGlideEvent;\nuse pocketmine\\event\\TextContainer;\nuse pocketmine\\event\\Timings;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\inventory\\AnvilInventory;\nuse pocketmine\\inventory\\BaseTransaction;\nuse pocketmine\\inventory\\BigShapedRecipe;\nuse pocketmine\\inventory\\BigShapelessRecipe;\nuse pocketmine\\inventory\\DropItemTransaction;\nuse pocketmine\\inventory\\EnchantInventory;\nuse pocketmine\\inventory\\FurnaceInventory;\nuse pocketmine\\inventory\\Inventory;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\inventory\\ShapedRecipe;\nuse pocketmine\\inventory\\ShapelessRecipe;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Elytra;\nuse pocketmine\\level\\ChunkLoader;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\Location;\nuse pocketmine\\level\\Position;\nuse pocketmine\\level\\sound\\LaunchSound;\nuse pocketmine\\level\\WeakPosition;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector2;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\metadata\\MetadataValue;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\LongTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\AdventureSettingsPacket;\nuse pocketmine\\network\\protocol\\AnimatePacket;\nuse pocketmine\\network\\protocol\\AvailableCommandsPacket;\nuse pocketmine\\network\\protocol\\BatchPacket;\nuse pocketmine\\network\\protocol\\ChunkRadiusUpdatedPacket;\nuse pocketmine\\network\\protocol\\ContainerSetContentPacket;\nuse pocketmine\\network\\protocol\\ChangeDimensionPacket;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\network\\protocol\\DisconnectPacket;\nuse pocketmine\\network\\protocol\\EntityEventPacket;\nuse pocketmine\\network\\protocol\\FullChunkDataPacket;\nuse pocketmine\\network\\protocol\\Info as ProtocolInfo;\nuse pocketmine\\network\\protocol\\InteractPacket;\nuse pocketmine\\network\\protocol\\MovePlayerPacket;\nuse pocketmine\\network\\protocol\\PlayerActionPacket;\nuse pocketmine\\network\\protocol\\PlayStatusPacket;\nuse pocketmine\\network\\protocol\\ResourcePacksInfoPacket;\nuse pocketmine\\network\\protocol\\RespawnPacket;\nuse pocketmine\\network\\protocol\\SetEntityMotionPacket;\nuse pocketmine\\network\\protocol\\SetSpawnPositionPacket;\nuse pocketmine\\network\\protocol\\SetTimePacket;\nuse pocketmine\\network\\protocol\\StartGamePacket;\nuse pocketmine\\network\\protocol\\SetPlayerGameTypePacket;\nuse pocketmine\\network\\protocol\\TakeItemEntityPacket;\nuse pocketmine\\network\\protocol\\TextPacket;\nuse pocketmine\\network\\protocol\\UpdateAttributesPacket;\nuse pocketmine\\network\\protocol\\UpdateBlockPacket;\nuse pocketmine\\network\\SourceInterface;\nuse pocketmine\\permission\\PermissibleBase;\nuse pocketmine\\permission\\PermissionAttachment;\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\tile\\ItemFrame;\nuse pocketmine\\tile\\Spawnable;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\utils\\Binary;\nuse pocketmine\\utils\\TextFormat;\nuse pocketmine\\utils\\UUID;\n\n/**\n * Main class that handles networking, recovery, and packet sending to the server part\n */\nclass Player extends Human implements CommandSender, InventoryHolder, ChunkLoader, IPlayer{\n\n\tconst SURVIVAL = 0;\n\tconst CREATIVE = 1;\n\tconst ADVENTURE = 2;\n\tconst SPECTATOR = 3;\n\tconst VIEW = Player::SPECTATOR;\n\n\tconst CRAFTING_SMALL = 0;\n\tconst CRAFTING_BIG = 1;\n\tconst CRAFTING_ANVIL = 2;\n\tconst CRAFTING_ENCHANT = 3;\n\n\t/** @var SourceInterface */\n\tprotected $interface;\n\n\t/** @var bool */\n\tpublic $playedBefore = false;\n\tpublic $spawned = false;\n\tpublic $loggedIn = false;\n\tpublic $gamemode;\n\tpublic $lastBreak;\n\n\tprotected $windowCnt = 2;\n\t/** @var \\SplObjectStorage<Inventory> */\n\tprotected $windows;\n\t/** @var Inventory[] */\n\tprotected $windowIndex = [];\n\n\tprotected $messageCounter = 2;\n\n\tprotected $sendIndex = 0;\n\n\tprivate $clientSecret;\n\n\t/** @var Vector3 */\n\tpublic $speed = null;\n\n\tpublic $blocked = false;\n\tpublic $achievements = [];\n\tpublic $lastCorrect;\n\n\tpublic $craftingType = self::CRAFTING_SMALL; //0 = 2x2 crafting, 1 = 3x3 crafting, 2 = anvil, 3 = enchanting\n\n\tprotected $isCrafting = false;\n\n\tpublic $creationTime = 0;\n\n\tprotected $randomClientId;\n\n\tprotected $protocol;\n\n\tprotected $lastMovement = 0;\n\t/** @var Vector3 */\n\tprotected $forceMovement = null;\n\t/** @var Vector3 */\n\tprotected $teleportPosition = null;\n\tprotected $connected = true;\n\tprotected $ip;\n\tprotected $removeFormat = false;\n\tprotected $port;\n\tprotected $username;\n\tprotected $iusername;\n\tprotected $displayName;\n\tprotected $deviceModel;\n\tprotected $startAction = -1;\n\t/** @var Vector3 */\n\tprotected $sleeping = null;\n\tprotected $clientID = null;\n\n\tprivate $loaderId = null;\n\n\tprotected $stepHeight = 0.6;\n\n\tpublic $usedChunks = [];\n\tprotected $chunkLoadCount = 0;\n\tprotected $loadQueue = [];\n\tprotected $nextChunkOrderRun = 5;\n\n\t/** @var Player[] */\n\tprotected $hiddenPlayers = [];\n\n\t/** @var Vector3 */\n\tprotected $newPosition;\n\n\tprotected $viewDistance;\n\tprotected $chunksPerTick;\n\tprotected $spawnThreshold;\n\t/** @var null|WeakPosition */\n\tprivate $spawnPosition = null;\n\n\tprotected $inAirTicks = 0;\n\tprotected $startAirTicks = 5;\n\n\t//TODO: Abilities\n\tprotected $autoJump = true;\n\tprotected $allowFlight = false;\n\tprotected $flying = false;\n\n\tprivate $needACK = [];\n\n\tprivate $batchedPackets = [];\n\n\t/** @var PermissibleBase */\n\tprivate $perm = null;\n\n\tpublic $weatherData = [0, 0, 0];\n\n\t/** @var Vector3 */\n\tpublic $fromPos = null;\n\tprivate $portalTime = 0;\n\tprotected $shouldSendStatus = false;\n\t/** @var  Position */\n\tprivate $shouldResPos;\n\n\t/** @var FishingHook */\n\tpublic $fishingHook = null;\n\n\t/** @var Position[] */\n\tpublic $selectedPos = [];\n\t/** @var Level[] */\n\tpublic $selectedLev = [];\n\n\t/** @var Item[] */\n\tprotected $personalCreativeItems = [];\n\n\tpublic function linkHookToPlayer(FishingHook $entity){\n\t\tif($entity->isAlive()){\n\t\t\t$this->setFishingHook($entity);\n\t\t\t$pk = new EntityEventPacket();\n\t\t\t$pk->eid = $this->getFishingHook()->getId();\n\t\t\t$pk->event = EntityEventPacket::FISH_HOOK_POSITION;\n\t\t\t$this->server->broadcastPacket($this->level->getPlayers(), $pk);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function unlinkHookFromPlayer(){\n\t\tif($this->fishingHook instanceof FishingHook){\n\t\t\t$pk = new EntityEventPacket();\n\t\t\t$pk->eid = $this->fishingHook->getId();\n\t\t\t$pk->event = EntityEventPacket::FISH_HOOK_TEASE;\n\t\t\t$this->server->broadcastPacket($this->level->getPlayers(), $pk);\n\t\t\t$this->setFishingHook();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function isFishing(){\n\t\treturn ($this->fishingHook instanceof FishingHook);\n\t}\n\n\tpublic function getFishingHook(){\n\t\treturn $this->fishingHook;\n\t}\n\n\tpublic function setFishingHook(FishingHook $entity = null){\n\t\tif($entity == null and $this->fishingHook instanceof FishingHook){\n\t\t\t$this->fishingHook->close();\n\t\t}\n\t\t$this->fishingHook = $entity;\n\t}\n\n\tpublic function getItemInHand(){\n\t\treturn $this->inventory->getItemInHand();\n\t}\n\n\tpublic function getLeaveMessage(){\n\t\treturn new TranslationContainer(TextFormat::YELLOW . \"%multiplayer.player.left\", [\n\t\t\t$this->getDisplayName()\n\t\t]);\n\t}\n\n\t/**\n\t * @deprecated Use Human::setTotalXp($xp), this method will be removed in the future.\n\t */\n\tpublic function setExperienceAndLevel(int $exp, int $level){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->setTotalXp(self::getTotalXpRequirement($level) + $exp);\n\t}\n\n\t/**\n\t * @deprecated Use Human::setTotalXp($xp), this method will be removed in the future.\n\t */\n\tpublic function setExp(int $exp){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->setTotalXp($exp);\n\t}\n\n\t/**\n\t * @deprecated Use Human::setXpLevel($level), this method will be removed in the future.\n\t */\n\tpublic function setExpLevel(int $level){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->setXpLevel($level);\n\t}\n\n\t/**\n\t * @deprecated Use Human::getTotalXpRequirement($level), this method will be removed in the future.\n\t */\n\tpublic function getExpectedExperience(){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn self::getTotalXpRequirement($this->getXpLevel() + 1);\n\t}\n\n\t/**\n\t * @deprecated Use Human::getLevelXpRequirement($level), this method will be removed in the future.\n\t */\n\tpublic function getLevelUpExpectedExperience(){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn self::getLevelXpRequirement($this->getXpLevel() + 1);\n\t}\n\n\t/**\n\t * @deprecated\n\t */\n\tpublic function calcExpLevel(){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t}\n\n\t/**\n\t * @deprecated Use Human::addXp($xp), this method will be removed in the future.\n\t */\n\tpublic function addExperience(int $exp){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->addXp($exp);\n\t}\n\n\t/**\n\t * @deprecated Use Human::addXpLevel(), this method will be removed in the future.\n\t */\n\tpublic function addExpLevel(int $level){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->addXpLevel($level);\n\t}\n\n\t/**\n\t * @deprecated Use Human::getTotalXp(), this method will be removed in the future.\n\t */\n\tpublic function getExp(){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->getTotalXp();\n\t}\n\n\t/**\n\t * @deprecated Use Human::getXpLevel(), this method will be removed in the future.\n\t */\n\tpublic function getExpLevel(){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->getXpLevel();\n\t}\n\n\t/**\n\t * @deprecated Use Human::canPickupXp(), this method will be removed in the future.\n\t */\n\tpublic function canPickupExp(): bool{\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\treturn $this->canPickupXp();\n\t}\n\n\t/**\n\t * @deprecated Use Human::resetXpCooldown(), this method will be removed in the future.\n\t */\n\tpublic function resetExpCooldown(){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t\t$this->resetXpCooldown();\n\t}\n\n\t/**\n\t * @deprecated\n\t */\n\tpublic function updateExperience(){\n\t\ttrigger_error(\"This method is deprecated, do not use it\", E_USER_DEPRECATED);\n\t}\n\n\t/**\n\t * This might disappear in the future.\n\t * Please use getUniqueId() instead (IP + clientId + name combo, in the future it'll change to real UUID for online\n\t * auth)\n\t */\n\tpublic function getClientId(){\n\t\treturn $this->randomClientId;\n\t}\n\t\n\tpublic function getDeviceModel(){\n\t\treturn $this->deviceModel;\n\t}\n\n\tpublic function getClientSecret(){\n\t\treturn $this->clientSecret;\n\t}\n\n\tpublic function isBanned(){\n\t\treturn $this->server->getNameBans()->isBanned(strtolower($this->getName()));\n\t}\n\n\tpublic function setBanned($value){\n\t\tif($value === true){\n\t\t\t$this->server->getNameBans()->addBan($this->getName(), null, null, null);\n\t\t\t$this->kick(TextFormat::RED . \"You have been banned\");\n\t\t}else{\n\t\t\t$this->server->getNameBans()->remove($this->getName());\n\t\t}\n\t}\n\n\tpublic function isWhitelisted() : bool{\n\t\treturn $this->server->isWhitelisted(strtolower($this->getName()));\n\t}\n\n\tpublic function setWhitelisted($value){\n\t\tif($value === true){\n\t\t\t$this->server->addWhitelist(strtolower($this->getName()));\n\t\t}else{\n\t\t\t$this->server->removeWhitelist(strtolower($this->getName()));\n\t\t}\n\t}\n\n\tpublic function getPlayer(){\n\t\treturn $this;\n\t}\n\n\tpublic function getFirstPlayed(){\n\t\treturn $this->namedtag instanceof CompoundTag ? $this->namedtag[\"firstPlayed\"] : null;\n\t}\n\n\tpublic function getLastPlayed(){\n\t\treturn $this->namedtag instanceof CompoundTag ? $this->namedtag[\"lastPlayed\"] : null;\n\t}\n\n\tpublic function hasPlayedBefore(){\n\t\treturn $this->playedBefore;\n\t}\n\n\tpublic function setAllowFlight($value){\n\t\t$this->allowFlight = (bool) $value;\n\t\t$this->sendSettings();\n\t}\n\n\tpublic function usingElytra() {\n \t\tif ($this->getInventory()->getChestplate() instanceof Elytra) {\n \t\t\treturn true;\n \t\t}\n \t\treturn false;\n \t}\n \n\tpublic function getAllowFlight() : bool{\n\t\treturn $this->allowFlight;\n\t}\n\n\tpublic function setFlying(bool $value){\n\t\t$this->flying = $value;\n\t\t$this->sendSettings();\n\t}\n\n\tpublic function isFlying() : bool{\n\t\treturn $this->flying;\n\t}\n\n\tpublic function setAutoJump($value){\n\t\t$this->autoJump = $value;\n\t\t$this->sendSettings();\n\t}\n\n\tpublic function hasAutoJump() : bool{\n\t\treturn $this->autoJump;\n\t}\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function spawnTo(Player $player){\n\t\tif($this->spawned and $player->spawned and $this->isAlive() and $player->isAlive() and $player->getLevel() === $this->level and $player->canSee($this) and !$this->isSpectator()){\n\t\t\tparent::spawnTo($player);\n\t\t}\n\t}\n\n\t/**\n\t * @return Server\n\t */\n\tpublic function getServer(){\n\t\treturn $this->server;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function getRemoveFormat(){\n\t\treturn $this->removeFormat;\n\t}\n\n\t/**\n\t * @param bool $remove\n\t */\n\tpublic function setRemoveFormat($remove = true){\n\t\t$this->removeFormat = (bool) $remove;\n\t}\n\n\t/**\n\t * @param Player $player\n\t *\n\t * @return bool\n\t */\n\tpublic function canSee(Player $player) : bool{\n\t\treturn !isset($this->hiddenPlayers[$player->getRawUniqueId()]);\n\t}\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function hidePlayer(Player $player){\n\t\tif($player === $this){\n\t\t\treturn;\n\t\t}\n\t\t$this->hiddenPlayers[$player->getRawUniqueId()] = $player;\n\t\t$player->despawnFrom($this);\n\t}\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function showPlayer(Player $player){\n\t\tif($player === $this){\n\t\t\treturn;\n\t\t}\n\t\tunset($this->hiddenPlayers[$player->getRawUniqueId()]);\n\t\tif($player->isOnline()){\n\t\t\t$player->spawnTo($this);\n\t\t}\n\t}\n\n\tpublic function canCollideWith(Entity $entity) : bool{\n\t\treturn false;\n\t}\n\n\tpublic function resetFallDistance(){\n\t\tparent::resetFallDistance();\n\t\tif($this->inAirTicks !== 0){\n\t\t\t$this->startAirTicks = 5;\n\t\t}\n\t\t$this->inAirTicks = 0;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isOnline() : bool{\n\t\treturn $this->connected === true and $this->loggedIn === true;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isOp() : bool{\n\t\treturn $this->server->isOp($this->getName());\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setOp($value){\n\t\tif($value === $this->isOp()){\n\t\t\treturn;\n\t\t}\n\n\t\tif($value === true){\n\t\t\t$this->server->addOp($this->getName());\n\t\t}else{\n\t\t\t$this->server->removeOp($this->getName());\n\t\t}\n\n\t\t$this->recalculatePermissions();\n\t\t$this->sendSettings();\n\t}\n\n\t/**\n\t * @param permission\\Permission|string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isPermissionSet($name){\n\t\treturn $this->perm->isPermissionSet($name);\n\t}\n\n\t/**\n\t * @param permission\\Permission|string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function hasPermission($name) : bool{\n\t\tif($this->perm == null) return false;else return $this->perm->hasPermission($name);\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t * @param string $name\n\t * @param bool   $value\n\t *\n\t * @return permission\\PermissionAttachment\n\t */\n\tpublic function addAttachment(Plugin $plugin, $name = null, $value = null){\n\t\tif($this->perm == null) return false;\n\t\treturn $this->perm->addAttachment($plugin, $name, $value);\n\t}\n\n\n\t/**\n\t * @param PermissionAttachment $attachment\n\t * @return bool\n\t */\n\tpublic function removeAttachment(PermissionAttachment $attachment){\n\t\tif($this->perm == null){\n\t\t\treturn false;\n\t\t}\n\t\t$this->perm->removeAttachment($attachment);\n\t\treturn true;\n\t}\n\n\tpublic function recalculatePermissions(){\n\t\t$this->server->getPluginManager()->unsubscribeFromPermission(Server::BROADCAST_CHANNEL_USERS, $this);\n\t\t$this->server->getPluginManager()->unsubscribeFromPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);\n\n\t\tif($this->perm === null){\n\t\t\treturn;\n\t\t}\n\n\t\t$this->perm->recalculatePermissions();\n\n\t\tif($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){\n\t\t\t$this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);\n\t\t}\n\t\tif($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){\n\t\t\t$this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);\n\t\t}\n\n\t\t$this->sendCommandData();\n\t}\n\n\t/**\n\t * @return permission\\PermissionAttachmentInfo[]\n\t */\n\tpublic function getEffectivePermissions(){\n\t\treturn $this->perm->getEffectivePermissions();\n\t}\n\n\tpublic function sendCommandData(){\n\t\t$data = new \\stdClass();\n\t\t$count = 0;\n\t\tforeach($this->server->getCommandMap()->getCommands() as $command){\n\t\t\tif(($cmdData = $command->generateCustomCommandData($this)) !== null){\n\t\t\t\t++$count;\n\t\t\t\t$data->{$command->getName()}->versions[0] = $cmdData;\n\t\t\t}\n\t\t}\n\n\t\tif($count > 0){\n\t\t\t//TODO: structure checking\n\t\t\t$pk = new AvailableCommandsPacket();\n\t\t\t$pk->commands = json_encode($data);\n\t\t\t$this->dataPacket($pk);\n\t\t}\n\t}\n\n\t/**\n\t * @param SourceInterface $interface\n\t * @param null            $clientID\n\t * @param string          $ip\n\t * @param int             $port\n\t */\n\tpublic function __construct(SourceInterface $interface, $clientID, $ip, $port){\n\t\t$this->interface = $interface;\n\t\t$this->windows = new \\SplObjectStorage();\n\t\t$this->perm = new PermissibleBase($this);\n\t\t$this->namedtag = new CompoundTag();\n\t\t$this->server = Server::getInstance();\n\t\t$this->lastBreak = PHP_INT_MAX;\n\t\t$this->ip = $ip;\n\t\t$this->port = $port;\n\t\t$this->clientID = $clientID;\n\t\t$this->loaderId = Level::generateChunkLoaderId($this);\n\t\t$this->chunksPerTick = (int) $this->server->getProperty(\"chunk-sending.per-tick\", 4);\n\t\t$this->spawnThreshold = (int) $this->server->getProperty(\"chunk-sending.spawn-threshold\", 56);\n\t\t$this->spawnPosition = null;\n\t\t$this->gamemode = $this->server->getGamemode();\n\t\t$this->setLevel($this->server->getDefaultLevel());\n\t\t$this->viewDistance = $this->server->getViewDistance();\n\t\t$this->newPosition = new Vector3(0, 0, 0);\n\t\t$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);\n\n\t\t$this->uuid = null;\n\t\t$this->rawUUID = null;\n\n\t\t$this->creationTime = microtime(true);\n\n\t\t$this->exp = 0;\n\t\t$this->expLevel = 0;\n\t\t$this->food = 20;\n\t\tEntity::setHealth(20);\n\t}\n\n\t/**\n\t * @param string $achievementId\n\t */\n\tpublic function removeAchievement($achievementId){\n\t\tif($this->hasAchievement($achievementId)){\n\t\t\t$this->achievements[$achievementId] = false;\n\t\t}\n\t}\n\n\t/**\n\t * @param string $achievementId\n\t *\n\t * @return bool\n\t */\n\tpublic function hasAchievement($achievementId) : bool{\n\t\tif(!isset(Achievement::$list[$achievementId]) or !isset($this->achievements)){\n\t\t\t$this->achievements = [];\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn isset($this->achievements[$achievementId]) and $this->achievements[$achievementId] != false;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isConnected() : bool{\n\t\treturn $this->connected === true;\n\t}\n\n\t/**\n\t * Gets the \"friendly\" name to display of this player to use in the chat.\n\t *\n\t * @return string\n\t */\n\tpublic function getDisplayName(){\n\t\treturn $this->displayName;\n\t}\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function setDisplayName($name){\n\t\t$this->displayName = $name;\n\t\tif($this->spawned){\n\t\t\t$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $this->getSkinId(), $this->getSkinData());\n\t\t}\n\t}\n\n\tpublic function setSkin($str, $skinId){\n\t\tparent::setSkin($str, $skinId);\n\t\tif($this->spawned){\n\t\t\t$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getDisplayName(), $skinId, $str);\n\t\t}\n\t}\n\n\t/**\n\t * Gets the player IP address\n\t *\n\t * @return string\n\t */\n\tpublic function getAddress() : string{\n\t\treturn $this->ip;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getPort() : int{\n\t\treturn $this->port;\n\t}\n\n\tpublic function getNextPosition(){\n\t\treturn $this->newPosition !== null ? new Position($this->newPosition->x, $this->newPosition->y, $this->newPosition->z, $this->level) : $this->getPosition();\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isSleeping() : bool{\n\t\treturn $this->sleeping !== null;\n\t}\n\n\tpublic function getInAirTicks(){\n\t\treturn $this->inAirTicks;\n\t}\n\n\tprotected function switchLevel(Level $targetLevel){\n\t\t$oldLevel = $this->level;\n\t\tif(parent::switchLevel($targetLevel)){\n\t\t\tforeach($this->usedChunks as $index => $d){\n\t\t\t\tLevel::getXZ($index, $X, $Z);\n\t\t\t\t$this->unloadChunk($X, $Z, $oldLevel);\n\t\t\t}\n\n\t\t\t$this->usedChunks = [];\n\t\t\t$pk = new SetTimePacket();\n\t\t\t$pk->time = $this->level->getTime();\n\t\t\t$pk->started = $this->level->stopTime == false;\n\t\t\t$this->dataPacket($pk);\n\n\t\t\tif($targetLevel->getDimension() != $oldLevel->getDimension()){\n\t\t\t\t$pk = new ChangeDimensionPacket();\n\t\t\t\t$pk->dimension = $targetLevel->getDimension();\n\t\t\t\t$pk->x = $this->x;\n\t\t\t\t$pk->y = $this->y;\n\t\t\t\t$pk->z = $this->z;\n\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t$this->shouldSendStatus = true;\n\t\t\t}\n\t\t\t$targetLevel->getWeather()->sendWeather($this);\n\n\t\t\tif($this->spawned){\n\t\t\t\t$this->spawnToAll();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function unloadChunk($x, $z, Level $level = null){\n\t\t$level = $level === null ? $this->level : $level;\n\t\t$index = Level::chunkHash($x, $z);\n\t\tif(isset($this->usedChunks[$index])){\n\t\t\t$chunk = $level->getChunk($x, $z);\n\t\t\tforeach($chunk->getEntities() as $entity){\n\t\t\t\tif($entity !== $this){\n\t\t\t\t\t$entity->despawnFrom($this);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif($level !== $this->level){\n\t\t\t\t$pk = new FullChunkDataPacket();\n\t\t\t\t$pk->chunkX = $x;\n\t\t\t\t$pk->chunkZ = $z;\n\t\t\t\t$pk->data = chr($chunk->getSubChunkSendCount());\n\t\t\t\t$this->dataPacket($pk);\n\t\t\t}\n\n\t\t\tunset($this->usedChunks[$index]);\n\t\t}\n\t\t$level->unregisterChunkLoader($this, $x, $z);\n\t\tunset($this->loadQueue[$index]);\n\t}\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getSpawn(){\n\t\tif($this->hasValidSpawnPosition()){\n\t\t\treturn $this->spawnPosition;\n\t\t}else{\n\t\t\t$level = $this->server->getDefaultLevel();\n\n\t\t\treturn $level->getSafeSpawn();\n\t\t}\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function hasValidSpawnPosition() : bool{\n\t\treturn $this->spawnPosition instanceof WeakPosition and $this->spawnPosition->isValid();\n\t}\n\n\tpublic function sendChunk($x, $z, $payload){\n\t\tif($this->connected === false){\n\t\t\treturn;\n\t\t}\n\n\t\t$this->usedChunks[Level::chunkHash($x, $z)] = true;\n\t\t$this->chunkLoadCount++;\n\n\t\tif($payload instanceof DataPacket){\n\t\t\t$this->dataPacket($payload);\n\t\t}else{\n\t\t\t$pk = new FullChunkDataPacket();\n\t\t\t$pk->chunkX = $x;\n\t\t\t$pk->chunkZ = $z;\n\t\t\t$pk->data = $payload;\n\t\t\t$this->batchDataPacket($pk);\n\t\t}\n\n\t\tif($this->spawned){\n\t\t\tforeach($this->level->getChunkEntities($x, $z) as $entity){\n\t\t\t\tif($entity !== $this and !$entity->closed and $entity->isAlive()){\n\t\t\t\t\t$entity->spawnTo($this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected function sendNextChunk(){\n\t\tif($this->connected === false){\n\t\t\treturn;\n\t\t}\n\n\t\tTimings::$playerChunkSendTimer->startTiming();\n\n\t\t$count = 0;\n\t\tforeach($this->loadQueue as $index => $distance){\n\t\t\tif($count >= $this->chunksPerTick){\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$X = null;\n\t\t\t$Z = null;\n\t\t\tLevel::getXZ($index, $X, $Z);\n\n\t\t\t++$count;\n\n\t\t\t$this->usedChunks[$index] = false;\n\t\t\t$this->level->registerChunkLoader($this, $X, $Z, true);\n\n\t\t\tif(!$this->level->populateChunk($X, $Z)){\n\t\t\t\tif($this->spawned and $this->teleportPosition === null){\n\t\t\t\t\tcontinue;\n\t\t\t\t}else{\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tunset($this->loadQueue[$index]);\n\t\t\t$this->level->requestChunk($X, $Z, $this);\n\t\t\tif((count($this->loadQueue) == 0) and $this->shouldSendStatus){\n\t\t\t\t$this->shouldSendStatus = false;\n\n\t\t\t\t$pk = new PlayStatusPacket();\n\t\t\t\t$pk->status = PlayStatusPacket::PLAYER_SPAWN;\n\t\t\t\t$this->dataPacket($pk);\n\n\t\t\t\t/*$pk = new RespawnPacket();\n\t\t\t\t$pk->x = $this->x;\n\t\t\t\t$pk->y = $this->y;\n\t\t\t\t$pk->z = $this->z;\n\t\t\t\t$this->dataPacket($pk);*/\n\t\t\t}\n\t\t}\n\n\t\tif($this->chunkLoadCount >= $this->spawnThreshold and $this->spawned === false and $this->teleportPosition === null){\n\t\t\t$this->doFirstSpawn();\n\t\t}\n\n\t\tTimings::$playerChunkSendTimer->stopTiming();\n\t}\n\n\tprotected function doFirstSpawn(){\n\t\t$this->spawned = true;\n\n\t\t$this->sendPotionEffects($this);\n\t\t$this->sendData($this);\n\n\t\t$pk = new SetTimePacket();\n\t\t$pk->time = $this->level->getTime();\n\t\t$pk->started = $this->level->stopTime == false;\n\t\t$this->dataPacket($pk);\n\n\t\t$pos = $this->level->getSafeSpawn($this);\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $pos));\n\n\t\t$pos = $ev->getRespawnPosition();\n\t\tif($pos->getY() < 127) $pos = $pos->add(0, 0.2, 0);\n\n\t\t/*$pk = new RespawnPacket();\n\t\t$pk->x = $pos->x;\n\t\t$pk->y = $pos->y;\n\t\t$pk->z = $pos->z;\n\t\t$this->dataPacket($pk);*/\n\n\t\t$pk = new PlayStatusPacket();\n\t\t$pk->status = PlayStatusPacket::PLAYER_SPAWN;\n\t\t$this->dataPacket($pk);\n\n\t\t$this->noDamageTicks = 60;\n\n\t\tforeach($this->usedChunks as $index => $c){\n\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\t\t\tforeach($this->level->getChunkEntities($chunkX, $chunkZ) as $entity){\n\t\t\t\tif($entity !== $this and !$entity->closed and $entity->isAlive()){\n\t\t\t\t\t$entity->spawnTo($this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->teleport($pos);\n\n\t\t$this->allowFlight = (($this->gamemode == 3) or ($this->gamemode == 1));\n\t\t$this->setHealth($this->getHealth());\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerJoinEvent($this, new TranslationContainer(TextFormat::YELLOW . \"%multiplayer.player.joined\", [\n\t\t\t$this->getDisplayName()\n\t\t])));\n\n\t\t$this->sendSettings();\n\n\t\tif(strlen(trim($msg = $ev->getJoinMessage())) > 0){\n\t\t\tif($this->server->playerMsgType === Server:: PLAYER_MSG_TYPE_MESSAGE) $this->server->broadcastMessage($msg);\n\t\t\telseif($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_TIP) $this->server->broadcastTip(str_replace(\"@player\", $this->getName(), $this->server->playerLoginMsg));\n\t\t\telseif($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_POPUP) $this->server->broadcastPopup(str_replace(\"@player\", $this->getName(), $this->server->playerLoginMsg));\n\t\t}\n\n\t\t$this->server->onPlayerLogin($this);\n\t\t$this->spawnToAll();\n\n\t\t$this->level->getWeather()->sendWeather($this);\n\n\t\tif($this->server->dserverConfig[\"enable\"] and $this->server->dserverConfig[\"queryAutoUpdate\"]){\n\t\t\t$this->server->updateQuery();\n\t\t}\n\n\t\t/*if($this->server->getUpdater()->hasUpdate() and $this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){\n\t\t\t$this->server->getUpdater()->showPlayerUpdate($this);\n\t\t}*/\n\n\t\tif($this->getHealth() <= 0){\n\t\t\t$pk = new RespawnPacket();\n\t\t\t$pos = $this->getSpawn();\n\t\t\t$pk->x = $pos->x;\n\t\t\t$pk->y = $pos->y;\n\t\t\t$pk->z = $pos->z;\n\t\t\t$this->dataPacket($pk);\n\t\t}\n\n\t\t$this->inventory->sendContents($this);\n\t\t$this->inventory->sendArmorContents($this);\n\t}\n\n\tprotected function orderChunks(){\n\t\tif($this->connected === false){\n\t\t\treturn false;\n\t\t}\n\n\t\tTimings::$playerChunkOrderTimer->startTiming();\n\n\t\t$this->nextChunkOrderRun = 200;\n\n\t\t$viewDistance = $this->server->getMemoryManager()->getViewDistance($this->viewDistance);\n\n\t\t$newOrder = [];\n\t\t$lastChunk = $this->usedChunks;\n\n\t\t$centerX = $this->x >> 4;\n\t\t$centerZ = $this->z >> 4;\n\n\t\t$layer = 1;\n\t\t$leg = 0;\n\t\t$x = 0;\n\t\t$z = 0;\n\n\t\tfor($i = 0; $i < $viewDistance; ++$i){\n\n\t\t\t$chunkX = $x + $centerX;\n\t\t\t$chunkZ = $z + $centerZ;\n\n\t\t\tif(!isset($this->usedChunks[$index = Level::chunkHash($chunkX, $chunkZ)]) or $this->usedChunks[$index] === false){\n\t\t\t\t$newOrder[$index] = true;\n\t\t\t}\n\t\t\tunset($lastChunk[$index]);\n\n\t\t\tswitch($leg){\n\t\t\t\tcase 0:\n\t\t\t\t\t++$x;\n\t\t\t\t\tif($x === $layer){\n\t\t\t\t\t\t++$leg;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\t++$z;\n\t\t\t\t\tif($z === $layer){\n\t\t\t\t\t\t++$leg;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\t--$x;\n\t\t\t\t\tif(-$x === $layer){\n\t\t\t\t\t\t++$leg;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\t--$z;\n\t\t\t\t\tif(-$z === $layer){\n\t\t\t\t\t\t$leg = 0;\n\t\t\t\t\t\t++$layer;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tforeach($lastChunk as $index => $bool){\n\t\t\tLevel::getXZ($index, $X, $Z);\n\t\t\t$this->unloadChunk($X, $Z);\n\t\t}\n\n\t\t$this->loadQueue = $newOrder;\n\n\n\t\tTimings::$playerChunkOrderTimer->stopTiming();\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Batch a Data packet into the channel list to send at the end of the tick\n\t *\n\t * @param DataPacket $packet\n\t *\n\t * @return bool\n\t */\n\tpublic function batchDataPacket(DataPacket $packet){\n\t\tif($this->connected === false){\n\t\t\treturn false;\n\t\t}\n\n\t\t$timings = Timings::getSendDataPacketTimings($packet);\n\t\t$timings->startTiming();\n\t\t$this->server->getPluginManager()->callEvent($ev = new DataPacketSendEvent($this, $packet));\n\t\tif($ev->isCancelled()){\n\t\t\t$timings->stopTiming();\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!isset($this->batchedPackets)){\n\t\t\t$this->batchedPackets = [];\n\t\t}\n\n\t\t$this->batchedPackets[] = clone $packet;\n\t\t$timings->stopTiming();\n\t\treturn true;\n\t}\n\n\t/**\n\t * Sends an ordered DataPacket to the send buffer\n\t *\n\t * @param DataPacket $packet\n\t * @param bool       $needACK\n\t *\n\t * @return int|bool\n\t */\n\tpublic function dataPacket(DataPacket $packet, $needACK = false){\n\t\tif(!$this->connected){\n\t\t\treturn false;\n\t\t}\n\n\t\t$timings = Timings::getSendDataPacketTimings($packet);\n\t\t$timings->startTiming();\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new DataPacketSendEvent($this, $packet));\n\t\tif($ev->isCancelled()){\n\t\t\t$timings->stopTiming();\n\t\t\treturn false;\n\t\t}\n\n\t\t$identifier = $this->interface->putPacket($this, $packet, $needACK, false);\n\n\t\tif($needACK and $identifier !== null){\n\t\t\t$this->needACK[$identifier] = false;\n\n\t\t\t$timings->stopTiming();\n\t\t\treturn $identifier;\n\t\t}\n\n\t\t$timings->stopTiming();\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param DataPacket $packet\n\t * @param bool       $needACK\n\t *\n\t * @return bool|int\n\t */\n\tpublic function directDataPacket(DataPacket $packet, $needACK = false){\n\t\tif($this->connected === false){\n\t\t\treturn false;\n\t\t}\n\n\t\t$timings = Timings::getSendDataPacketTimings($packet);\n\t\t$timings->startTiming();\n\t\t$this->server->getPluginManager()->callEvent($ev = new DataPacketSendEvent($this, $packet));\n\t\tif($ev->isCancelled()){\n\t\t\t$timings->stopTiming();\n\t\t\treturn false;\n\t\t}\n\n\t\t$identifier = $this->interface->putPacket($this, $packet, $needACK, true);\n\n\t\tif($needACK and $identifier !== null){\n\t\t\t$this->needACK[$identifier] = false;\n\n\t\t\t$timings->stopTiming();\n\t\t\treturn $identifier;\n\t\t}\n\n\t\t$timings->stopTiming();\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param Vector3 $pos\n\t *\n\t * @return boolean\n\t */\n\tpublic function sleepOn(Vector3 $pos){\n\t\tif(!$this->isOnline()){\n\t\t\treturn false;\n\t\t}\n\n\t\tforeach($this->level->getNearbyEntities($this->boundingBox->grow(2, 1, 2), $this) as $p){\n\t\t\tif($p instanceof Player){\n\t\t\t\tif($p->sleeping !== null and $pos->distance($p->sleeping) <= 0.1){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerBedEnterEvent($this, $this->level->getBlock($pos)));\n\t\tif($ev->isCancelled()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->sleeping = clone $pos;\n\n\t\t$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [$pos->x, $pos->y, $pos->z]);\n\t\t$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, true, self::DATA_TYPE_BYTE);\n\n\t\t$this->setSpawn($pos);\n\n\t\t$this->level->sleepTicks = 60;\n\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Sets the spawnpoint of the player (and the compass direction) to a Vector3, or set it on another world with a\n\t * Position object\n\t *\n\t * @param Vector3|Position $pos\n\t */\n\tpublic function setSpawn(Vector3 $pos){\n\t\tif(!($pos instanceof Position)){\n\t\t\t$level = $this->level;\n\t\t}else{\n\t\t\t$level = $pos->getLevel();\n\t\t}\n\t\t$this->spawnPosition = new WeakPosition($pos->x, $pos->y, $pos->z, $level);\n\t\t$pk = new SetSpawnPositionPacket();\n\t\t$pk->x = (int) $this->spawnPosition->x;\n\t\t$pk->y = (int) $this->spawnPosition->y;\n\t\t$pk->z = (int) $this->spawnPosition->z;\n\t\t$this->dataPacket($pk);\n\t}\n\n\tpublic function stopSleep(){\n\t\tif($this->sleeping instanceof Vector3){\n\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerBedLeaveEvent($this, $this->level->getBlock($this->sleeping)));\n\n\t\t\t$this->sleeping = null;\n\t\t\t$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);\n\t\t\t$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);\n\n\n\t\t\t$this->level->sleepTicks = 0;\n\n\t\t\t$pk = new AnimatePacket();\n\t\t\t$pk->eid = 0;\n\t\t\t$pk->action = PlayerAnimationEvent::WAKE_UP;\n\t\t\t$this->dataPacket($pk);\n\t\t}\n\n\t}\n\n\t/**\n\t * @param string $achievementId\n\t *\n\t * @return bool\n\t */\n\tpublic function awardAchievement($achievementId){\n\t\tif(isset(Achievement::$list[$achievementId]) and !$this->hasAchievement($achievementId)){\n\t\t\tforeach(Achievement::$list[$achievementId][\"requires\"] as $requirementId){\n\t\t\t\tif(!$this->hasAchievement($requirementId)){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerAchievementAwardedEvent($this, $achievementId));\n\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t$this->achievements[$achievementId] = true;\n\t\t\t\tAchievement::broadcast($this, $achievementId);\n\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getGamemode() : int{\n\t\treturn $this->gamemode;\n\t}\n\n\t/**\n\t * Sets the gamemode, and if needed, kicks the Player.\n\t *\n\t * @param int  $gm\n\t * @param bool $client if the client made this change in their GUI\n\t *\n\t * @return bool\n\t */\n\tpublic function setGamemode(int $gm, bool $client = false){\n\t\tif($gm < 0 or $gm > 3 or $this->gamemode === $gm){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerGameModeChangeEvent($this, $gm));\n\t\tif($ev->isCancelled()){\n\t\t\tif($client){ //gamemode change by client in the GUI\n\t\t\t\t$pk = new SetPlayerGameTypePacket();\n\t\t\t\t$pk->gamemode = $this->gamemode & 0x01;\n\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t$this->sendSettings();\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\tif($this->server->autoClearInv){\n\t\t\t$this->inventory->clearAll();\n\t\t}\n\n\t\t$this->gamemode = $gm;\n\n\t\t$this->allowFlight = $this->isCreative();\n\t\tif($this->isSpectator()){\n\t\t\t$this->flying = true;\n\t\t\t$this->despawnFromAll();\n\n\t\t\t// Client automatically turns off flight controls when on the ground.\n\t\t\t// A combination of this hack and a new AdventureSettings flag FINALLY\n\t\t\t// fixes spectator flight controls. Thank @robske110 for this hack.\n\t\t\t$this->teleport($this->temporalVector->setComponents($this->x, $this->y + 0.1, $this->z));\n\t\t}else{\n\t\t\tif($this->isSurvival()){\n\t\t\t\t$this->flying = false;\n\t\t\t}\n\t\t\t$this->spawnToAll();\n\t\t}\n\n\t\t$this->resetFallDistance();\n\n\t\t$this->namedtag->playerGameType = new IntTag(\"playerGameType\", $this->gamemode);\n\n\t\tif(!$client){ //Gamemode changed by server, do not send for client changes\n\t\t\t$pk = new SetPlayerGameTypePacket();\n\t\t\t$pk->gamemode = $this->gamemode & 0x01;\n\t\t\t$this->dataPacket($pk);\n\t\t}else{\n\t\t\tCommand::broadcastCommandMessage($this, new TranslationContainer(\"commands.gamemode.success.self\", [Server::getGamemodeString($gm)]));\n\t\t}\n\n\t\tif($this->gamemode === Player::SPECTATOR){\n\t\t\t$pk = new ContainerSetContentPacket();\n\t\t\t$pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;\n\t\t\t$this->dataPacket($pk);\n\t\t}else{\n\t\t\t$pk = new ContainerSetContentPacket();\n\t\t\t$pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;\n\t\t\t$pk->slots = array_merge(Item::getCreativeItems(), $this->personalCreativeItems);\n\t\t\t$this->dataPacket($pk);\n\t\t}\n\n\t\t$this->sendSettings();\n\n\t\t$this->inventory->sendContents($this);\n\t\t$this->inventory->sendContents($this->getViewers());\n\t\t$this->inventory->sendHeldItem($this->hasSpawned);\n\t\treturn true;\n\t}\n\n\t/**\n\t * Sends all the option flags\n\t */\n\tpublic function sendSettings(){\n\t\t$pk = new AdventureSettingsPacket();\n\t\t$pk->flags = 0;\n\t\t$pk->worldImmutable = $this->isAdventure();\n\t\t$pk->autoJump = $this->autoJump;\n\t\t$pk->allowFlight = $this->allowFlight;\n\t\t$pk->noClip = $this->isSpectator();\n\t\t$pk->isFlying = $this->flying;\n\t\t$pk->userPermission = ($this->isOp() ? AdventureSettingsPacket::PERMISSION_OPERATOR : AdventureSettingsPacket::PERMISSION_NORMAL);\n\t\t$this->dataPacket($pk);\n\t}\n\n\tpublic function isSurvival() : bool{\n\t\treturn ($this->gamemode & 0x01) === 0;\n\t}\n\n\tpublic function isCreative() : bool{\n\t\treturn ($this->gamemode & 0x01) > 0;\n\t}\n\n\tpublic function isSpectator() : bool{\n\t\treturn $this->gamemode === 3;\n\t}\n\n\tpublic function isAdventure() : bool{\n\t\treturn ($this->gamemode & 0x02) > 0;\n\t}\n\n\tpublic function isFireProof() : bool{\n\t\treturn $this->isCreative();\n\t}\n\n\tpublic function getDrops(){\n\t\tif(!$this->isCreative()){\n\t\t\treturn parent::getDrops();\n\t\t}\n\n\t\treturn [];\n\t}\n\n\tpublic function setDataProperty($id, $type, $value){\n\t\tif(parent::setDataProperty($id, $type, $value)){\n\t\t\t$this->sendData($this, [$id => $this->dataProperties[$id]]);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tprotected function checkGroundState($movX, $movY, $movZ, $dx, $dy, $dz){\n\t\tif(!$this->onGround or $movY != 0){\n\t\t\t$bb = clone $this->boundingBox;\n\t\t\t$bb->maxY = $bb->minY + 0.5;\n\t\t\t$bb->minY -= 1;\n\t\t\tif(count($this->level->getCollisionBlocks($bb, true)) > 0){\n\t\t\t\t$this->onGround = true;\n\t\t\t}else{\n\t\t\t\t$this->onGround = false;\n\t\t\t}\n\t\t}\n\t\t$this->isCollided = $this->onGround;\n\t}\n\n\tprotected function checkBlockCollision(){\n\t\tforeach($blocksaround = $this->getBlocksAround() as $block){\n\t\t\t$block->onEntityCollide($this);\n\t\t\tif($this->getServer()->redstoneEnabled){\n\t\t\t\tif($block instanceof PressurePlate){\n\t\t\t\t\t$this->activatedPressurePlates[Level::blockHash($block->x, $block->y, $block->z)] = $block;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($this->getServer()->redstoneEnabled){\n\t\t\t/** @var \\pocketmine\\block\\PressurePlate $block * */\n\t\t\tforeach($this->activatedPressurePlates as $key => $block){\n\t\t\t\tif(!isset($blocksaround[$key])) $block->checkActivation();\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected function checkNearEntities($tickDiff){\n\t\tforeach($this->level->getNearbyEntities($this->boundingBox->grow(0.5, 0.5, 0.5), $this) as $entity){\n\t\t\t$entity->scheduleUpdate();\n\n\t\t\tif(!$entity->isAlive()){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif($entity instanceof Arrow and $entity->hadCollision){\n\t\t\t\t$item = Item::get(Item::ARROW, $entity->getPotionId(), 1);\n\n\t\t\t\t$add = false;\n\t\t\t\tif(!$this->server->allowInventoryCheats and !$this->isCreative()){\n\t\t\t\t\tif(!$this->getFloatingInventory()->canAddItem($item) or !$this->inventory->canAddItem($item)){\n\t\t\t\t\t\t//The item is added to the floating inventory to allow client to handle the pickup\n\t\t\t\t\t\t//We have to also check if it can be added to the real inventory before sending packets.\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$add = true;\n\t\t\t\t}\n\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new InventoryPickupArrowEvent($this->inventory, $entity));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$pk = new TakeItemEntityPacket();\n\t\t\t\t$pk->eid = $this->getId();\n\t\t\t\t$pk->target = $entity->getId();\n\t\t\t\t$this->server->broadcastPacket($entity->getViewers(), $pk);\n\n\t\t\t\t$pk = new TakeItemEntityPacket();\n\t\t\t\t$pk->eid = 0;\n\t\t\t\t$pk->target = $entity->getId();\n\t\t\t\t$this->dataPacket($pk);\n\n\t\t\t\tif($add){\n\t\t\t\t\t$this->getFloatingInventory()->addItem(clone $item);\n\t\t\t\t}\n\t\t\t\t$entity->kill();\n\t\t\t}elseif($entity instanceof DroppedItem){\n\t\t\t\tif($entity->getPickupDelay() <= 0){\n\t\t\t\t\t$item = $entity->getItem();\n\n\t\t\t\t\tif($item instanceof Item){\n\t\t\t\t\t\t$add = false;\n\t\t\t\t\t\tif(!$this->server->allowInventoryCheats and !$this->isCreative()){\n\t\t\t\t\t\t\tif(!$this->getFloatingInventory()->canAddItem($item) or !$this->inventory->canAddItem($item)){\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$add = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new InventoryPickupItemEvent($this->inventory, $entity));\n\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tswitch($item->getId()){\n\t\t\t\t\t\t\tcase Item::WOOD:\n\t\t\t\t\t\t\t\t$this->awardAchievement(\"mineWood\");\n\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase Item::DIAMOND:\n\t\t\t\t\t\t\t\t$this->awardAchievement(\"diamond\");\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$pk = new TakeItemEntityPacket();\n\t\t\t\t\t\t$pk->eid = $this->getId();\n\t\t\t\t\t\t$pk->target = $entity->getId();\n\t\t\t\t\t\t$this->server->broadcastPacket($entity->getViewers(), $pk);\n\n\t\t\t\t\t\t$pk = new TakeItemEntityPacket();\n\t\t\t\t\t\t$pk->eid = 0;\n\t\t\t\t\t\t$pk->target = $entity->getId();\n\t\t\t\t\t\t$this->dataPacket($pk);\n\n\t\t\t\t\t\tif($add){\n\t\t\t\t\t\t\t$this->getFloatingInventory()->addItem(clone $item);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$entity->kill();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected function processMovement($tickDiff){\n\t\tif(!$this->isAlive() or !$this->spawned or $this->newPosition === null or $this->teleportPosition !== null or $this->isSleeping()){\n\t\t\t$this->setMoving(false);\n\t\t\treturn;\n\t\t}\n\n\t\t$newPos = $this->newPosition;\n\t\t$distanceSquared = $newPos->distanceSquared($this);\n\n\t\t$revert = false;\n\n\t\tif($this->server->checkMovement){\n\t\t\tif(($distanceSquared / ($tickDiff ** 2)) > 200){\n\t\t\t\t$revert = true;\n\t\t\t}else{\n\t\t\t\tif($this->chunk === null or !$this->chunk->isGenerated()){\n\t\t\t\t\t$chunk = $this->level->getChunk($newPos->x >> 4, $newPos->z >> 4, false);\n\t\t\t\t\tif($chunk === null or !$chunk->isGenerated()){\n\t\t\t\t\t\t$revert = true;\n\t\t\t\t\t\t$this->nextChunkOrderRun = 0;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tif($this->chunk !== null){\n\t\t\t\t\t\t\t$this->chunk->removeEntity($this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->chunk = $chunk;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tif($this->chunk === null or !$this->chunk->isGenerated()){\n\t\t\t\t$chunk = $this->level->getChunk($newPos->x >> 4, $newPos->z >> 4, false);\n\t\t\t\tif($chunk === null or !$chunk->isGenerated()){\n\t\t\t\t\t$revert = true;\n\t\t\t\t\t$this->nextChunkOrderRun = 0;\n\t\t\t\t}else{\n\t\t\t\t\tif($this->chunk !== null){\n\t\t\t\t\t\t$this->chunk->removeEntity($this);\n\t\t\t\t\t}\n\t\t\t\t\t$this->chunk = $chunk;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\n\n\t\tif(!$revert and $distanceSquared != 0){\n\t\t\t$dx = $newPos->x - $this->x;\n\t\t\t$dy = $newPos->y - $this->y;\n\t\t\t$dz = $newPos->z - $this->z;\n\n\t\t\t$this->move($dx, $dy, $dz);\n\n\t\t\t$diffX = $this->x - $newPos->x;\n\t\t\t$diffY = $this->y - $newPos->y;\n\t\t\t$diffZ = $this->z - $newPos->z;\n\t\t\t\n\t\t\t$yS = 0.5 + $this->ySize;\n\t\t\tif($diffY >= -$yS or $diffY <= $yS){\n\t\t\t\t$diffY = 0;\n\t\t\t}\n\n\t\t\t$diff = ($diffX ** 2 + $diffY ** 2 + $diffZ ** 2) / ($tickDiff ** 2);\n\n\t\t\tif($diff > 0){\n\t\t\t\t$this->x = $newPos->x;\n\t\t\t\t$this->y = $newPos->y;\n\t\t\t\t$this->z = $newPos->z;\n\t\t\t\t$radius = $this->width / 2;\n\t\t\t\t$this->boundingBox->setBounds($this->x - $radius, $this->y, $this->z - $radius, $this->x + $radius, $this->y + $this->height, $this->z + $radius);\n\t\t\t}\n\t\t}\n\n\t\t$from = new Location($this->lastX, $this->lastY, $this->lastZ, $this->lastYaw, $this->lastPitch, $this->level);\n\t\t$to = $this->getLocation();\n\n\t\t$delta = pow($this->lastX - $to->x, 2) + pow($this->lastY - $to->y, 2) + pow($this->lastZ - $to->z, 2);\n\t\t$deltaAngle = abs($this->lastYaw - $to->yaw) + abs($this->lastPitch - $to->pitch);\n\n\t\tif(!$revert and ($delta > (1 / 16) or $deltaAngle > 10)){\n\n\t\t\t$isFirst = ($this->lastX === null or $this->lastY === null or $this->lastZ === null);\n\n\t\t\t$this->lastX = $to->x;\n\t\t\t$this->lastY = $to->y;\n\t\t\t$this->lastZ = $to->z;\n\n\t\t\t$this->lastYaw = $to->yaw;\n\t\t\t$this->lastPitch = $to->pitch;\n\n\t\t\tif(!$isFirst){\n\t\t\t\t$ev = new PlayerMoveEvent($this, $from, $to);\n\t\t\t\t$this->setMoving(true);\n\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\n\t\t\t\tif(!($revert = $ev->isCancelled())){ //Yes, this is intended\n\t\t\t\t\tif($this->server->netherEnabled){\n\t\t\t\t\t\tif($this->isInsideOfPortal()){\n\t\t\t\t\t\t\tif($this->portalTime == 0){\n\t\t\t\t\t\t\t\t$this->portalTime = $this->server->getTick();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->portalTime = 0;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif($to->distanceSquared($ev->getTo()) > 0.01){ //If plugins modify the destination\n\t\t\t\t\t\t$this->teleport($ev->getTo());\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->addMovement($this->x, $this->y + $this->getEyeHeight(), $this->z, $this->yaw, $this->pitch, $this->yaw);\n\t\t\t\t\t}\n\n\t\t\t\t\tif($this->fishingHook instanceof FishingHook){\n\t\t\t\t\t\tif($this->distance($this->fishingHook) > 33 or $this->inventory->getItemInHand()->getId() !== Item::FISHING_ROD){\n\t\t\t\t\t\t\t$this->setFishingHook();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!$this->isSpectator()){\n\t\t\t\t$this->checkNearEntities($tickDiff);\n\t\t\t}\n\n\t\t\t$this->speed = ($to->subtract($from))->divide($tickDiff);\n\t\t}elseif($distanceSquared == 0){\n\t\t\t$this->speed = new Vector3(0, 0, 0);\n\t\t\t$this->setMoving(false);\n\t\t}\n\n\t\tif($revert){\n\n\t\t\t$this->lastX = $from->x;\n\t\t\t$this->lastY = $from->y;\n\t\t\t$this->lastZ = $from->z;\n\n\t\t\t$this->lastYaw = $from->yaw;\n\t\t\t$this->lastPitch = $from->pitch;\n\n\t\t\t$this->sendPosition($from, $from->yaw, $from->pitch, MovePlayerPacket::MODE_RESET);\n\t\t\t$this->forceMovement = new Vector3($from->x, $from->y, $from->z);\n\t\t}else{\n\t\t\t$this->forceMovement = null;\n\t\t\tif($distanceSquared != 0 and $this->nextChunkOrderRun > 20){\n\t\t\t\t$this->nextChunkOrderRun = 20;\n\t\t\t}\n\t\t}\n\n\t\t$this->newPosition = null;\n\t}\n\t\n\tpublic function addMovement($x, $y, $z, $yaw, $pitch, $headYaw = null){\n\t\tif($this->chunk !== null){\n\t\t\t$this->level->addPlayerMovement($this->chunk->getX(), $this->chunk->getZ(), $this->id, $x, $y, $z, $yaw, $pitch, $this->onGround, $headYaw === null ? $yaw : $headYaw);\n\t\t}\n\t}\n\n\tpublic function setMotion(Vector3 $mot){\n\t\tif(parent::setMotion($mot)){\n\t\t\tif($this->chunk !== null){\n\t\t\t\t$this->level->addEntityMotion($this->chunk->getX(), $this->chunk->getZ(), $this->getId(), $this->motionX, $this->motionY, $this->motionZ);\n\t\t\t\t$pk = new SetEntityMotionPacket();\n\t\t\t\t$pk->eid = 0;\n\t\t\t\t$pk->motionX = $mot->x;\n\t\t\t\t$pk->motionY = $mot->y;\n\t\t\t\t$pk->motionZ = $mot->z;\n\t\t\t\t$this->dataPacket($pk);\n\t\t\t}\n\n\t\t\tif($this->motionY > 0){\n\t\t\t\t$this->startAirTicks = (-(log($this->gravity / ($this->gravity + $this->drag * $this->motionY))) / $this->drag) * 2 + 5;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\n\tprotected function updateMovement(){\n\n\t}\n\n\tpublic $foodTick = 0;\n\n\tpublic $starvationTick = 0;\n\n\tpublic $foodUsageTime = 0;\n\n\tprotected $moving = false;\n\n\tpublic function setMoving($moving){\n\t\t$this->moving = $moving;\n\t}\n\n\tpublic function isMoving() : bool{\n\t\treturn $this->moving;\n\t}\n\n\tpublic function sendAttributes(bool $sendAll = false){\n\t\t$entries = $sendAll ? $this->attributeMap->getAll() : $this->attributeMap->needSend();\n\t\tif(count($entries) > 0){\n\t\t\t$pk = new UpdateAttributesPacket();\n\t\t\t$pk->entityId = 0;\n\t\t\t$pk->entries = $entries;\n\t\t\t$this->dataPacket($pk);\n\t\t\tforeach($entries as $entry){\n\t\t\t\t$entry->markSynchronized();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif(!$this->loggedIn){\n\t\t\treturn false;\n\t\t}\n\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\n\n\t\tif($tickDiff <= 0){\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->messageCounter = 2;\n\n\t\t$this->lastUpdate = $currentTick;\n\n\t\t$this->sendAttributes();\n\n\t\tif(!$this->isAlive() and $this->spawned){\n\t\t\t++$this->deadTicks;\n\t\t\tif($this->deadTicks >= 10){\n\t\t\t\t$this->despawnFromAll();\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\tif($this->spawned){\n\t\t\tif($this->server->netherEnabled){\n\t\t\t\tif(($this->isCreative() or $this->isSurvival() and $this->server->getTick() - $this->portalTime >= 80) and $this->portalTime > 0){\n\t\t\t\t\t$netherLevel = null;\n\t\t\t\t\tif($this->server->isLevelLoaded($this->server->netherName) or $this->server->loadLevel($this->server->netherName)){\n\t\t\t\t\t\t$netherLevel = $this->server->getLevelByName($this->server->netherName);\n\t\t\t\t\t}\n\n\t\t\t\t\tif($netherLevel instanceof Level){\n\t\t\t\t\t\tif($this->getLevel() !== $netherLevel){\n\t\t\t\t\t\t\t$this->fromPos = $this->getPosition();\n\t\t\t\t\t\t\t$this->fromPos->x = ((int) $this->fromPos->x) + 0.5;\n\t\t\t\t\t\t\t$this->fromPos->z = ((int) $this->fromPos->z) + 0.5;\n\t\t\t\t\t\t\t$this->teleport($this->shouldResPos = $netherLevel->getSafeSpawn());\n\t\t\t\t\t\t}elseif($this->fromPos instanceof Position){\n\t\t\t\t\t\t\tif(!($this->getLevel()->isChunkLoaded($this->fromPos->x, $this->fromPos->z))){\n\t\t\t\t\t\t\t\t$this->getLevel()->loadChunk($this->fromPos->x, $this->fromPos->z);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$add = [1, 0, -1, 0, 0, 1, 0, -1];\n\t\t\t\t\t\t\t$tempos = null;\n\t\t\t\t\t\t\tfor($j = 2; $j < 5; $j++){\n\t\t\t\t\t\t\t\tfor($i = 0; $i < 4; $i++){\n\t\t\t\t\t\t\t\t\tif($this->fromPos->getLevel()->getBlock($this->temporalVector->fromObjectAdd($this->fromPos, $add[$i] * $j, 0, $add[$i + 4] * $j))->getId() === Block::AIR){\n\t\t\t\t\t\t\t\t\t\tif($this->fromPos->getLevel()->getBlock($this->temporalVector->fromObjectAdd($this->fromPos, $add[$i] * $j, 1, $add[$i + 4] * $j))->getId() === Block::AIR){\n\t\t\t\t\t\t\t\t\t\t\t$tempos = $this->fromPos->add($add[$i] * $j, 0, $add[$i + 4] * $j);\n\t\t\t\t\t\t\t\t\t\t\t//$this->getLevel()->getServer()->getLogger()->debug($tempos);\n\t\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif($tempos != null){\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif($tempos === null){\n\t\t\t\t\t\t\t\t$tempos = $this->fromPos->add(mt_rand(-2, 2), 0, mt_rand(-2, 2));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$this->teleport($this->shouldResPos = $tempos);\n\t\t\t\t\t\t\t$add = null;\n\t\t\t\t\t\t\t$tempos = null;\n\t\t\t\t\t\t\t$this->fromPos = null;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->teleport($this->shouldResPos = $this->server->getDefaultLevel()->getSafeSpawn());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->portalTime = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->processMovement($tickDiff);\n\t\t\t$this->entityBaseTick($tickDiff);\n\n\t\t\tif($this->isOnFire() or $this->lastUpdate % 10 == 0){\n\t\t\t\tif($this->isCreative() and !$this->isInsideOfFire()){\n\t\t\t\t\t$this->extinguish();\n\t\t\t\t}elseif($this->getLevel()->getWeather()->isRainy()){\n\t\t\t\t\tif($this->getLevel()->canBlockSeeSky($this)){\n\t\t\t\t\t\t$this->extinguish();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($this->server->antiFly){\n\t\t\t\tif(!$this->isSpectator() and $this->speed !== null){\n\t\t\t\t\tif($this->onGround){\n\t\t\t\t\t\tif($this->inAirTicks !== 0){\n\t\t\t\t\t\t\t$this->startAirTicks = 5;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->inAirTicks = 0;\n\t\t\t\t\t}else{\n\t\t\t\t\t\tif(!$this->usingElytra() and !$this->allowFlight and $this->inAirTicks > 10 and !$this->isSleeping() and !$this->isImmobile()){\n\t\t\t\t\t\t\t//expectedVelocity here is not calculated correctly\n\t\t\t\t\t\t\t//This causes players to fall too fast when bouncing on slime when antiFly is enabled\n\t\t\t\t\t\t\t$expectedVelocity = (-$this->gravity) / $this->drag - ((-$this->gravity) / $this->drag) * exp(-$this->drag * ($this->inAirTicks - $this->startAirTicks));\n\t\t\t\t\t\t\t$diff = ($this->speed->y - $expectedVelocity) ** 2;\n\t\t\t\t\t\t\tif(!$this->hasEffect(Effect::JUMP) and $diff > 0.6 and $expectedVelocity < $this->speed->y and !$this->server->getAllowFlight()){\n\t\t\t\t\t\t\t\t$this->setMotion($this->temporalVector->setComponents(0, $expectedVelocity, 0));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t++$this->inAirTicks;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($this->getTransactionQueue() !== null){\n\t\t\t\t$this->getTransactionQueue()->execute();\n\t\t\t}\n\t\t}\n\n\t\t$this->checkTeleportPosition();\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn true;\n\t}\n\n\tpublic function checkNetwork(){\n\t\tif(!$this->isOnline()){\n\t\t\treturn;\n\t\t}\n\n\t\tif($this->nextChunkOrderRun-- <= 0 or $this->chunk === null){\n\t\t\t$this->orderChunks();\n\t\t}\n\n\t\tif(count($this->loadQueue) > 0 or !$this->spawned){\n\t\t\t$this->sendNextChunk();\n\t\t}\n\n\t\tif(count($this->batchedPackets) > 0){\n\t\t\t$this->server->batchPackets([$this], $this->batchedPackets, false);\n\t\t\t$this->batchedPackets = [];\n\t\t}\n\n\t}\n\n\tpublic function canInteract(Vector3 $pos, $maxDistance, $maxDiff = 0.5){\n\t\t$eyePos = $this->getPosition()->add(0, $this->getEyeHeight(), 0);\n\t\tif($eyePos->distanceSquared($pos) > $maxDistance ** 2){\n\t\t\treturn false;\n\t\t}\n\n\t\t$dV = $this->getDirectionPlane();\n\t\t$dot = $dV->dot(new Vector2($eyePos->x, $eyePos->z));\n\t\t$dot1 = $dV->dot(new Vector2($pos->x, $pos->z));\n\t\treturn ($dot1 - $dot) >= -$maxDiff;\n\t}\n\n\tpublic function onPlayerPreLogin(){\n\t\t$pk = new PlayStatusPacket();\n\t\t$pk->status = PlayStatusPacket::LOGIN_SUCCESS;\n\t\t$this->dataPacket($pk);\n\n\t\t$this->processLogin();\n\t}\n\n\tpublic function clearCreativeItems(){\n\t\t$this->personalCreativeItems = [];\n\t}\n\n\tpublic function getCreativeItems() : array{\n\t\treturn $this->personalCreativeItems;\n\t}\n\n\tpublic function addCreativeItem(Item $item){\n\t\t$this->personalCreativeItems[] = Item::get($item->getId(), $item->getDamage());\n\t}\n\n\tpublic function removeCreativeItem(Item $item){\n\t\t$index = $this->getCreativeItemIndex($item);\n\t\tif($index !== -1){\n\t\t\tunset($this->personalCreativeItems[$index]);\n\t\t}\n\t}\n\n\tpublic function getCreativeItemIndex(Item $item) : int{\n\t\tforeach($this->personalCreativeItems as $i => $d){\n\t\t\tif($item->equals($d, !$item->isTool())){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\tprotected function processLogin(){\n\t\tif(!$this->server->isWhitelisted(strtolower($this->getName()))){\n\t\t\t$this->close($this->getLeaveMessage(), \"Server is white-listed\");\n\n\t\t\treturn;\n\t\t}elseif($this->server->getNameBans()->isBanned(strtolower($this->getName())) or $this->server->getIPBans()->isBanned($this->getAddress()) or $this->server->getCIDBans()->isBanned($this->randomClientId)){\n\t\t\t$this->close($this->getLeaveMessage(), TextFormat::RED . \"You are banned\");\n\n\t\t\treturn;\n\t\t}\n\n\t\tif($this->hasPermission(Server::BROADCAST_CHANNEL_USERS)){\n\t\t\t$this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_USERS, $this);\n\t\t}\n\t\tif($this->hasPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE)){\n\t\t\t$this->server->getPluginManager()->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this);\n\t\t}\n\n\t\tforeach($this->server->getOnlinePlayers() as $p){\n\t\t\tif($p !== $this and strtolower($p->getName()) === strtolower($this->getName())){\n\t\t\t\tif($p->kick(\"logged in from another location\") === false){\n\t\t\t\t\t$this->close($this->getLeaveMessage(), \"Logged in from another location\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}elseif($p->loggedIn and $this->getUniqueId()->equals($p->getUniqueId())){\n\t\t\t\tif($p->kick(\"logged in from another location\") === false){\n\t\t\t\t\t$this->close($this->getLeaveMessage(), \"Logged in from another location\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->setNameTag($this->getDisplayName());\n\n\t\t$nbt = $this->server->getOfflinePlayerData($this->username);\n\t\t$this->playedBefore = ($nbt[\"lastPlayed\"] - $nbt[\"firstPlayed\"]) > 1;\n\t\tif(!isset($nbt->NameTag)){\n\t\t\t$nbt->NameTag = new StringTag(\"NameTag\", $this->username);\n\t\t}else{\n\t\t\t$nbt[\"NameTag\"] = $this->username;\n\t\t}\n\t\tif(!isset($nbt->Hunger) or !isset($nbt->Health) or !isset($nbt->MaxHealth)){\n\t\t\t$nbt->Hunger = new ShortTag(\"Hunger\", 20);\n\t\t\t$nbt->Health = new ShortTag(\"Health\", 20);\n\t\t\t$nbt->MaxHealth = new ShortTag(\"MaxHealth\", 20);\n\t\t}\n\t\t$this->food = $nbt[\"Hunger\"];\n\t\t$this->setMaxHealth($nbt[\"MaxHealth\"]);\n\t\tEntity::setHealth(($nbt[\"Health\"] <= 0) ? 20 : $nbt[\"Health\"]);\n\n\t\t$this->gamemode = $nbt[\"playerGameType\"] & 0x03;\n\t\tif($this->server->getForceGamemode()){\n\t\t\t$this->gamemode = $this->server->getGamemode();\n\t\t\t$nbt->playerGameType = new IntTag(\"playerGameType\", $this->gamemode);\n\t\t}\n\n\t\t$this->allowFlight = $this->isCreative();\n\n\t\tif(($level = $this->server->getLevelByName($nbt[\"Level\"])) === null){\n\t\t\t$this->setLevel($this->server->getDefaultLevel());\n\t\t\t$nbt[\"Level\"] = $this->level->getName();\n\t\t\t$nbt[\"Pos\"][0] = $this->level->getSpawnLocation()->x;\n\t\t\t$nbt[\"Pos\"][1] = $this->level->getSpawnLocation()->y;\n\t\t\t$nbt[\"Pos\"][2] = $this->level->getSpawnLocation()->z;\n\t\t}else{\n\t\t\t$this->setLevel($level);\n\t\t}\n\n\t\tif(!($nbt instanceof CompoundTag)){\n\t\t\t$this->close($this->getLeaveMessage(), \"Invalid data\");\n\n\t\t\treturn;\n\t\t}\n\n\t\t$this->achievements = [];\n\n\t\t/** @var ByteTag $achievement */\n\t\tforeach($nbt->Achievements as $achievement){\n\t\t\t$this->achievements[$achievement->getName()] = $achievement->getValue() > 0 ? true : false;\n\t\t}\n\n\t\t$nbt->lastPlayed = new LongTag(\"lastPlayed\", floor(microtime(true) * 1000));\n\t\tif($this->server->getAutoSave()){\n\t\t\t$this->server->saveOfflinePlayerData($this->username, $nbt, true);\n\t\t}\n\n\t\tparent::__construct($this->level->getChunk($nbt[\"Pos\"][0] >> 4, $nbt[\"Pos\"][2] >> 4, true), $nbt);\n\t\t$this->loggedIn = true;\n\t\t$this->server->addOnlinePlayer($this);\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerLoginEvent($this, \"Plugin reason\"));\n\t\tif($ev->isCancelled()){\n\t\t\t$this->close($this->getLeaveMessage(), $ev->getKickMessage());\n\n\t\t\treturn;\n\t\t}\n\n\t\tif(!$this->isConnected()){\n\t\t\treturn;\n\t\t}\n\n\t\t$this->dataPacket(new ResourcePacksInfoPacket());\n\n\t\tif(!$this->hasValidSpawnPosition() and isset($this->namedtag->SpawnLevel) and ($level = $this->server->getLevelByName($this->namedtag[\"SpawnLevel\"])) instanceof Level){\n\t\t\t$this->spawnPosition = new WeakPosition($this->namedtag[\"SpawnX\"], $this->namedtag[\"SpawnY\"], $this->namedtag[\"SpawnZ\"], $level);\n\t\t}\n\t\t$spawnPosition = $this->getSpawn();\n\n\t\t$pk = new StartGamePacket();\n\t\t$pk->entityUniqueId = 0;\n\t\t$pk->entityRuntimeId = 0;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->seed = -1;\n\t\t$pk->dimension = $this->level->getDimension();\n\t\t$pk->gamemode = $this->gamemode & 0x01;\n\t\t$pk->difficulty = $this->server->getDifficulty();\n\t\t$pk->spawnX = $spawnPosition->getFloorX();\n\t\t$pk->spawnY = $spawnPosition->getFloorY();\n\t\t$pk->spawnZ = $spawnPosition->getFloorZ();\n\t\t$pk->hasBeenLoadedInCreative = 1;\n\t\t$pk->dayCycleStopTime = -1; //TODO: implement this properly\n\t\t$pk->eduMode = 0;\n\t\t$pk->rainLevel = 0; //TODO: implement these properly\n\t\t$pk->lightningLevel = 0;\n\t\t$pk->commandsEnabled = 1;\n\t\t$pk->unknown = \"UNKNOWN\";\n\t\t$pk->worldName = $this->server->getMotd();\n\t\t$this->dataPacket($pk);\n\n\t\t$pk = new SetTimePacket();\n\t\t$pk->time = $this->level->getTime();\n\t\t$pk->started = $this->level->stopTime == false;\n\t\t$this->dataPacket($pk);\n\n\t\t$this->sendAttributes(true);\n\t\t$this->setNameTagVisible(true);\n\t\t$this->setNameTagAlwaysVisible(true);\n\n\t\t$this->server->getLogger()->info($this->getServer()->getLanguage()->translateString(\"pocketmine.player.logIn\", [\n\t\t\tTextFormat::AQUA . $this->username . TextFormat::WHITE,\n\t\t\t$this->ip,\n\t\t\t$this->port,\n\t\t\tTextFormat::GREEN . $this->randomClientId . TextFormat::WHITE,\n\t\t\t$this->id,\n\t\t\t$this->level->getName(),\n\t\t\tround($this->x, 4),\n\t\t\tround($this->y, 4),\n\t\t\tround($this->z, 4),\n\t\t\tTextFormat::YELLOW . $this->deviceModel . TextFormat::WHITE,\n\t\t]));\n\t\t/*if($this->isOp()){\n\t\t\t$this->setRemoveFormat(false);\n\t\t}*/\n\t\tif($this->gamemode === Player::SPECTATOR){\n\t\t\t$pk = new ContainerSetContentPacket();\n\t\t\t$pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;\n\t\t\t$this->dataPacket($pk);\n\t\t}else{\n\t\t\t$pk = new ContainerSetContentPacket();\n\t\t\t$pk->windowid = ContainerSetContentPacket::SPECIAL_CREATIVE;\n\t\t\t$pk->slots = array_merge(Item::getCreativeItems(), $this->personalCreativeItems);\n\t\t\t$this->dataPacket($pk);\n\t\t}\n\n\t\t$this->sendCommandData();\n\n\t\t$this->level->getWeather()->sendWeather($this);\n\t\t$this->forceMovement = $this->teleportPosition = $this->getPosition();\n\t}\n\n\tpublic function getProtocol(){\n\t\treturn $this->protocol;\n\t}\n\n\t/**\n\t * Handles a Minecraft packet\n\t * TODO: Separate all of this in handlers\n\t *\n\t * WARNING: Do not use this, it's only for internal use.\n\t * Changes to this function won't be recorded on the version.\n\t *\n\t * @param DataPacket $packet\n\t */\n\tpublic function handleDataPacket(DataPacket $packet){\n\n\t\tif($this->connected === false){\n\t\t\treturn;\n\t\t}\n\n\t\tif($packet::NETWORK_ID === ProtocolInfo::BATCH_PACKET){\n\t\t\t/** @var BatchPacket $packet */\n\t\t\t$this->server->getNetwork()->processBatch($packet, $this);\n\t\t\treturn;\n\t\t}\n\n\t\t$timings = Timings::getReceiveDataPacketTimings($packet);\n\n\t\t$timings->startTiming();\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new DataPacketReceiveEvent($this, $packet));\n\t\tif($ev->isCancelled()){\n\t\t\t$timings->stopTiming();\n\t\t\treturn;\n\t\t}\n\n\t\tswitch($packet::NETWORK_ID){\n\t\t\tcase ProtocolInfo::ITEM_FRAME_DROP_ITEM_PACKET:\n\t\t\t\t$tile = $this->level->getTile($this->temporalVector->setComponents($packet->x, $packet->y, $packet->z));\n\t\t\t\tif($tile instanceof ItemFrame){\n\t\t\t\t\t$block = $this->level->getBlock($tile);\n\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new BlockBreakEvent($this, $block, $this->getInventory()->getItemInHand(), true));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$item = $tile->getItem();\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new ItemFrameDropItemEvent($this, $block, $tile, $item));\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\tif($item->getId() !== Item::AIR){\n\t\t\t\t\t\t\t\tif((mt_rand(0, 10) / 10) < $tile->getItemDropChance()){\n\t\t\t\t\t\t\t\t\t$this->level->dropItem($tile, $item);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$tile->setItem(Item::get(Item::AIR));\n\t\t\t\t\t\t\t\t$tile->setItemRotation(0);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else $tile->spawnTo($this);\n\t\t\t\t\t}else $tile->spawnTo($this);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET:\n\t\t\t\t/*if($this->spawned){\n\t\t\t\t\t$this->viewDistance = $packet->radius ** 2;\n\t\t\t\t}*/\n\t\t\t\t$pk = new ChunkRadiusUpdatedPacket();\n\t\t\t\t$pk->radius = ($this->server->chunkRadius != -1) ? $this->server->chunkRadius : $packet->radius;\n\t\t\t\t$this->dataPacket($pk);\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::PLAYER_INPUT_PACKET:\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::LOGIN_PACKET:\n\t\t\t\tif($this->loggedIn){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$pk = new PlayStatusPacket();\n\t\t\t\t$pk->status = PlayStatusPacket::LOGIN_SUCCESS;\n\t\t\t\t$this->dataPacket($pk);\n\n\t\t\t\t$this->username = TextFormat::clean($packet->username);\n\t\t\t\t$this->displayName = $this->username;\n\t\t\t\t$this->setNameTag($this->username);\n\t\t\t\t$this->iusername = strtolower($this->username);\n\t\t\t\t$this->protocol = $packet->protocol;\n\t\t\t\t$this->deviceModel = $packet->deviceModel;\n\n\t\t\t\tif($this->server->getConfigBoolean(\"online-mode\", false) && $packet->identityPublicKey === null){\n\t\t\t\t\t$this->kick(\"disconnectionScreen.notAuthenticated\", false);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif(count($this->server->getOnlinePlayers()) >= $this->server->getMaxPlayers() and $this->kick(\"disconnectionScreen.serverFull\", false)){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif($packet->protocol !== ProtocolInfo::CURRENT_PROTOCOL){\n\t\t\t\t\tif($packet->protocol < ProtocolInfo::CURRENT_PROTOCOL){\n\t\t\t\t\t\t$message = \"disconnectionScreen.outdatedClient\";\n\n\t\t\t\t\t\t$pk = new PlayStatusPacket();\n\t\t\t\t\t\t$pk->status = PlayStatusPacket::LOGIN_FAILED_CLIENT;\n\t\t\t\t\t\t$this->directDataPacket($pk);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$message = \"disconnectionScreen.outdatedServer\";\n\n\t\t\t\t\t\t$pk = new PlayStatusPacket();\n\t\t\t\t\t\t$pk->status = PlayStatusPacket::LOGIN_FAILED_SERVER;\n\t\t\t\t\t\t$this->directDataPacket($pk);\n\t\t\t\t\t}\n\t\t\t\t\t$this->close(\"\", $message, false);\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$this->randomClientId = $packet->clientId;\n\n\t\t\t\t$this->uuid = UUID::fromString($packet->clientUUID);\n\t\t\t\t$this->rawUUID = $this->uuid->toBinary();\n\n\t\t\t\t$valid = true;\n\t\t\t\t$len = strlen($packet->username);\n\t\t\t\tif($len > 16 or $len < 3){\n\t\t\t\t\t$valid = false;\n\t\t\t\t}\n\t\t\t\tfor($i = 0; $i < $len and $valid; ++$i){\n\t\t\t\t\t$c = ord($packet->username{$i});\n\t\t\t\t\tif(($c >= ord(\"a\") and $c <= ord(\"z\")) or ($c >= ord(\"A\") and $c <= ord(\"Z\")) or ($c >= ord(\"0\") and $c <= ord(\"9\")) or $c === ord(\"_\")){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\t$valid = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif(!$valid or $this->iusername === \"rcon\" or $this->iusername === \"console\"){\n\t\t\t\t\t$this->close(\"\", \"disconnectionScreen.invalidName\");\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif((strlen($packet->skin) != 64 * 64 * 4) and (strlen($packet->skin) != 64 * 32 * 4)){\n\t\t\t\t\t$this->close(\"\", \"disconnectionScreen.invalidSkin\");\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$this->setSkin($packet->skin, $packet->skinId);\n\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerPreLoginEvent($this, \"Plugin reason\"));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t$this->close(\"\", $ev->getKickMessage());\n\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif($this->isConnected()){\n\t\t\t\t\t$this->onPlayerPreLogin();\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::MOVE_PLAYER_PACKET:\n\n\t\t\t\tif($this->linkedEntity instanceof Entity){\n\t\t\t\t\t$entity = $this->linkedEntity;\n\t\t\t\t\tif($entity instanceof Boat){\n\t\t\t\t\t\t$entity->setPosition($this->temporalVector->setComponents($packet->x, $packet->y - 0.3, $packet->z));\n\t\t\t\t\t}\n\t\t\t\t\t/*if($entity instanceof Minecart){\n\t\t\t\t\t\t$entity->isFreeMoving = true;\n\t\t\t\t\t\t$entity->motionX = -sin($packet->yaw / 180 * M_PI);\n\t\t\t\t\t\t$entity->motionZ = cos($packet->yaw / 180 * M_PI);\n\t\t\t\t\t}*/\n\t\t\t\t}\n\n\t\t\t\t$newPos = new Vector3($packet->x, $packet->y - $this->getEyeHeight(), $packet->z);\n\n\t\t\t\tif($newPos->distanceSquared($this) < 0.01 and ($packet->yaw % 360) === $this->yaw and ($packet->pitch % 360) === $this->pitch){ //player hasn't moved, just client spamming packets\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$revert = false;\n\t\t\t\tif(!$this->isAlive() or $this->spawned !== true){\n\t\t\t\t\t$revert = true;\n\t\t\t\t\t$this->forceMovement = new Vector3($this->x, $this->y, $this->z);\n\t\t\t\t}\n\n\t\t\t\tif($this->forceMovement instanceof Vector3 and (($dist = $newPos->distanceSquared($this->forceMovement)) > 0.1 or $revert)){\n\t\t\t\t\t$this->sendPosition($this->forceMovement, $packet->yaw, $packet->pitch, MovePlayerPacket::MODE_RESET);\n\t\t\t\t}else{\n\t\t\t\t\t$packet->yaw %= 360;\n\t\t\t\t\t$packet->pitch %= 360;\n\n\t\t\t\t\tif($packet->yaw < 0){\n\t\t\t\t\t\t$packet->yaw += 360;\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->setRotation($packet->yaw, $packet->pitch);\n\t\t\t\t\t$this->newPosition = $newPos;\n\t\t\t\t\t$this->forceMovement = null;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::ADVENTURE_SETTINGS_PACKET:\n\t\t\t\t//TODO: player abilities, check for other changes\n\t\t\t\tif($packet->isFlying and !$this->allowFlight){\n\t\t\t\t\t$this->kick(\"Flying is not enabled on this server\");\n\t\t\t\t\tbreak;\n\t\t\t\t}else{\n\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerToggleFlightEvent($this, $packet->isFlying));\n\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t$this->sendSettings();\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->flying = $ev->isFlying();\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::MOB_EQUIPMENT_PACKET:\n\t\t\t\tif($this->spawned === false or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * Handle hotbar slot remapping\n\t\t\t\t * This is the only time and place when hotbar mapping should ever be changed.\n\t\t\t\t * Changing hotbar slot mapping at will has been deprecated because it causes far too many\n\t\t\t\t * issues with Windows 10 Edition Beta.\n\t\t\t\t */\n\t\t\t\t$this->inventory->setHeldItemIndex($packet->selectedSlot, false, $packet->slot);\n\n\t\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::USE_ITEM_PACKET:\n\t\t\t\tif($this->spawned === false or !$this->isAlive() or $this->blocked){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$blockVector = new Vector3($packet->x, $packet->y, $packet->z);\n\n\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\n\t\t\t\tif($packet->face >= 0 and $packet->face <= 5){ //Use Block, place\n\t\t\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);\n\n\t\t\t\t\tif(!$this->canInteract($blockVector->add(0.5, 0.5, 0.5), 13) or $this->isSpectator()){\n\n\t\t\t\t\t}elseif($this->isCreative()){\n\t\t\t\t\t\t$item = $this->inventory->getItemInHand();\n\t\t\t\t\t\tif($this->level->useItemOn($blockVector, $item, $packet->face, $packet->fx, $packet->fy, $packet->fz, $this) === true){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif(!$this->inventory->getItemInHand()->deepEquals($packet->item)){\n\t\t\t\t\t\t$this->inventory->sendHeldItem($this);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$item = $this->inventory->getItemInHand();\n\t\t\t\t\t\t$oldItem = clone $item;\n\t\t\t\t\t\tif($this->level->useItemOn($blockVector, $item, $packet->face, $packet->fx, $packet->fy, $packet->fz, $this)){\n\t\t\t\t\t\t\tif(!$item->deepEquals($oldItem) or $item->getCount() !== $oldItem->getCount()){\n\t\t\t\t\t\t\t\t$this->inventory->setItemInHand($item);\n\t\t\t\t\t\t\t\t$this->inventory->sendHeldItem($this->hasSpawned);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->inventory->sendHeldItem($this);\n\n\t\t\t\t\tif($blockVector->distanceSquared($this) > 10000){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$target = $this->level->getBlock($blockVector);\n\t\t\t\t\t$block = $target->getSide($packet->face);\n\n\t\t\t\t\t$this->level->sendBlocks([$this], [$target, $block], UpdateBlockPacket::FLAG_ALL_PRIORITY);\n\t\t\t\t\tbreak;\n\t\t\t\t}elseif($packet->face === -1){\n\t\t\t\t\t$aimPos = (new Vector3($packet->x / 32768, $packet->y / 32768, $packet->z / 32768))->normalize();\n\n\t\t\t\t\tif($this->isCreative()){\n\t\t\t\t\t\t$item = $this->inventory->getItemInHand();\n\t\t\t\t\t}elseif(!$this->inventory->getItemInHand()->deepEquals($packet->item)){\n\t\t\t\t\t\t$this->inventory->sendHeldItem($this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$item = $this->inventory->getItemInHand();\n\t\t\t\t\t}\n\n\t\t\t\t\t$ev = new PlayerInteractEvent($this, $item, $aimPos, $packet->face, PlayerInteractEvent::RIGHT_CLICK_AIR);\n\n\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\n\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t$this->inventory->sendHeldItem($this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif($item->getId() === Item::FISHING_ROD){\n\t\t\t\t\t\tif($this->isFishing()){\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerUseFishingRodEvent($this, PlayerUseFishingRodEvent::ACTION_STOP_FISHING));\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerUseFishingRodEvent($this, PlayerUseFishingRodEvent::ACTION_START_FISHING));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\tif($this->isFishing()){\n\t\t\t\t\t\t\t\t$this->setFishingHook();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + $this->getEyeHeight()),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->yaw),\n\t\t\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->pitch)\n\t\t\t\t\t\t\t\t\t])\n\t\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t\t\t$f = 0.6;\n\t\t\t\t\t\t\t\t$this->fishingHook = new FishingHook($this->chunk, $nbt, $this);\n\t\t\t\t\t\t\t\t$this->fishingHook->setMotion($this->fishingHook->getMotion()->multiply($f));\n\t\t\t\t\t\t\t\t$this->fishingHook->spawnToAll();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif($item->getId() === Item::SNOWBALL){\n\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + $this->getEyeHeight()),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\t/*new DoubleTag(\"\", $aimPos->x),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $aimPos->y),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $aimPos->z)*/\n\t\t\t\t\t\t\t\t//TODO: remove this because of a broken client\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->yaw),\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->pitch)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t$f = 1.5;\n\t\t\t\t\t\t$snowball = Entity::createEntity(\"Snowball\", $this->chunk, $nbt, $this);\n\t\t\t\t\t\t$snowball->setMotion($snowball->getMotion()->multiply($f));\n\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t\t\t\t$this->inventory->setItemInHand($item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($snowball instanceof Projectile){\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($snowball));\n\t\t\t\t\t\t\tif($projectileEv->isCancelled()){\n\t\t\t\t\t\t\t\t$snowball->kill();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$snowball->spawnToAll();\n\t\t\t\t\t\t\t\t$this->level->addSound(new LaunchSound($this), $this->getViewers());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$snowball->spawnToAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif($item->getId() === Item::EGG){\n\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + $this->getEyeHeight()),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->yaw),\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->pitch)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t$f = 1.5;\n\t\t\t\t\t\t$egg = Entity::createEntity(\"Egg\", $this->chunk, $nbt, $this);\n\t\t\t\t\t\t$egg->setMotion($egg->getMotion()->multiply($f));\n\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t\t\t\t$this->inventory->setItemInHand($item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($egg instanceof Projectile){\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($egg));\n\t\t\t\t\t\t\tif($projectileEv->isCancelled()){\n\t\t\t\t\t\t\t\t$egg->kill();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$egg->spawnToAll();\n\t\t\t\t\t\t\t\t$this->level->addSound(new LaunchSound($this), $this->getViewers());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$egg->spawnToAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif($item->getId() == Item::ENCHANTING_BOTTLE){\n\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + $this->getEyeHeight()),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->yaw),\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->pitch)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t$f = 1.1;\n\t\t\t\t\t\t$thrownExpBottle = new ThrownExpBottle($this->chunk, $nbt, $this);\n\t\t\t\t\t\t$thrownExpBottle->setMotion($thrownExpBottle->getMotion()->multiply($f));\n\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t\t\t\t$this->inventory->setItemInHand($item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($thrownExpBottle instanceof Projectile){\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($thrownExpBottle));\n\t\t\t\t\t\t\tif($projectileEv->isCancelled()){\n\t\t\t\t\t\t\t\t$thrownExpBottle->kill();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$thrownExpBottle->spawnToAll();\n\t\t\t\t\t\t\t\t$this->level->addSound(new LaunchSound($this), $this->getViewers());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$thrownExpBottle->spawnToAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif($item->getId() == Item::SPLASH_POTION and $this->server->allowSplashPotion){\n\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + $this->getEyeHeight()),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->yaw),\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->pitch)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"PotionId\" => new ShortTag(\"PotionId\", $item->getDamage()),\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t$f = 1.1;\n\t\t\t\t\t\t$thrownPotion = new ThrownPotion($this->chunk, $nbt, $this);\n\t\t\t\t\t\t$thrownPotion->setMotion($thrownPotion->getMotion()->multiply($f));\n\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t\t\t\t$this->inventory->setItemInHand($item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($thrownPotion instanceof Projectile){\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($thrownPotion));\n\t\t\t\t\t\t\tif($projectileEv->isCancelled()){\n\t\t\t\t\t\t\t\t$thrownPotion->kill();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$thrownPotion->spawnToAll();\n\t\t\t\t\t\t\t\t$this->level->addSound(new LaunchSound($this), $this->getViewers());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$thrownPotion->spawnToAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif($item->getId() === Item::ENDER_PEARL){\n\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + $this->getEyeHeight()),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\tnew DoubleTag(\"\", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->yaw),\n\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->pitch)\n\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t$f = 1.5;\n\t\t\t\t\t\t$enderpearl = Entity::createEntity(\"EnderPearl\", $this->chunk, $nbt, $this);\n\t\t\t\t\t\t$enderpearl->setMotion($enderpearl->getMotion()->multiply($f));\n\t\t\t\t\t\t$enderpearl->setSpawner($this);\n\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t\t\t\t$this->inventory->setItemInHand($item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($enderpearl instanceof Projectile){\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($enderpearl));\n\t\t\t\t\t\t\tif($projectileEv->isCancelled()){\n\t\t\t\t\t\t\t\t$enderpearl->close();\n\t\t\t\t\t\t\t\t$this->teleport($enderpearl);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$enderpearl->spawnToAll();\n\t\t\t\t\t\t\t\t$this->level->addSound(new LaunchSound($this), $this->getViewers());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$enderpearl->spawnToAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, true);\n\t\t\t\t\t$this->startAction = $this->server->getTick();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::PLAYER_ACTION_PACKET:\n\t\t\t\tif($this->spawned === false or $this->blocked === true or (!$this->isAlive() and $packet->action !== PlayerActionPacket::ACTION_SPAWN_SAME_DIMENSION and $packet->action !== PlayerActionPacket::ACTION_SPAWN_OVERWORLD)){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$packet->eid = $this->id;\n\t\t\t\t$pos = new Vector3($packet->x, $packet->y, $packet->z);\n\n\t\t\t\tswitch($packet->action){\n\t\t\t\t\tcase PlayerActionPacket::ACTION_START_BREAK:\n\t\t\t\t\t\tif($this->lastBreak !== PHP_INT_MAX or $pos->distanceSquared($this) > 10000){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$target = $this->level->getBlock($pos);\n\t\t\t\t\t\t$ev = new PlayerInteractEvent($this, $this->inventory->getItemInHand(), $target, $packet->face, $target->getId() === 0 ? PlayerInteractEvent::LEFT_CLICK_AIR : PlayerInteractEvent::LEFT_CLICK_BLOCK);\n\t\t\t\t\t\t$this->getServer()->getPluginManager()->callEvent($ev);\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t$side = $target->getSide($packet->face);\n\t\t\t\t\t\t\tif($side instanceof Fire){\n\t\t\t\t\t\t\t\t$side->getLevel()->setBlock($side, new Air());\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$this->lastBreak = microtime(true);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->inventory->sendHeldItem($this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_ABORT_BREAK:\n\t\t\t\t\t\t$this->lastBreak = PHP_INT_MAX;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_STOP_BREAK:\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_RELEASE_ITEM:\n\t\t\t\t\t\tif($this->startAction > -1 and $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION)){\n\t\t\t\t\t\t\tif($this->inventory->getItemInHand()->getId() === Item::BOW){\n\t\t\t\t\t\t\t\t$bow = $this->inventory->getItemInHand();\n\t\t\t\t\t\t\t\tif($this->isSurvival() and !$this->inventory->contains(Item::get(Item::ARROW, -1))){\n\t\t\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$arrow = null;\n\n\t\t\t\t\t\t\t\t$index = $this->inventory->first(Item::get(Item::ARROW, -1));\n\n\t\t\t\t\t\t\t\tif($index !== -1){\n\t\t\t\t\t\t\t\t\t$arrow = $this->inventory->getItem($index);\n\t\t\t\t\t\t\t\t\t$arrow->setCount(1);\n\t\t\t\t\t\t\t\t}elseif($this->isCreative()){\n\t\t\t\t\t\t\t\t\t$arrow = Item::get(Item::ARROW, 0, 1);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + $this->getEyeHeight()),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", -sin($this->pitch / 180 * M_PI)),\n\t\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", cos($this->yaw / 180 * M_PI) * cos($this->pitch / 180 * M_PI))\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->yaw),\n\t\t\t\t\t\t\t\t\t\tnew FloatTag(\"\", $this->pitch)\n\t\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\t\"Fire\" => new ShortTag(\"Fire\", $this->isOnFire() ? 45 * 60 : 0),\n\t\t\t\t\t\t\t\t\t\"Potion\" => new ShortTag(\"Potion\", $arrow->getDamage())\n\t\t\t\t\t\t\t\t]);\n\n\t\t\t\t\t\t\t\t$diff = ($this->server->getTick() - $this->startAction);\n\t\t\t\t\t\t\t\t$p = $diff / 20;\n\t\t\t\t\t\t\t\t$f = min((($p ** 2) + $p * 2) / 3, 1) * 2;\n\t\t\t\t\t\t\t\t$ev = new EntityShootBowEvent($this, $bow, Entity::createEntity(\"Arrow\", $this->chunk, $nbt, $this, $f == 2 ? true : false), $f);\n\n\t\t\t\t\t\t\t\tif($f < 0.1 or $diff < 5){\n\t\t\t\t\t\t\t\t\t$ev->setCancelled();\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\n\t\t\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t\t\t$ev->getProjectile()->kill();\n\t\t\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$ev->getProjectile()->setMotion($ev->getProjectile()->getMotion()->multiply($ev->getForce()));\n\t\t\t\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t\t\t\t$this->inventory->removeItem(Item::get(Item::ARROW, $arrow->getDamage(), 1));\n\t\t\t\t\t\t\t\t\t\t$bow->setDamage($bow->getDamage() + 1);\n\t\t\t\t\t\t\t\t\t\tif($bow->getDamage() >= 385){\n\t\t\t\t\t\t\t\t\t\t\t$this->inventory->setItemInHand(Item::get(Item::AIR, 0, 0));\n\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t$this->inventory->setItemInHand($bow);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif($ev->getProjectile() instanceof Projectile){\n\t\t\t\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($projectileEv = new ProjectileLaunchEvent($ev->getProjectile()));\n\t\t\t\t\t\t\t\t\t\tif($projectileEv->isCancelled()){\n\t\t\t\t\t\t\t\t\t\t\t$ev->getProjectile()->kill();\n\t\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t\t$ev->getProjectile()->spawnToAll();\n\t\t\t\t\t\t\t\t\t\t\t$this->level->addSound(new LaunchSound($this), $this->getViewers());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t\t$ev->getProjectile()->spawnToAll();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}elseif($this->inventory->getItemInHand()->getId() === Item::BUCKET and $this->inventory->getItemInHand()->getDamage() === 1){ //Milk!\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerItemConsumeEvent($this, $this->inventory->getItemInHand()));\n\t\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$pk = new EntityEventPacket();\n\t\t\t\t\t\t\t$pk->eid = $this->getId();\n\t\t\t\t\t\t\t$pk->event = EntityEventPacket::USE_ITEM;\n\t\t\t\t\t\t\t//$pk;\n\t\t\t\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t\t\t\t$this->server->broadcastPacket($this->getViewers(), $pk);\n\n\t\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t\t$slot = $this->inventory->getItemInHand();\n\t\t\t\t\t\t\t\t--$slot->count;\n\t\t\t\t\t\t\t\t$this->inventory->setItemInHand($slot);\n\t\t\t\t\t\t\t\t$this->inventory->addItem(Item::get(Item::BUCKET, 0, 1));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$this->removeAllEffects();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_STOP_SLEEPING:\n\t\t\t\t\t\t$this->stopSleep();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_SPAWN_SAME_DIMENSION:\n\t\t\t\t\tcase PlayerActionPacket::ACTION_SPAWN_OVERWORLD:\n\t\t\t\t\t\tif($this->isAlive() or !$this->isOnline()){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif($this->server->isHardcore()){\n\t\t\t\t\t\t\t$this->setBanned(true);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\n\t\t\t\t\t\tif($this->server->netherEnabled){\n\t\t\t\t\t\t\tif($this->level === $this->server->getLevelByName($this->server->netherName)){\n\t\t\t\t\t\t\t\t$this->teleport($pos = $this->server->getDefaultLevel()->getSafeSpawn());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerRespawnEvent($this, $this->getSpawn()));\n\n\t\t\t\t\t\t$this->teleport($ev->getRespawnPosition());\n\n\t\t\t\t\t\t$this->setSprinting(false);\n\t\t\t\t\t\t$this->setSneaking(false);\n\t\t\t\t\t\t$this->setGliding(false);\n\n\t\t\t\t\t\t$this->extinguish();\n\t\t\t\t\t\t$this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 400);\n\t\t\t\t\t\t$this->deadTicks = 0;\n\t\t\t\t\t\t$this->noDamageTicks = 60;\n\n\t\t\t\t\t\t$this->removeAllEffects();\n\t\t\t\t\t\t$this->setHealth($this->getMaxHealth());\n\t\t\t\t\t\t$this->setFood(20);\n\t\t\t\t\t\t$this->starvationTick = 0;\n\t\t\t\t\t\t$this->foodTick = 0;\n\t\t\t\t\t\t$this->foodUsageTime = 0;\n\n\t\t\t\t\t\t$this->sendData($this);\n\n\t\t\t\t\t\t$this->sendSettings();\n\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t$this->inventory->sendArmorContents($this);\n\n\t\t\t\t\t\t$this->blocked = false;\n\n\t\t\t\t\t\t$this->spawnToAll();\n\t\t\t\t\t\t$this->scheduleUpdate();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_JUMP:\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_START_SPRINT:\n\t\t\t\t\t\t$ev = new PlayerToggleSprintEvent($this, true);\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t$this->sendData($this);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->setSprinting(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_STOP_SPRINT:\n\t\t\t\t\t\t$ev = new PlayerToggleSprintEvent($this, false);\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t$this->sendData($this);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->setSprinting(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_START_SNEAK:\n\t\t\t\t\t\t$ev = new PlayerToggleSneakEvent($this, true);\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t$this->sendData($this);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->setSneaking(true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\tcase PlayerActionPacket::ACTION_STOP_SNEAK:\n\t\t\t\t\t\t$ev = new PlayerToggleSneakEvent($this, false);\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t$this->sendData($this);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->setSneaking(false);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\t\tcase PlayerActionPacket::ACTION_START_GLIDE:\n  \t\t\t\t\t\t$ev = new PlayerToggleGlideEvent($this, true);\n  \t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n  \t\t\t\t\t\tif($ev->isCancelled()){\n  \t\t\t\t\t\t\t$this->sendData($this);\n  \t\t\t\t\t\t}else{\n  \t\t\t\t\t\t\t$this->setGliding(true);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t\tbreak 2;\n  \t\t\t\t\tcase PlayerActionPacket::ACTION_STOP_GLIDE:\n  \t\t\t\t\t\t$ev = new PlayerToggleGlideEvent($this, false);\n  \t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n  \t\t\t\t\t\tif($ev->isCancelled()){\n  \t\t\t\t\t\t\t$this->sendData($this);\n  \t\t\t\t\t\t}else{\n  \t\t\t\t\t\t\t$this->setGliding(false);\n  \t\t\t\t\t\t}\n  \t\t\t\t\t\tbreak 2;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\tassert(false, \"Unhandled player action \" . $packet->action . \" from \" . $this->getName());\n\t\t\t\t}\n\n\t\t\t\t$this->startAction = -1;\n\t\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);\n\t\t\t\tbreak;\n\n\t\t\tcase ProtocolInfo::REMOVE_BLOCK_PACKET:\n\t\t\t\tif($this->spawned === false or $this->blocked === true or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\n\t\t\t\t$vector = new Vector3($packet->x, $packet->y, $packet->z);\n\n\t\t\t\t$item = $this->inventory->getItemInHand();\n\t\t\t\t$oldItem = clone $item;\n\n\t\t\t\tif($this->canInteract($vector->add(0.5, 0.5, 0.5), $this->isCreative() ? 13 : 6) and $this->level->useBreakOn($vector, $item, $this, $this->server->destroyBlockParticle)){\n\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\tif(!$item->equals($oldItem) or $item->getCount() !== $oldItem->getCount()){\n\t\t\t\t\t\t\t$this->inventory->setItemInHand($item);\n\t\t\t\t\t\t\t$this->inventory->sendHeldItem($this);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->exhaust(0.025, PlayerExhaustEvent::CAUSE_MINING);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t$target = $this->level->getBlock($vector);\n\t\t\t\t$tile = $this->level->getTile($vector);\n\n\t\t\t\t$this->level->sendBlocks([$this], [$target], UpdateBlockPacket::FLAG_ALL_PRIORITY);\n\n\t\t\t\t$this->inventory->sendHeldItem($this);\n\n\t\t\t\tif($tile instanceof Spawnable){\n\t\t\t\t\t$tile->spawnTo($this);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase ProtocolInfo::MOB_ARMOR_EQUIPMENT_PACKET:\n\t\t\t\t//This packet is ignored. Armour changes are also sent by ContainerSetSlotPackets, and are handled there instead.\n\t\t\t\tbreak;\n\n\t\t\tcase ProtocolInfo::INTERACT_PACKET:\n\t\t\t\tif($this->spawned === false or !$this->isAlive() or $this->blocked){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\n\t\t\t\t$target = $this->level->getEntity($packet->target);\n\n\t\t\t\t$cancelled = false;\n\n\t\t\t\tif($target instanceof Player and $this->server->getConfigBoolean(\"pvp\", true) === false){\n\t\t\t\t\t$cancelled = true;\n\t\t\t\t}\n\n\t\t\t\tif($target instanceof Boat or ($target instanceof Minecart and $target->getType() == Minecart::TYPE_NORMAL)){\n\t\t\t\t\tif($packet->action === InteractPacket::ACTION_RIGHT_CLICK){\n\t\t\t\t\t\t$this->linkEntity($target);\n\t\t\t\t\t}elseif($packet->action === InteractPacket::ACTION_LEFT_CLICK){\n\t\t\t\t\t\tif($this->linkedEntity == $target){\n\t\t\t\t\t\t\t$target->setLinked(0, $this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$target->close();\n\t\t\t\t\t}elseif($packet->action === InteractPacket::ACTION_LEAVE_VEHICLE){\n\t\t\t\t\t\t$this->setLinked(0, $target);\n\t\t\t\t\t}\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif($packet->action === InteractPacket::ACTION_RIGHT_CLICK){\n\t\t\t\t\tif($target instanceof Animal and $this->getInventory()->getItemInHand()){\n\t\t\t\t\t\t//TODO: Feed\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}elseif($packet->action === InteractPacket::ACTION_MOUSEOVER){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif($target instanceof Entity and $this->getGamemode() !== Player::VIEW and $this->isAlive() and $target->isAlive()){\n\t\t\t\t\tif($target instanceof DroppedItem or $target instanceof Arrow){\n\t\t\t\t\t\t$this->kick(\"Attempting to attack an invalid entity\");\n\t\t\t\t\t\t$this->server->getLogger()->warning($this->getServer()->getLanguage()->translateString(\"pocketmine.player.invalidEntity\", [$this->getName()]));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$item = $this->inventory->getItemInHand();\n\t\t\t\t\t$damage = [\n\t\t\t\t\t\tEntityDamageEvent::MODIFIER_BASE => $item->getModifyAttackDamage($target),\n\t\t\t\t\t];\n\n\t\t\t\t\tif(!$this->canInteract($target, 8)){\n\t\t\t\t\t\t$cancelled = true;\n\t\t\t\t\t}elseif($target instanceof Player){\n\t\t\t\t\t\tif(($target->getGamemode() & 0x01) > 0){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}elseif($this->server->getConfigBoolean(\"pvp\") !== true or $this->server->getDifficulty() === 0){\n\t\t\t\t\t\t\t$cancelled = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$ev = new EntityDamageByEntityEvent($this, $target, EntityDamageEvent::CAUSE_ENTITY_ATTACK, $damage, 0.4 + $item->getEnchantmentLevel(Enchantment::TYPE_WEAPON_KNOCKBACK) * 0.15);\n\t\t\t\t\tif($cancelled){\n\t\t\t\t\t\t$ev->setCancelled();\n\t\t\t\t\t}\n\n\t\t\t\t\tif($target->attack($ev->getFinalDamage(), $ev) === true){\n\t\t\t\t\t\t$fireAspectL = $item->getEnchantmentLevel(Enchantment::TYPE_WEAPON_FIRE_ASPECT);\n\t\t\t\t\t\tif($fireAspectL > 0){\n\t\t\t\t\t\t\t$fireEv = new EntityCombustByEntityEvent($this, $target, $fireAspectL * 4, $ev->getFireProtectL());\n\t\t\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($fireEv);\n\t\t\t\t\t\t\tif(!$fireEv->isCancelled()){\n\t\t\t\t\t\t\t\t$target->setOnFire($fireEv->getDuration());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t//Thorns\n\t\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\t\t$ev->createThornsDamage();\n\t\t\t\t\t\t\tif($ev->getThornsDamage() > 0){\n\t\t\t\t\t\t\t\t$thornsEvent = new EntityDamageByEntityEvent($target, $this, EntityDamageEvent::CAUSE_ENTITY_ATTACK, $ev->getThornsDamage(), 0);\n\t\t\t\t\t\t\t\tif(!$thornsEvent->isCancelled()){\n\t\t\t\t\t\t\t\t\tif($this->attack($thornsEvent->getFinalDamage(), $thornsEvent) === true){\n\t\t\t\t\t\t\t\t\t\t$thornsEvent->useArmors();\n\t\t\t\t\t\t\t\t\t\t$ev->setThornsArmorUse();\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$ev->useArmors();\n\t\t\t\t\t}\n\n\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\tif($item->isTool() and $this->isSurvival()){\n\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif($this->isSurvival()){\n\t\t\t\t\t\tif($item->isTool()){\n\t\t\t\t\t\t\tif($item->useOn($target) and $item->getDamage() >= $item->getMaxDurability()){\n\t\t\t\t\t\t\t\t$this->inventory->setItemInHand(Item::get(Item::AIR, 0, 1));\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$this->inventory->setItemInHand($item);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->exhaust(0.3, PlayerExhaustEvent::CAUSE_ATTACK);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::ANIMATE_PACKET:\n\t\t\t\tif($this->spawned === false or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerAnimationEvent($this, $packet->action));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$pk = new AnimatePacket();\n\t\t\t\t$pk->eid = $this->getId();\n\t\t\t\t$pk->action = $ev->getAnimationType();\n\t\t\t\t$this->server->broadcastPacket($this->getViewers(), $pk);\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::SET_HEALTH_PACKET: //Not used\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::ENTITY_EVENT_PACKET:\n\t\t\t\tif($this->spawned === false or $this->blocked === true or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\n\t\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false); //TODO: check if this should be true\n\n\t\t\t\tswitch($packet->event){\n\t\t\t\t\tcase EntityEventPacket::USE_ITEM: //Eating\n\t\t\t\t\t\t$slot = $this->inventory->getItemInHand();\n\n\t\t\t\t\t\tif($slot->canBeConsumed()){\n\t\t\t\t\t\t\t$ev = new PlayerItemConsumeEvent($this, $slot);\n\t\t\t\t\t\t\tif(!$slot->canBeConsumedBy($this)){\n\t\t\t\t\t\t\t\t$ev->setCancelled();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t\t$slot->onConsume($this);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::DROP_ITEM_PACKET:\n\t\t\t\tif($this->spawned === false or $this->blocked === true or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif($packet->item->getId() === Item::AIR){\n\t\t\t\t\t/**\n\t\t\t\t\t * This is so stupid it's unreal.\n\t\t\t\t\t * Windows 10 Edition Beta drops the contents of the crafting grid when the inventory closes - including air.\n\t\t\t\t\t */\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif(($this->isCreative() and $this->server->limitedCreative)){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$this->getTransactionQueue()->addTransaction(new DropItemTransaction($packet->item));\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::COMMAND_STEP_PACKET:\n\t\t\t\tif($this->spawned === false or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$this->craftingType = 0;\n\t\t\t\t$commandText = $packet->command;\n\t\t\t\tif($packet->args !== null){\n\t\t\t\t\tforeach($packet->args as $arg){ //command ordering will be an issue\n\t\t\t\t\t\t$commandText .= \" \" . $arg;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerCommandPreprocessEvent($this, \"/\" . $commandText));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tTimings::$playerCommandTimer->startTiming();\n\t\t\t\t$this->server->dispatchCommand($ev->getPlayer(), substr($ev->getMessage(), 1));\n\t\t\t\tTimings::$playerCommandTimer->stopTiming();\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::TEXT_PACKET:\n\t\t\t\tif($this->spawned === false or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\t\t\t\tif($packet->type === TextPacket::TYPE_CHAT){\n\t\t\t\t\t$packet->message = TextFormat::clean($packet->message, $this->removeFormat);\n\t\t\t\t\tforeach(explode(\"\\n\", $packet->message) as $message){\n\t\t\t\t\t\tif(trim($message) != \"\" and strlen($message) <= 255 and $this->messageCounter-- > 0){\n\t\t\t\t\t\t\tif(substr($message, 0, 2) === \"./\"){ //Command (./ = fast hack for old plugins post 0.16)\n\t\t\t\t\t\t\t\t$message = substr($message, 1);\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$ev = new PlayerCommandPreprocessEvent($this, $message);\n\n\t\t\t\t\t\t\tif(mb_strlen($ev->getMessage(), \"UTF-8\") > 320){\n\t\t\t\t\t\t\t\t$ev->setCancelled();\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\n\t\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(substr($ev->getMessage(), 0, 1) === \"/\"){\n\t\t\t\t\t\t\t\tTimings::$playerCommandTimer->startTiming();\n\t\t\t\t\t\t\t\t$this->server->dispatchCommand($ev->getPlayer(), substr($ev->getMessage(), 1));\n\t\t\t\t\t\t\t\tTimings::$playerCommandTimer->stopTiming();\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerChatEvent($this, $ev->getMessage()));\n\t\t\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t\t\t$this->server->broadcastMessage($this->getServer()->getLanguage()->translateString($ev->getFormat(), [\n\t\t\t\t\t\t\t\t\t\t$ev->getPlayer()->getDisplayName(),\n\t\t\t\t\t\t\t\t\t\t$ev->getMessage()\n\t\t\t\t\t\t\t\t\t]), $ev->getRecipients());\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::CONTAINER_CLOSE_PACKET:\n\t\t\t\tif($this->spawned === false or $packet->windowid === 0){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\t\t\t\tif(isset($this->windowIndex[$packet->windowid])){\n\t\t\t\t\t$this->server->getPluginManager()->callEvent(new InventoryCloseEvent($this->windowIndex[$packet->windowid], $this));\n\t\t\t\t\t$this->removeWindow($this->windowIndex[$packet->windowid]);\n\t\t\t\t}\n\n\t\t\t\t/**\n\t\t\t\t * Drop anything still left in the crafting inventory\n\t\t\t\t * This will usually never be needed since Windows 10 clients will send DropItemPackets\n\t\t\t\t * which will cause this to happen anyway, but this is here for when transactions\n\t\t\t\t * fail and items end up stuck in the crafting inventory.\n\t\t\t\t */\n\t\t\t\tforeach($this->getFloatingInventory()->getContents() as $item){\n\t\t\t\t\t$this->getTransactionQueue()->addTransaction(new DropItemTransaction($item));\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase ProtocolInfo::CRAFTING_EVENT_PACKET:\n\t\t\t\tif($this->spawned === false or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t/**\n\t\t\t\t * For some annoying reason, anvils send window ID 255 when crafting with them instead of the _actual_ anvil window ID\n\t\t\t\t * The result of this is anvils immediately closing when used. This is highly unusual, especially since the\n\t\t\t\t * container set slot packets send the correct window ID, but... eh\n\t\t\t\t */\n\t\t\t\t/*elseif(!isset($this->windowIndex[$packet->windowId])){\n\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t$pk = new ContainerClosePacket();\n\t\t\t\t\t$pk->windowid = $packet->windowId;\n\t\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t\tbreak;\n\t\t\t\t}*/\n\n\t\t\t\t$recipe = $this->server->getCraftingManager()->getRecipe($packet->id);\n\n\t\t\t\tif($this->craftingType === self::CRAFTING_ANVIL){\n\t\t\t\t\t$anvilInventory = $this->windowIndex[$packet->windowId] ?? null;\n\t\t\t\t\tif($anvilInventory === null){\n\t\t\t\t\t\tforeach($this->windowIndex as $window){\n\t\t\t\t\t\t\tif($window instanceof AnvilInventory){\n\t\t\t\t\t\t\t\t$anvilInventory = $window;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($anvilInventory === null){ //If it's _still_ null, then the player doesn't have a valid anvil window, cannot proceed.\n\t\t\t\t\t\t\t$this->getServer()->getLogger()->debug(\"Couldn't find an anvil window for \".$this->getName().\", exiting\");\n\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif($recipe === null){\n\t\t\t\t\t\t//Item renamed\n\t\t\t\t\t\tif(!$anvilInventory->onRename($this, $packet->output[0])){\n\t\t\t\t\t\t\t$this->getServer()->getLogger()->debug($this->getName().\" failed to rename an item in an anvil\");\n\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t//TODO: Anvil crafting recipes\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}elseif(($recipe instanceof BigShapelessRecipe or $recipe instanceof BigShapedRecipe) and $this->craftingType === 0){\n\t\t\t\t\t$this->server->getLogger()->debug(\"Received big crafting recipe from \".$this->getName().\" with no crafting table open\");\n\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\tbreak;\n\t\t\t\t}elseif($recipe === null){\n\t\t\t\t\t$this->server->getLogger()->debug(\"Null (unknown) crafting recipe received from \".$this->getName().\" for \".$packet->output[0]);\n\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$canCraft = true;\n\n\t\t\t\tif(count($packet->input) === 0){\n\t\t\t\t\t/* If the packet \"input\" field is empty this needs to be handled differently.\n\t\t\t\t\t * \"input\" is used to tell the server what items to remove from the client's inventory\n\t\t\t\t\t * Because crafting takes the materials in the crafting grid, nothing needs to be taken from the inventory\n\t\t\t\t\t * Instead, we take the materials from the crafting inventory\n\t\t\t\t\t * To know what materials we need to take, we have to guess the crafting recipe used based on the\n\t\t\t\t\t * output item and the materials stored in the crafting items\n\t\t\t\t\t * The reason we have to guess is because Win10 sometimes sends a different recipe UUID\n\t\t\t\t\t * say, if you put the wood for a door in the right hand side of the crafting grid instead of the left\n\t\t\t\t\t * it will send the recipe UUID for a wooden pressure plate. Unknown currently whether this is a client\n\t\t\t\t\t * bug or if there is something wrong with the way the server handles recipes.\n\t\t\t\t\t * TODO: Remove recipe correction and fix desktop crafting recipes properly.\n\t\t\t\t\t * In fact, TODO: Rewrite crafting entirely.\n\t\t\t\t\t */\n\t\t\t\t\t$possibleRecipes = $this->server->getCraftingManager()->getRecipesByResult($packet->output[0]);\n\t\t\t\t\tif(!$packet->output[0]->equals($recipe->getResult())){\n\t\t\t\t\t\t$this->server->getLogger()->debug(\"Mismatched desktop recipe received from player \".$this->getName().\", expected \".$recipe->getResult().\", got \".$packet->output[0]);\n\t\t\t\t\t}\n\t\t\t\t\t$recipe = null;\n\t\t\t\t\tforeach($possibleRecipes as $r){\n\t\t\t\t\t\t/* Check the ingredient list and see if it matches the ingredients we've put into the crafting grid\n\t\t\t\t\t\t * As soon as we find a recipe that we have all the ingredients for, take it and run with it. */\n\n\t\t\t\t\t\t//Make a copy of the floating inventory that we can make changes to.\n\t\t\t\t\t\t$floatingInventory = clone $this->floatingInventory;\n\t\t\t\t\t\t$ingredients = $r->getIngredientList();\n\n\t\t\t\t\t\t//Check we have all the necessary ingredients.\n\t\t\t\t\t\tforeach($ingredients as $ingredient){\n\t\t\t\t\t\t\tif(!$floatingInventory->contains($ingredient)){\n\t\t\t\t\t\t\t\t//We're short on ingredients, try the next recipe\n\t\t\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t//This will only be reached if we have the item to take away.\n\t\t\t\t\t\t\t$floatingInventory->removeItem($ingredient);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($canCraft){\n\t\t\t\t\t\t\t//Found a recipe that works, take it and run with it.\n\t\t\t\t\t\t\t$recipe = $r;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif($recipe !== null){\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new CraftItemEvent($this, $ingredients, $recipe));\n\n\t\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->floatingInventory = $floatingInventory; //Set player crafting inv to the idea one created in this process\n\t\t\t\t\t\t$this->floatingInventory->addItem(clone $recipe->getResult()); //Add the result to our picture of the crafting inventory\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->server->getLogger()->debug(\"Unmatched desktop crafting recipe \" . $packet->id . \" from player \" . $this->getName());\n\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tif($recipe instanceof ShapedRecipe){\n\t\t\t\t\t\tfor($x = 0; $x < 3 and $canCraft; ++$x){\n\t\t\t\t\t\t\tfor($y = 0; $y < 3; ++$y){\n\t\t\t\t\t\t\t\t$item = $packet->input[$y * 3 + $x];\n\t\t\t\t\t\t\t\t$ingredient = $recipe->getIngredient($x, $y);\n\t\t\t\t\t\t\t\tif($item->getCount() > 0 and $item->getId() > 0){\n\t\t\t\t\t\t\t\t\tif($ingredient == null){\n\t\t\t\t\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif($ingredient->getId() != 0 and !$ingredient->equals($item, !$ingredient->hasAnyDamageValue(), $ingredient->hasCompoundTag())){\n\t\t\t\t\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t}elseif($ingredient !== null and $item->getId() !== 0){\n\t\t\t\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif($recipe instanceof ShapelessRecipe){\n\t\t\t\t\t\t$needed = $recipe->getIngredientList();\n\n\t\t\t\t\t\tfor($x = 0; $x < 3 and $canCraft; ++$x){\n\t\t\t\t\t\t\tfor($y = 0; $y < 3; ++$y){\n\t\t\t\t\t\t\t\t$item = clone $packet->input[$y * 3 + $x];\n\n\t\t\t\t\t\t\t\tforeach($needed as $k => $n){\n\t\t\t\t\t\t\t\t\tif($n->deepEquals($item, !$n->hasAnyDamageValue(), $n->hasCompoundTag())){\n\t\t\t\t\t\t\t\t\t\t$remove = min($n->getCount(), $item->getCount());\n\t\t\t\t\t\t\t\t\t\t$n->setCount($n->getCount() - $remove);\n\t\t\t\t\t\t\t\t\t\t$item->setCount($item->getCount() - $remove);\n\n\t\t\t\t\t\t\t\t\t\tif($n->getCount() === 0){\n\t\t\t\t\t\t\t\t\t\t\tunset($needed[$k]);\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif($item->getCount() > 0){\n\t\t\t\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(count($needed) > 0){\n\t\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t}\n\n\t\t\t\t\t/** @var Item[] $ingredients */\n\t\t\t\t\t$ingredients = $packet->input;\n\t\t\t\t\t$result = $packet->output[0];\n\n\t\t\t\t\tif(!$canCraft or !$recipe->getResult()->deepEquals($result)){\n\t\t\t\t\t\t$this->server->getLogger()->debug(\"Unmatched recipe \" . $recipe->getId() . \" from player \" . $this->getName() . \": expected \" . $recipe->getResult() . \", got \" . $result . \", using: \" . implode(\", \", $ingredients));\n\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$used = array_fill(0, $this->inventory->getSize(), 0);\n\n\t\t\t\t\tforeach($ingredients as $ingredient){\n\t\t\t\t\t\t$slot = -1;\n\t\t\t\t\t\tforeach($this->inventory->getContents() as $index => $item){\n\t\t\t\t\t\t\tif($ingredient->getId() !== 0 and $ingredient->deepEquals($item, !$ingredient->hasAnyDamageValue(), $ingredient->hasCompoundTag()) and ($item->getCount() - $used[$index]) >= 1){\n\t\t\t\t\t\t\t\t$slot = $index;\n\t\t\t\t\t\t\t\t$used[$index]++;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif($ingredient->getId() !== 0 and $slot === -1){\n\t\t\t\t\t\t\t$canCraft = false;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!$canCraft){\n\t\t\t\t\t\t$this->server->getLogger()->debug(\"Unmatched recipe \" . $recipe->getId() . \" from player \" . $this->getName() . \": client does not have enough items, using: \" . implode(\", \", $ingredients));\n\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new CraftItemEvent($this, $ingredients, $recipe));\n\n\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t$this->inventory->sendContents($this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tforeach($used as $slot => $count){\n\t\t\t\t\t\tif($count === 0){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$item = $this->inventory->getItem($slot);\n\n\t\t\t\t\t\tif($item->getCount() > $count){\n\t\t\t\t\t\t\t$newItem = clone $item;\n\t\t\t\t\t\t\t$newItem->setCount($item->getCount() - $count);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$newItem = Item::get(Item::AIR, 0, 0);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->inventory->setItem($slot, $newItem);\n\t\t\t\t\t}\n\n\t\t\t\t\t$extraItem = $this->inventory->addItem($recipe->getResult());\n\t\t\t\t\tif(count($extraItem) > 0 and !$this->isCreative()){ //Could not add all the items to our inventory (not enough space)\n\t\t\t\t\t\tforeach($extraItem as $item){\n\t\t\t\t\t\t\t$this->level->dropItem($this, $item);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tswitch($recipe->getResult()->getId()){\n\t\t\t\t\tcase Item::WORKBENCH:\n\t\t\t\t\t\t$this->awardAchievement(\"buildWorkBench\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::WOODEN_PICKAXE:\n\t\t\t\t\t\t$this->awardAchievement(\"buildPickaxe\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::FURNACE:\n\t\t\t\t\t\t$this->awardAchievement(\"buildFurnace\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::WOODEN_HOE:\n\t\t\t\t\t\t$this->awardAchievement(\"buildHoe\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::BREAD:\n\t\t\t\t\t\t$this->awardAchievement(\"makeBread\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::CAKE:\n\t\t\t\t\t\t//TODO: detect complex recipes like cake that leave remains\n\t\t\t\t\t\t$this->awardAchievement(\"bakeCake\");\n\t\t\t\t\t\t$this->inventory->addItem(Item::get(Item::BUCKET, 0, 3));\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::STONE_PICKAXE:\n\t\t\t\t\tcase Item::GOLD_PICKAXE:\n\t\t\t\t\tcase Item::IRON_PICKAXE:\n\t\t\t\t\tcase Item::DIAMOND_PICKAXE:\n\t\t\t\t\t\t$this->awardAchievement(\"buildBetterPickaxe\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::WOODEN_SWORD:\n\t\t\t\t\t\t$this->awardAchievement(\"buildSword\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Item::DIAMOND:\n\t\t\t\t\t\t$this->awardAchievement(\"diamond\");\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\tcase ProtocolInfo::CONTAINER_SET_SLOT_PACKET:\n\t\t\t\tif($this->spawned === false or $this->blocked === true or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif($packet->slot < 0){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif($packet->windowid === 0){ //Our inventory\n\t\t\t\t\tif($packet->slot >= $this->inventory->getSize()){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$transaction = new BaseTransaction($this->inventory, $packet->slot, $packet->item);\n\t\t\t\t}elseif($packet->windowid === ContainerSetContentPacket::SPECIAL_ARMOR){ //Our armor\n\t\t\t\t\tif($packet->slot >= 4){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\t$transaction = new BaseTransaction($this->inventory, $packet->slot + $this->inventory->getSize(), $packet->item);\n\t\t\t\t}elseif(isset($this->windowIndex[$packet->windowid])){\n\t\t\t\t\t//Transaction for non-player-inventory window, such as anvil, chest, etc.\n\n\t\t\t\t\t$inv = $this->windowIndex[$packet->windowid];\n\t\t\t\t\t$achievements = [];\n\n\t\t\t\t\tif($inv instanceof FurnaceInventory and $inv->getItem($packet->slot)->getId() === Item::IRON_INGOT and $packet->slot === FurnaceInventory::RESULT){\n\t\t\t\t\t\t$achievements[] = \"acquireIron\";\n\n\t\t\t\t\t}elseif($inv instanceof EnchantInventory and $packet->item->hasEnchantments()){\n\t\t\t\t\t\t$inv->onEnchant($this, $inv->getItem($packet->slot), $packet->item);\n\t\t\t\t\t}\n\n\t\t\t\t\t$transaction = new BaseTransaction($inv, $packet->slot, $packet->item, $achievements);\n\t\t\t\t}else{\n\t\t\t\t\t//Client sent a transaction for a window which the server doesn't think they have open\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$this->getTransactionQueue()->addTransaction($transaction);\n\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::BLOCK_ENTITY_DATA_PACKET:\n\t\t\t\tif($this->spawned === false or $this->blocked === true or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$this->craftingType = self::CRAFTING_SMALL;\n\n\t\t\t\t$pos = new Vector3($packet->x, $packet->y, $packet->z);\n\t\t\t\tif($pos->distanceSquared($this) > 10000){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\t$t = $this->level->getTile($pos);\n\t\t\t\tif($t instanceof Spawnable){\n\t\t\t\t\t$nbt = new NBT(NBT::LITTLE_ENDIAN);\n\t\t\t\t\t$nbt->read($packet->namedtag, false, true);\n\t\t\t\t\t$nbt = $nbt->getData();\n\t\t\t\t\tif(!$t->updateCompoundTag($nbt, $this)){\n\t\t\t\t\t\t$t->spawnTo($this);\n\t\t\t\t\t}\n\t\t\t\t} else if ($t instanceof Sign){\n                    $nbt = new NBT(NBT::LITTLE_ENDIAN);\n                    $nbt->read($packet->namedtag);\n                    $nbt = $nbt->getData();\n                    if($nbt[\"id\"] !== Tile::SIGN){\n                        $t->spawnTo($this);\n                    }else{\n                        $ev = new SignChangeEvent($t->getBlock(), $this, [\n                            TextFormat::clean($nbt[\"Text1\"], $this->removeFormat), TextFormat::clean($nbt[\"Text2\"], $this->removeFormat), TextFormat::clean($nbt[\"Text3\"], $this->removeFormat), TextFormat::clean($nbt[\"Text4\"], $this->removeFormat)\n                        ]);\n                        if(!isset($t->namedtag->Creator) or $t->namedtag[\"Creator\"] !== $this->getRawUniqueId()){\n                            $ev->setCancelled();\n                        }\n                        $this->server->getPluginManager()->callEvent($ev);\n                        if(!$ev->isCancelled()){\n                            $t->setText($ev->getLine(0), $ev->getLine(1), $ev->getLine(2), $ev->getLine(3));\n                        }else{\n                            $t->spawnTo($this);\n                        }\n                    }\n                }\n\n                break;\n\t\t\tcase ProtocolInfo::SET_PLAYER_GAME_TYPE_PACKET:\n\t\t\t\tif($packet->gamemode !== ($this->gamemode & 0x01)){\n\t\t\t\t\t//GUI gamemode change, set it back to original for now (only possible through client bug or hack with current allowed client permissions)\n\t\t\t\t\t$pk = new SetPlayerGameTypePacket();\n\t\t\t\t\t$pk->gamemode = $this->gamemode & 0x01;\n\t\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t\t$this->sendSettings();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase ProtocolInfo::ITEM_FRAME_DROP_ITEM_PACKET:\n\t\t\t\tif($this->spawned === false or $this->blocked === true or !$this->isAlive()){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif(($tile = $this->level->getTile($this->temporalVector->setComponents($packet->x, $packet->y, $packet->z))) instanceof ItemFrame){\n\t\t\t\t\tif(!$tile->getItem()->equals($packet->item) and !$this->isCreative(true)){\n\t\t\t\t\t\t$tile->spawnTo($this);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(lcg_value() <= $tile->getItemDropChance() and $packet->item->getId() !== Item::AIR){\n\t\t\t\t\t\t$this->level->dropItem($tile->getBlock(), $packet->item); //Use the packet item to handle creative drops correctly\n\t\t\t\t\t}\n\t\t\t\t\t$tile->setItem(null);\n\t\t\t\t\t$tile->setItemRotation(0);\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$timings->stopTiming();\n\t}\n\n\t/**\n\t * Kicks a player from the server\n\t *\n\t * @param string $reason\n\t * @param bool   $isAdmin\n\t *\n\t * @return bool\n\t */\n\tpublic function kick($reason = \"\", $isAdmin = true){\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerKickEvent($this, $reason, $this->getLeaveMessage()));\n\t\tif(!$ev->isCancelled()){\n\t\t\tif($isAdmin){\n\t\t\t\t$message = \"Kicked by admin.\" . ($reason !== \"\" ? \" Reason: \" . $reason : \"\");\n\t\t\t}else{\n\t\t\t\tif($reason === \"\"){\n\t\t\t\t\t$message = \"disconnectionScreen.noReason\";\n\t\t\t\t}else{\n\t\t\t\t\t$message = $reason;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->close($ev->getQuitMessage(), $message);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param Item $item\n\t *\n\t * Drops the specified item in front of the player.\n\t */\n\tpublic function dropItem(Item $item){\n\t\tif($this->spawned === false or $this->blocked === true or !$this->isAlive()){\n\t\t\treturn;\n\t\t}\n\n\t\tif(($this->isCreative() and $this->server->limitedCreative) or $this->isSpectator()){\n\t\t\t//Ignore for limited creative\n\t\t\treturn;\n\t\t}\n\n\t\tif($item->getId() === Item::AIR or $item->getCount() < 1){\n\t\t\t//Ignore dropping air or items with bad counts\n\t\t\treturn;\n\t\t}\n\n\t\t$ev = new PlayerDropItemEvent($this, $item);\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\tif($ev->isCancelled()){\n\t\t\t$this->getFloatingInventory()->removeItem($item);\n\t\t\t$this->getInventory()->addItem($item);\n\t\t\treturn;\n\t\t}\n\n\t\t$motion = $this->getDirectionVector()->multiply(0.4);\n\n\t\t$this->level->dropItem($this->add(0, 1.3, 0), $item, $motion, 40);\n\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ACTION, false);\n\t}\n\n\t/**\n\t * Sends a direct chat message to a player\n\t *\n\t * @param string|TextContainer $message\n\t * @return bool\n\t */\n\tpublic function sendMessage($message){\n\n\t\tif($message instanceof TextContainer){\n\n\t\t\tif($message instanceof TranslationContainer){\n\t\t\t\t$this->sendTranslation($message->getText(), $message->getParameters());\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$message = $message->getText();\n\n\t\t}\n\n\t\t$mes = explode(\"\\n\", $this->server->getLanguage()->translateString($message));\n\n\t\tforeach($mes as $m){\n\t\t\tif($m !== \"\"){\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerTextPreSendEvent($this, $m, PlayerTextPreSendEvent::MESSAGE));\n\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t$pk = new TextPacket();\n\t\t\t\t\t$pk->type = TextPacket::TYPE_RAW;\n\t\t\t\t\t$pk->message = $ev->getMessage();\n\t\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function sendTranslation($message, array $parameters = []){\n\t\t$pk = new TextPacket();\n\t\tif(!$this->server->isLanguageForced()){\n\t\t\t$pk->type = TextPacket::TYPE_TRANSLATION;\n\t\t\t$pk->message = $this->server->getLanguage()->translateString($message, $parameters, \"pocketmine.\");\n\t\t\tforeach($parameters as $i => $p){\n\t\t\t\t$parameters[$i] = $this->server->getLanguage()->translateString($p, $parameters, \"pocketmine.\");\n\t\t\t}\n\t\t\t$pk->parameters = $parameters;\n\t\t}else{\n\t\t\t$pk->type = TextPacket::TYPE_RAW;\n\t\t\t$pk->message = $this->server->getLanguage()->translateString($message, $parameters);\n\t\t}\n\n\t\t$ev = new PlayerTextPreSendEvent($this, $pk->message, PlayerTextPreSendEvent::TRANSLATED_MESSAGE);\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\tif(!$ev->isCancelled()){\n\t\t\t$this->dataPacket($pk);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function sendPopup($message, $subtitle = \"\"){\n\t\t$ev = new PlayerTextPreSendEvent($this, $message, PlayerTextPreSendEvent::POPUP);\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\tif(!$ev->isCancelled()){\n\t\t\t$pk = new TextPacket();\n\t\t\t$pk->type = TextPacket::TYPE_POPUP;\n\t\t\t$pk->source = $ev->getMessage();\n\t\t\t$pk->message = $subtitle;\n\t\t\t$this->dataPacket($pk);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param $message\n\t * @return bool\n\t */\n\tpublic function sendTip($message){\n\t\t$ev = new PlayerTextPreSendEvent($this, $message, PlayerTextPreSendEvent::TIP);\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\tif(!$ev->isCancelled()){\n\t\t\t$pk = new TextPacket();\n\t\t\t$pk->type = TextPacket::TYPE_TIP;\n\t\t\t$pk->message = $ev->getMessage();\n\t\t\t$this->dataPacket($pk);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Note for plugin developers: use kick() with the isAdmin\n\t * flag set to kick without the \"Kicked by admin\" part instead of this method.\n\t *\n\t * @param string $message Message to be broadcasted\n\t * @param string $reason Reason showed in console\n\t * @param bool   $notify\n\t */\n\tpublic final function close($message = \"\", $reason = \"generic reason\", $notify = true){\n\t\tif($this->connected and !$this->closed){\n\t\t\tif($notify and strlen((string) $reason) > 0){\n\t\t\t\t$pk = new DisconnectPacket;\n\t\t\t\t$pk->message = $reason;\n\t\t\t\t$this->directDataPacket($pk);\n\t\t\t}\n\n\t\t\t//$this->setLinked();\n\n\t\t\tif($this->fishingHook instanceof FishingHook){\n\t\t\t\t$this->fishingHook->close();\n\t\t\t\t$this->fishingHook = null;\n\t\t\t}\n\n\t\t\t$this->removeEffect(Effect::HEALTH_BOOST);\n\n\t\t\t$this->connected = false;\n\t\t\tif(strlen($this->getName()) > 0){\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerQuitEvent($this, $message, true));\n\t\t\t\tif($this->loggedIn === true and $ev->getAutoSave()){\n\t\t\t\t\t$this->save();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tforeach($this->server->getOnlinePlayers() as $player){\n\t\t\t\tif(!$player->canSee($this)){\n\t\t\t\t\t$player->showPlayer($this);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->hiddenPlayers = [];\n\n\t\t\tforeach($this->windowIndex as $window){\n\t\t\t\t$this->removeWindow($window);\n\t\t\t}\n\n\t\t\tforeach($this->usedChunks as $index => $d){\n\t\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\t\t\t\t$this->level->unregisterChunkLoader($this, $chunkX, $chunkZ);\n\t\t\t\tunset($this->usedChunks[$index]);\n\t\t\t}\n\n\t\t\tparent::close();\n\n\t\t\t$this->interface->close($this, $notify ? $reason : \"\");\n\n\t\t\tif($this->loggedIn){\n\t\t\t\t$this->server->removeOnlinePlayer($this);\n\t\t\t}\n\n\t\t\t$this->loggedIn = false;\n\n\t\t\tif(isset($ev) and $this->username != \"\" and $this->spawned !== false and $ev->getQuitMessage() != \"\"){\n\t\t\t\tif($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_MESSAGE) $this->server->broadcastMessage($ev->getQuitMessage());\n\t\t\t\telseif($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_TIP) $this->server->broadcastTip(str_replace(\"@player\", $this->getName(), $this->server->playerLogoutMsg));\n\t\t\t\telseif($this->server->playerMsgType === Server::PLAYER_MSG_TYPE_POPUP) $this->server->broadcastPopup(str_replace(\"@player\", $this->getName(), $this->server->playerLogoutMsg));\n\t\t\t}\n\n\t\t\t$this->server->getPluginManager()->unsubscribeFromPermission(Server::BROADCAST_CHANNEL_USERS, $this);\n\t\t\t$this->spawned = false;\n\t\t\t$this->server->getLogger()->info($this->getServer()->getLanguage()->translateString(\"pocketmine.player.logOut\", [\n\t\t\t\tTextFormat::AQUA . $this->getName() . TextFormat::WHITE,\n\t\t\t\t$this->ip,\n\t\t\t\t$this->port,\n\t\t\t\t$this->getServer()->getLanguage()->translateString($reason)\n\t\t\t]));\n\t\t\t$this->windows = new \\SplObjectStorage();\n\t\t\t$this->windowIndex = [];\n\t\t\t$this->usedChunks = [];\n\t\t\t$this->loadQueue = [];\n\t\t\t$this->hasSpawned = [];\n\t\t\t$this->spawnPosition = null;\n\t\t\tunset($this->buffer);\n\n\t\t\tif($this->server->dserverConfig[\"enable\"] and $this->server->dserverConfig[\"queryAutoUpdate\"]) $this->server->updateQuery();\n\t\t}\n\n\t\tif($this->perm !== null){\n\t\t\t$this->perm->clearPermissions();\n\t\t\t$this->perm = null;\n\t\t}\n\n\t\t$this->inventory = null;\n\t\t$this->transactionQueue = null;\n\n\t\t$this->chunk = null;\n\n\t\t$this->server->removePlayer($this);\n\t}\n\n\tpublic function __debugInfo(){\n\t\treturn [];\n\t}\n\n\t/**\n\t * Handles player data saving\n\t */\n\tpublic function save($async = false){\n\t\tif($this->closed){\n\t\t\tthrow new \\InvalidStateException(\"Tried to save closed player\");\n\t\t}\n\n\t\tparent::saveNBT();\n\t\tif($this->level instanceof Level){\n\t\t\t$this->namedtag->Level = new StringTag(\"Level\", $this->level->getName());\n\t\t\tif($this->hasValidSpawnPosition()){\n\t\t\t\t$this->namedtag[\"SpawnLevel\"] = $this->spawnPosition->getLevel()->getName();\n\t\t\t\t$this->namedtag[\"SpawnX\"] = (int) $this->spawnPosition->x;\n\t\t\t\t$this->namedtag[\"SpawnY\"] = (int) $this->spawnPosition->y;\n\t\t\t\t$this->namedtag[\"SpawnZ\"] = (int) $this->spawnPosition->z;\n\t\t\t}\n\n\t\t\tforeach($this->achievements as $achievement => $status){\n\t\t\t\t$this->namedtag->Achievements[$achievement] = new ByteTag($achievement, $status === true ? 1 : 0);\n\t\t\t}\n\n\t\t\t$this->namedtag[\"playerGameType\"] = $this->gamemode;\n\t\t\t$this->namedtag[\"lastPlayed\"] = new LongTag(\"lastPlayed\", floor(microtime(true) * 1000));\n\t\t\t$this->namedtag[\"Hunger\"] = new ShortTag(\"Hunger\", $this->food);\n\t\t\t$this->namedtag[\"Health\"] = new ShortTag(\"Health\", $this->getHealth());\n\t\t\t$this->namedtag[\"MaxHealth\"] = new ShortTag(\"MaxHealth\", $this->getMaxHealth());\n\t\t\t$this->namedtag[\"Experience\"] = new LongTag(\"Experience\", $this->exp);\n\t\t\t$this->namedtag[\"ExpLevel\"] = new LongTag(\"ExpLevel\", $this->expLevel);\n\n\t\t\tif($this->username != \"\" and $this->namedtag instanceof CompoundTag){\n\t\t\t\t$this->server->saveOfflinePlayerData($this->username, $this->namedtag, $async);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Gets the username\n\t *\n\t * @return string\n\t */\n\tpublic function getName(){\n\t\treturn $this->username;\n\t}\n\n\tpublic function kill(){\n\t\tif(!$this->spawned){\n\t\t\treturn;\n\t\t}\n\n\t\t$message = \"death.attack.generic\";\n\n\t\t$params = [\n\t\t\t$this->getDisplayName()\n\t\t];\n\n\t\t$cause = $this->getLastDamageCause();\n\n\t\tswitch($cause === null ? EntityDamageEvent::CAUSE_CUSTOM : $cause->getCause()){\n\t\t\tcase EntityDamageEvent::CAUSE_ENTITY_ATTACK:\n\t\t\t\tif($cause instanceof EntityDamageByEntityEvent){\n\t\t\t\t\t$e = $cause->getDamager();\n\t\t\t\t\tif($e instanceof Player){\n\t\t\t\t\t\t$message = \"death.attack.player\";\n\t\t\t\t\t\t$params[] = $e->getDisplayName();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}elseif($e instanceof Living){\n\t\t\t\t\t\t$message = \"death.attack.mob\";\n\t\t\t\t\t\t$params[] = $e->getNameTag() !== \"\" ? $e->getNameTag() : $e->getName();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$params[] = \"Unknown\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase EntityDamageEvent::CAUSE_PROJECTILE:\n\t\t\t\tif($cause instanceof EntityDamageByEntityEvent){\n\t\t\t\t\t$e = $cause->getDamager();\n\t\t\t\t\tif($e instanceof Player){\n\t\t\t\t\t\t$message = \"death.attack.arrow\";\n\t\t\t\t\t\t$params[] = $e->getDisplayName();\n\t\t\t\t\t}elseif($e instanceof Living){\n\t\t\t\t\t\t$message = \"death.attack.arrow\";\n\t\t\t\t\t\t$params[] = $e->getNameTag() !== \"\" ? $e->getNameTag() : $e->getName();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$params[] = \"Unknown\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase EntityDamageEvent::CAUSE_SUICIDE:\n\t\t\t\t$message = \"death.attack.generic\";\n\t\t\t\tbreak;\n\t\t\tcase EntityDamageEvent::CAUSE_VOID:\n\t\t\t\t$message = \"death.attack.outOfWorld\";\n\t\t\t\tbreak;\n\t\t\tcase EntityDamageEvent::CAUSE_FALL:\n\t\t\t\tif($cause instanceof EntityDamageEvent){\n\t\t\t\t\tif($cause->getFinalDamage() > 2){\n\t\t\t\t\t\t$message = \"death.fell.accident.generic\";\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$message = \"death.attack.fall\";\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_SUFFOCATION:\n\t\t\t\t$message = \"death.attack.inWall\";\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_LAVA:\n\t\t\t\t$message = \"death.attack.lava\";\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_FIRE:\n\t\t\t\t$message = \"death.attack.onFire\";\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_FIRE_TICK:\n\t\t\t\t$message = \"death.attack.inFire\";\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_DROWNING:\n\t\t\t\t$message = \"death.attack.drown\";\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_CONTACT:\n\t\t\t\tif($cause instanceof EntityDamageByBlockEvent){\n\t\t\t\t\tif($cause->getDamager()->getId() === Block::CACTUS){\n\t\t\t\t\t\t$message = \"death.attack.cactus\";\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_BLOCK_EXPLOSION:\n\t\t\tcase EntityDamageEvent::CAUSE_ENTITY_EXPLOSION:\n\t\t\t\tif($cause instanceof EntityDamageByEntityEvent){\n\t\t\t\t\t$e = $cause->getDamager();\n\t\t\t\t\tif($e instanceof Player){\n\t\t\t\t\t\t$message = \"death.attack.explosion.player\";\n\t\t\t\t\t\t$params[] = $e->getDisplayName();\n\t\t\t\t\t}elseif($e instanceof Living){\n\t\t\t\t\t\t$message = \"death.attack.explosion.player\";\n\t\t\t\t\t\t$params[] = $e->getNameTag() !== \"\" ? $e->getNameTag() : $e->getName();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t$message = \"death.attack.explosion\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_MAGIC:\n\t\t\t\t$message = \"death.attack.magic\";\n\t\t\t\tbreak;\n\n\t\t\tcase EntityDamageEvent::CAUSE_CUSTOM:\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\n\t\t}\n\n\t\tEntity::kill();\n\n\t\t$ev = new PlayerDeathEvent($this, $this->getDrops(), new TranslationContainer($message, $params));\n\t\t$ev->setKeepInventory($this->server->keepInventory);\n\t\t$ev->setKeepExperience($this->server->keepExperience);\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\n\t\tif(!$ev->getKeepInventory()){\n\t\t\tforeach($ev->getDrops() as $item){\n\t\t\t\t$this->level->dropItem($this, $item);\n\t\t\t}\n\n\t\t\tif($this->inventory !== null){\n\t\t\t\t$this->inventory->clearAll();\n\t\t\t}\n\t\t}\n\n\t\tif($this->server->expEnabled and !$ev->getKeepExperience()){\n\t\t\t$exp = min(91, $this->getTotalXp()); //Max 7 levels of exp dropped\n\t\t\t$this->getLevel()->spawnXPOrb($this->add(0, 0.2, 0), $exp);\n\t\t\t$this->setTotalXp(0, true);\n\t\t}\n\n\t\tif($ev->getDeathMessage() != \"\"){\n\t\t\t$this->server->broadcast($ev->getDeathMessage(), Server::BROADCAST_CHANNEL_USERS);\n\t\t}\n\n\t\t$pos = $this->getSpawn();\n\n\t\t$this->setHealth(0);\n\n\t\t$pk = new RespawnPacket();\n\t\t$pk->x = $pos->x;\n\t\t$pk->y = $pos->y;\n\t\t$pk->z = $pos->z;\n\t\t$this->dataPacket($pk);\n\t}\n\n\tpublic function setHealth($amount){\n\t\tparent::setHealth($amount);\n\t\tif($this->spawned === true){\n\t\t\t$this->foodTick = 0;\n\t\t\t$this->getAttributeMap()->getAttribute(Attribute::HEALTH)->setMaxValue($this->getMaxHealth())->setValue($amount, true);\n\t\t}\n\t}\n\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tif(!$this->isAlive()){\n\t\t\treturn;\n\t\t}\n\n\t\tif($this->isCreative()\n\t\t\tand $source->getCause() !== EntityDamageEvent::CAUSE_MAGIC\n\t\t\tand $source->getCause() !== EntityDamageEvent::CAUSE_SUICIDE\n\t\t\tand $source->getCause() !== EntityDamageEvent::CAUSE_VOID\n\t\t){\n\t\t\t$source->setCancelled();\n\t\t}elseif($this->allowFlight and $source->getCause() === EntityDamageEvent::CAUSE_FALL){\n\t\t\t$source->setCancelled();\n\t\t}\n\n\t\tparent::attack($damage, $source);\n\n\t\tif($source->isCancelled()){\n\t\t\treturn;\n\t\t}elseif($this->getLastDamageCause() === $source and $this->spawned){\n\t\t\t$pk = new EntityEventPacket();\n\t\t\t$pk->eid = 0;\n\t\t\t$pk->event = EntityEventPacket::HURT_ANIMATION;\n\t\t\t$this->dataPacket($pk);\n\n\t\t\tif($this->isSurvival()){\n\t\t\t\t$this->exhaust(0.3, PlayerExhaustEvent::CAUSE_DAMAGE);\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function sendPosition(Vector3 $pos, $yaw = null, $pitch = null, $mode = MovePlayerPacket::MODE_NORMAL, array $targets = null){\n\t\t$yaw = $yaw === null ? $this->yaw : $yaw;\n\t\t$pitch = $pitch === null ? $this->pitch : $pitch;\n\n\t\t$pk = new MovePlayerPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $pos->x;\n\t\t$pk->y = $pos->y + $this->getEyeHeight();\n\t\t$pk->z = $pos->z;\n\t\t$pk->bodyYaw = $yaw;\n\t\t$pk->pitch = $pitch;\n\t\t$pk->yaw = $yaw;\n\t\t$pk->mode = $mode;\n\n\t\tif($targets !== null){\n\t\t\t$this->server->broadcastPacket($targets, $pk);\n\t\t}else{\n\t\t\t$pk->eid = 0;\n\t\t\t$this->dataPacket($pk);\n\t\t}\n\t}\n\n\tprotected function checkChunks(){\n\t\tif($this->chunk === null or ($this->chunk->getX() !== ($this->x >> 4) or $this->chunk->getZ() !== ($this->z >> 4))){\n\t\t\tif($this->chunk !== null){\n\t\t\t\t$this->chunk->removeEntity($this);\n\t\t\t}\n\t\t\t$this->chunk = $this->level->getChunk($this->x >> 4, $this->z >> 4, true);\n\n\t\t\tif(!$this->justCreated){\n\t\t\t\t$newChunk = $this->level->getChunkPlayers($this->x >> 4, $this->z >> 4);\n\t\t\t\tunset($newChunk[$this->getLoaderId()]);\n\n\t\t\t\t/** @var Player[] $reload */\n\t\t\t\t$reload = [];\n\t\t\t\tforeach($this->hasSpawned as $player){\n\t\t\t\t\tif(!isset($newChunk[$player->getLoaderId()])){\n\t\t\t\t\t\t$this->despawnFrom($player);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tunset($newChunk[$player->getLoaderId()]);\n\t\t\t\t\t\t$reload[] = $player;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tforeach($newChunk as $player){\n\t\t\t\t\t$this->spawnTo($player);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($this->chunk === null){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$this->chunk->addEntity($this);\n\t\t}\n\t}\n\n\tprotected function checkTeleportPosition(){\n\t\tif($this->teleportPosition !== null){\n\t\t\t$chunkX = $this->teleportPosition->x >> 4;\n\t\t\t$chunkZ = $this->teleportPosition->z >> 4;\n\n\t\t\tfor($X = -1; $X <= 1; ++$X){\n\t\t\t\tfor($Z = -1; $Z <= 1; ++$Z){\n\t\t\t\t\tif(!isset($this->usedChunks[$index = Level::chunkHash($chunkX + $X, $chunkZ + $Z)]) or $this->usedChunks[$index] === false){\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->sendPosition($this, null, null, MovePlayerPacket::MODE_RESET);\n\t\t\t$this->spawnToAll();\n\t\t\t$this->forceMovement = $this->teleportPosition;\n\t\t\t$this->teleportPosition = null;\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param Vector3|Position|Location $pos\n\t * @param float                     $yaw\n\t * @param float                     $pitch\n\t *\n\t * @return bool\n\t */\n\tpublic function teleport(Vector3 $pos, $yaw = null, $pitch = null){\n\t\tif(!$this->isOnline()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$oldPos = $this->getPosition();\n\t\tif(parent::teleport($pos, $yaw, $pitch)){\n\n\t\t\tforeach($this->windowIndex as $window){\n\t\t\t\tif($window === $this->inventory){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$this->removeWindow($window);\n\t\t\t}\n\n\t\t\t$this->teleportPosition = new Vector3($this->x, $this->y, $this->z);\n\n\t\t\tif(!$this->checkTeleportPosition()){\n\t\t\t\t$this->forceMovement = $oldPos;\n\t\t\t}else{\n\t\t\t\t$this->spawnToAll();\n\t\t\t}\n\n\n\t\t\t$this->resetFallDistance();\n\t\t\t$this->nextChunkOrderRun = 0;\n\t\t\t$this->newPosition = null;\n\t\t\t$this->stopSleep();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This method may not be reliable. Clients don't like to be moved into unloaded chunks.\n\t * Use teleport() for a delayed teleport after chunks have been sent.\n\t *\n\t * @param Vector3 $pos\n\t * @param float   $yaw\n\t * @param float   $pitch\n\t */\n\tpublic function teleportImmediate(Vector3 $pos, $yaw = null, $pitch = null){\n\t\tif(parent::teleport($pos, $yaw, $pitch)){\n\n\t\t\tforeach($this->windowIndex as $window){\n\t\t\t\tif($window === $this->inventory){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$this->removeWindow($window);\n\t\t\t}\n\n\t\t\t$this->forceMovement = new Vector3($this->x, $this->y, $this->z);\n\t\t\t$this->sendPosition($this, $this->yaw, $this->pitch, MovePlayerPacket::MODE_RESET);\n\n\n\t\t\t$this->resetFallDistance();\n\t\t\t$this->orderChunks();\n\t\t\t$this->nextChunkOrderRun = 0;\n\t\t\t$this->newPosition = null;\n\t\t}\n\t}\n\n\n\t/**\n\t * @param Inventory $inventory\n\t *\n\t * @return int\n\t */\n\tpublic function getWindowId(Inventory $inventory) : int{\n\t\tif($this->windows->contains($inventory)){\n\t\t\treturn $this->windows[$inventory];\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t * Returns the created/existing window id\n\t *\n\t * @param Inventory $inventory\n\t * @param int       $forceId\n\t *\n\t * @return int\n\t */\n\tpublic function addWindow(Inventory $inventory, $forceId = null) : int{\n\t\tif($this->windows->contains($inventory)){\n\t\t\treturn $this->windows[$inventory];\n\t\t}\n\n\t\tif($forceId === null){\n\t\t\t$this->windowCnt = $cnt = max(2, ++$this->windowCnt % 99);\n\t\t}else{\n\t\t\t$cnt = (int) $forceId;\n\t\t}\n\t\t$this->windowIndex[$cnt] = $inventory;\n\t\t$this->windows->attach($inventory, $cnt);\n\t\tif($inventory->open($this)){\n\t\t\treturn $cnt;\n\t\t}else{\n\t\t\t$this->removeWindow($inventory);\n\n\t\t\treturn -1;\n\t\t}\n\t}\n\n\tpublic function removeWindow(Inventory $inventory){\n\t\t$inventory->close($this);\n\t\tif($this->windows->contains($inventory)){\n\t\t\t$id = $this->windows[$inventory];\n\t\t\t$this->windows->detach($this->windowIndex[$id]);\n\t\t\tunset($this->windowIndex[$id]);\n\t\t}\n\t}\n\n\tpublic function setMetadata($metadataKey, MetadataValue $metadataValue){\n\t\t$this->server->getPlayerMetadata()->setMetadata($this, $metadataKey, $metadataValue);\n\t}\n\n\tpublic function getMetadata($metadataKey){\n\t\treturn $this->server->getPlayerMetadata()->getMetadata($this, $metadataKey);\n\t}\n\n\tpublic function hasMetadata($metadataKey){\n\t\treturn $this->server->getPlayerMetadata()->hasMetadata($this, $metadataKey);\n\t}\n\n\tpublic function removeMetadata($metadataKey, Plugin $plugin){\n\t\t$this->server->getPlayerMetadata()->removeMetadata($this, $metadataKey, $plugin);\n\t}\n\n\tpublic function onChunkChanged(Chunk $chunk){\n\t\t$this->loadQueue[Level::chunkHash($chunk->getX(), $chunk->getZ())] = abs(($this->x >> 4) - $chunk->getX()) + abs(($this->z >> 4) - $chunk->getZ());\n\t}\n\n\tpublic function onChunkLoaded(Chunk $chunk){\n\t}\n\n\tpublic function onChunkPopulated(Chunk $chunk){\n\t}\n\n\tpublic function onChunkUnloaded(Chunk $chunk){\n\t}\n\n\tpublic function onBlockChanged(Vector3 $block){\n\n\t}\n\n\tpublic function getLoaderId(){\n\t\treturn $this->loaderId;\n\t}\n\n\tpublic function isLoaderActive(){\n\t\treturn $this->isConnected();\n\t}\n\n\t/**\n\t * @param $chunkX\n\t * @param $chunkZ\n\t * @param $payload\n\t *\n\t * @return BatchPacket|FullChunkDataPacket\n\t */\n\tpublic static function getChunkCacheFromData($chunkX, $chunkZ, $payload){\n\t\t$pk = new FullChunkDataPacket();\n\t\t$pk->chunkX = $chunkX;\n\t\t$pk->chunkZ = $chunkZ;\n\t\t$pk->data = $payload;\n\t\tif(Network::$BATCH_THRESHOLD >= 0){\n\t\t\t$pk->encode();\n\t\t\t$batch = new BatchPacket();\n\t\t\t$batch->payload = zlib_encode(Binary::writeUnsignedVarInt(strlen($pk->getBuffer())) . $pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel);\n\t\t\t$batch->encode();\n\t\t\t$batch->isEncoded = true;\n\t\t\treturn $batch;\n\t\t}\n\t\treturn $pk;\n\t}\n\n\t/**\n\t * @param Effect\n\t*/\n\tpublic function addEffect(Effect $effect){//Overwrite\n\t\tif($effect->isBad() && $this->isCreative()){\n\t\t\treturn;\n\t\t}\n\n\t\tparent::addEffect($effect);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/PocketMine.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace {\n\tfunction safe_var_dump(){\n\t\tstatic $cnt = 0;\n\t\tforeach(func_get_args() as $var){\n\t\t\tswitch(true){\n\t\t\t\tcase is_array($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"array(\" . count($var) . \") {\" . PHP_EOL;\n\t\t\t\t\tforeach($var as $key => $value){\n\t\t\t\t\t\techo str_repeat(\"  \", $cnt + 1) . \"[\" . (is_integer($key) ? $key : '\"' . $key . '\"') . \"]=>\" . PHP_EOL;\n\t\t\t\t\t\t++$cnt;\n\t\t\t\t\t\tsafe_var_dump($value);\n\t\t\t\t\t\t--$cnt;\n\t\t\t\t\t}\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"}\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase is_int($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"int(\" . $var . \")\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase is_float($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"float(\" . $var . \")\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase is_bool($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"bool(\" . ($var === true ? \"true\" : \"false\") . \")\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase is_string($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"string(\" . strlen($var) . \") \\\"$var\\\"\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase is_resource($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"resource() of type (\" . get_resource_type($var) . \")\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase is_object($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"object(\" . get_class($var) . \")\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t\tcase is_null($var):\n\t\t\t\t\techo str_repeat(\"  \", $cnt) . \"NULL\" . PHP_EOL;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tfunction dummy(){\n\n\t}\n}\n\nnamespace pocketmine {\n\tuse pocketmine\\utils\\Binary;\n\tuse pocketmine\\utils\\MainLogger;\n\tuse pocketmine\\utils\\ServerKiller;\n\tuse pocketmine\\utils\\Terminal;\n\tuse pocketmine\\utils\\Utils;\n\tuse pocketmine\\wizard\\Installer;\n\n\tconst VERSION = \"1.0\";\n\tconst API_VERSION = \"3.0.0-ALPHA1\";\n\tconst CODENAME = \"Birpen\";\n\tconst MINECRAFT_VERSION = \"v1.0.0 alpha\";\n\tconst MINECRAFT_VERSION_NETWORK = \"1.0.0\";\n\tconst GENISYS_API_VERSION = '1.9.3';\n\n\t/*\n\t * Startup code. Do not look at it, it may harm you.\n\t * Most of them are hacks to fix date-related bugs, or basic functions used after this\n\t * This is the only non-class based file on this project.\n\t * Enjoy it as much as I did writing it. I don't want to do it again.\n\t */\n\n\tif(\\Phar::running(true) !== \"\"){\n\t\t@define('pocketmine\\PATH', \\Phar::running(true) . \"/\");\n\t}else{\n\t\t@define('pocketmine\\PATH', \\getcwd() . DIRECTORY_SEPARATOR);\n\t}\n\n\tif(version_compare(\"7.0\", PHP_VERSION) > 0){\n\t\techo \"[CRITICAL] You must use PHP >= 7.0\" . PHP_EOL;\n\t\techo \"[CRITICAL] Please use the installer provided on the homepage.\" . PHP_EOL;\n\t\texit(1);\n\t}\n\n\tif(!extension_loaded(\"pthreads\")){\n\t\techo \"[CRITICAL] Unable to find the pthreads extension.\" . PHP_EOL;\n\t\techo \"[CRITICAL] Please use the installer provided on the homepage.\" . PHP_EOL;\n\t\texit(1);\n\t}\n\n\tif(!class_exists(\"ClassLoader\", false)){\n\t\trequire_once(\\pocketmine\\PATH . \"src/spl/ClassLoader.php\");\n\t\trequire_once(\\pocketmine\\PATH . \"src/spl/BaseClassLoader.php\");\n\t\trequire_once(\\pocketmine\\PATH . \"src/pocketmine/CompatibleClassLoader.php\");\n\t}\n\n\t$autoloader = new CompatibleClassLoader();\n\t$autoloader->addPath(\\pocketmine\\PATH . \"src\");\n\t$autoloader->addPath(\\pocketmine\\PATH . \"src\" . DIRECTORY_SEPARATOR . \"spl\");\n\t$autoloader->register(true);\n\n\n\tset_time_limit(0); //Who set it to 30 seconds?!?!\n\n\tgc_enable();\n\terror_reporting(-1);\n\tini_set(\"allow_url_fopen\", 1);\n\tini_set(\"display_errors\", 1);\n\tini_set(\"display_startup_errors\", 1);\n\tini_set(\"default_charset\", \"utf-8\");\n\n\tini_set(\"memory_limit\", -1);\n\tdefine('pocketmine\\START_TIME', microtime(true));\n\n\t$opts = getopt(\"\", [\"data:\", \"plugins:\", \"no-wizard\", \"enable-profiler\"]);\n\n\tdefine('pocketmine\\DATA', isset($opts[\"data\"]) ? $opts[\"data\"] . DIRECTORY_SEPARATOR : \\getcwd() . DIRECTORY_SEPARATOR);\n\tdefine('pocketmine\\PLUGIN_PATH', isset($opts[\"plugins\"]) ? $opts[\"plugins\"] . DIRECTORY_SEPARATOR : \\getcwd() . DIRECTORY_SEPARATOR . \"plugins\" . DIRECTORY_SEPARATOR);\n\n\tTerminal::init();\n\n\tdefine('pocketmine\\ANSI', Terminal::hasFormattingCodes());\n\n\tif(!file_exists(\\pocketmine\\DATA)){\n\t\tmkdir(\\pocketmine\\DATA, 0777, true);\n\t}\n\n\t//Logger has a dependency on timezone, so we'll set it to UTC until we can get the actual timezone.\n\tdate_default_timezone_set(\"UTC\");\n\n\t$logger = new MainLogger(\\pocketmine\\DATA . \"server.log\", \\pocketmine\\ANSI);\n\n\tif(!ini_get(\"date.timezone\")){\n\t\tif(($timezone = detect_system_timezone()) and date_default_timezone_set($timezone)){\n\t\t\t//Success! Timezone has already been set and validated in the if statement.\n\t\t\t//This here is just for redundancy just in case some program wants to read timezone data from the ini.\n\t\t\tini_set(\"date.timezone\", $timezone);\n\t\t}else{\n\t\t\t//If system timezone detection fails or timezone is an invalid value.\n\t\t\tif($response = Utils::getURL(\"http://ip-api.com/json\")\n\t\t\t\tand $ip_geolocation_data = json_decode($response, true)\n\t\t\t\tand $ip_geolocation_data['status'] !== 'fail'\n\t\t\t\tand date_default_timezone_set($ip_geolocation_data['timezone'])\n\t\t\t){\n\t\t\t\t//Again, for redundancy.\n\t\t\t\tini_set(\"date.timezone\", $ip_geolocation_data['timezone']);\n\t\t\t}else{\n\t\t\t\tini_set(\"date.timezone\", \"UTC\");\n\t\t\t\tdate_default_timezone_set(\"UTC\");\n\t\t\t\t$logger->warning(\"Timezone could not be automatically determined. An incorrect timezone will result in incorrect timestamps on console logs. It has been set to \\\"UTC\\\" by default. You can change it on the php.ini file.\");\n\t\t\t}\n\t\t}\n\t}else{\n\t\t/*\n\t\t * This is here so that people don't come to us complaining and fill up the issue tracker when they put\n\t\t * an incorrect timezone abbreviation in php.ini apparently.\n\t\t */\n\t\t$timezone = ini_get(\"date.timezone\");\n\t\tif(strpos($timezone, \"/\") === false){\n\t\t\t$default_timezone = timezone_name_from_abbr($timezone);\n\t\t\tini_set(\"date.timezone\", $default_timezone);\n\t\t\tdate_default_timezone_set($default_timezone);\n\t\t} else {\n\t\t\tdate_default_timezone_set($timezone);\n\t\t}\n\t}\n\n\tfunction detect_system_timezone(){\n\t\tswitch(Utils::getOS()){\n\t\t\tcase 'win':\n\t\t\t\t$regex = '/(UTC)(\\+*\\-*\\d*\\d*\\:*\\d*\\d*)/';\n\n\t\t\t\t/*\n\t\t\t\t * wmic timezone get Caption\n\t\t\t\t * Get the timezone offset\n\t\t\t\t *\n\t\t\t\t * Sample Output var_dump\n\t\t\t\t * array(3) {\n\t\t\t\t *\t  [0] =>\n\t\t\t\t *\t  string(7) \"Caption\"\n\t\t\t\t *\t  [1] =>\n\t\t\t\t *\t  string(20) \"(UTC+09:30) Adelaide\"\n\t\t\t\t *\t  [2] =>\n\t\t\t\t *\t  string(0) \"\"\n\t\t\t\t *\t}\n\t\t\t\t */\n\t\t\t\texec(\"wmic timezone get Caption\", $output);\n\n\t\t\t\t$string = trim(implode(\"\\n\", $output));\n\n\t\t\t\t//Detect the Time Zone string\n\t\t\t\tpreg_match($regex, $string, $matches);\n\n\t\t\t\tif(!isset($matches[2])){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\n\t\t\t\t$offset = $matches[2];\n\n\t\t\t\tif($offset == \"\"){\n\t\t\t\t\treturn \"UTC\";\n\t\t\t\t}\n\n\t\t\t\treturn parse_offset($offset);\n\t\t\t\tbreak;\n\t\t\tcase 'linux':\n\t\t\t\t// Ubuntu / Debian.\n\t\t\t\tif(file_exists('/etc/timezone')){\n\t\t\t\t\t$data = file_get_contents('/etc/timezone');\n\t\t\t\t\tif($data){\n\t\t\t\t\t\treturn trim($data);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// RHEL / CentOS\n\t\t\t\tif(file_exists('/etc/sysconfig/clock')){\n\t\t\t\t\t$data = parse_ini_file('/etc/sysconfig/clock');\n\t\t\t\t\tif(!empty($data['ZONE'])){\n\t\t\t\t\t\treturn trim($data['ZONE']);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//Portable method for incompatible linux distributions.\n\n\t\t\t\t$offset = trim(exec('date +%:z'));\n\n\t\t\t\tif($offset == \"+00:00\"){\n\t\t\t\t\treturn \"UTC\";\n\t\t\t\t}\n\n\t\t\t\treturn parse_offset($offset);\n\t\t\t\tbreak;\n\t\t\tcase 'mac':\n\t\t\t\tif(is_link('/etc/localtime')){\n\t\t\t\t\t$filename = readlink('/etc/localtime');\n\t\t\t\t\tif(strpos($filename, '/usr/share/zoneinfo/') === 0){\n\t\t\t\t\t\t$timezone = substr($filename, 20);\n\t\t\t\t\t\treturn trim($timezone);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n\t * @param string $offset In the format of +09:00, +02:00, -04:00 etc.\n\t *\n\t * @return string\n\t */\n\tfunction parse_offset($offset){\n\t\t//Make signed offsets unsigned for date_parse\n\t\tif(strpos($offset, '-') !== false){\n\t\t\t$negative_offset = true;\n\t\t\t$offset = str_replace('-', '', $offset);\n\t\t}else{\n\t\t\tif(strpos($offset, '+') !== false){\n\t\t\t\t$negative_offset = false;\n\t\t\t\t$offset = str_replace('+', '', $offset);\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t$parsed = date_parse($offset);\n\t\t$offset = $parsed['hour'] * 3600 + $parsed['minute'] * 60 + $parsed['second'];\n\n\t\t//After date_parse is done, put the sign back\n\t\tif($negative_offset == true){\n\t\t\t$offset = -abs($offset);\n\t\t}\n\n\t\t//And then, look the offset up.\n\t\t//timezone_name_from_abbr is not used because it returns false on some(most) offsets because it's mapping function is weird.\n\t\t//That's been a bug in PHP since 2008!\n\t\tforeach(timezone_abbreviations_list() as $zones){\n\t\t\tforeach($zones as $timezone){\n\t\t\t\tif($timezone['offset'] == $offset){\n\t\t\t\t\treturn $timezone['timezone_id'];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tif(isset($opts[\"enable-profiler\"])){\n\t\tif(function_exists(\"profiler_enable\")){\n\t\t\t\\profiler_enable();\n\t\t\t$logger->notice(\"Execution is being profiled\");\n\t\t}else{\n\t\t\t$logger->notice(\"No profiler found. Please install https://github.com/krakjoe/profiler\");\n\t\t}\n\t}\n\n\tfunction kill($pid){\n\t\tswitch(Utils::getOS()){\n\t\t\tcase \"win\":\n\t\t\t\texec(\"taskkill.exe /F /PID \" . ((int) $pid) . \" > NUL\");\n\t\t\t\tbreak;\n\t\t\tcase \"mac\":\n\t\t\tcase \"linux\":\n\t\t\tdefault:\n\t\t\t\tif(function_exists(\"posix_kill\")){\n\t\t\t\t\tposix_kill($pid, SIGKILL);\n\t\t\t\t}else{\n\t\t\t\t\texec(\"kill -9 \" . ((int)$pid) . \" > /dev/null 2>&1\");\n\t\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param object $value\n\t * @param bool   $includeCurrent\n\t *\n\t * @return int\n\t */\n\tfunction getReferenceCount($value, $includeCurrent = true){\n\t\tob_start();\n\t\tdebug_zval_dump($value);\n\t\t$ret = explode(\"\\n\", ob_get_contents());\n\t\tob_end_clean();\n\n\t\tif(count($ret) >= 1 and preg_match('/^.* refcount\\\\(([0-9]+)\\\\)\\\\{$/', trim($ret[0]), $m) > 0){\n\t\t\treturn ((int) $m[1]) - ($includeCurrent ? 3 : 4); //$value + zval call + extra call\n\t\t}\n\t\treturn -1;\n\t}\n\n\tfunction getTrace($start = 1, $trace = null){\n\t\tif($trace === null){\n\t\t\tif(function_exists(\"xdebug_get_function_stack\")){\n\t\t\t\t$trace = array_reverse(xdebug_get_function_stack());\n\t\t\t}else{\n\t\t\t\t$e = new \\Exception();\n\t\t\t\t$trace = $e->getTrace();\n\t\t\t}\n\t\t}\n\n\t\t$messages = [];\n\t\t$j = 0;\n\t\tfor($i = (int) $start; isset($trace[$i]); ++$i, ++$j){\n\t\t\t$params = \"\";\n\t\t\tif(isset($trace[$i][\"args\"]) or isset($trace[$i][\"params\"])){\n\t\t\t\tif(isset($trace[$i][\"args\"])){\n\t\t\t\t\t$args = $trace[$i][\"args\"];\n\t\t\t\t}else{\n\t\t\t\t\t$args = $trace[$i][\"params\"];\n\t\t\t\t}\n\t\t\t\tforeach($args as $name => $value){\n\t\t\t\t\t$params .= (is_object($value) ? get_class($value) . \" \" . (method_exists($value, \"__toString\") ? $value->__toString() : \"object\") : gettype($value) . \" \" . (is_array($value) ? \"Array()\" : Utils::printable(@strval($value)))) . \", \";\n\t\t\t\t}\n\t\t\t}\n\t\t\t$messages[] = \"#$j \" . (isset($trace[$i][\"file\"]) ? cleanPath($trace[$i][\"file\"]) : \"\") . \"(\" . (isset($trace[$i][\"line\"]) ? $trace[$i][\"line\"] : \"\") . \"): \" . (isset($trace[$i][\"class\"]) ? $trace[$i][\"class\"] . (($trace[$i][\"type\"] === \"dynamic\" or $trace[$i][\"type\"] === \"->\") ? \"->\" : \"::\") : \"\") . $trace[$i][\"function\"] . \"(\" . Utils::printable(substr($params, 0, -2)) . \")\";\n\t\t}\n\n\t\treturn $messages;\n\t}\n\n\tfunction cleanPath($path){\n\t\treturn rtrim(str_replace([\"\\\\\", \".php\", \"phar://\", rtrim(str_replace([\"\\\\\", \"phar://\"], [\"/\", \"\"], \\pocketmine\\PATH), \"/\"), rtrim(str_replace([\"\\\\\", \"phar://\"], [\"/\", \"\"], \\pocketmine\\PLUGIN_PATH), \"/\")], [\"/\", \"\", \"\", \"\", \"\"], $path), \"/\");\n\t}\n\n\t$errors = 0;\n\n\tif(php_sapi_name() !== \"cli\"){\n\t\t$logger->critical(\"You must run PocketMine-MP using the CLI.\");\n\t\t++$errors;\n\t}\n\n\tif(!extension_loaded(\"sockets\")){\n\t\t$logger->critical(\"Unable to find the Socket extension.\");\n\t\t++$errors;\n\t}\n\n\t$pthreads_version = phpversion(\"pthreads\");\n\tif(substr_count($pthreads_version, \".\") < 2){\n\t\t$pthreads_version = \"0.$pthreads_version\";\n\t}\n\tif(version_compare($pthreads_version, \"3.1.5\") < 0){\n\t\t$logger->critical(\"pthreads >= 3.1.5 is required, while you have $pthreads_version.\");\n\t\t++$errors;\n\t}\n\n\tif(!extension_loaded(\"uopz\")){\n\t\t//$logger->notice(\"Couldn't find the uopz extension. Some functions may be limited\");\n\t}\n\n\tif(extension_loaded(\"pocketmine\")){\n\t\tif(version_compare(phpversion(\"pocketmine\"), \"0.0.1\") < 0){\n\t\t\t$logger->critical(\"You have the native PocketMine extension, but your version is lower than 0.0.1.\");\n\t\t\t++$errors;\n\t\t}elseif(version_compare(phpversion(\"pocketmine\"), \"0.0.4\") > 0){\n\t\t\t$logger->critical(\"You have the native PocketMine extension, but your version is higher than 0.0.4.\");\n\t\t\t++$errors;\n\t\t}\n\t}\n\t\n\tif(extension_loaded(\"xdebug\")){\n\t\t$logger->warning(\"\n\n\n\tYou are running PocketMine with xdebug enabled. This has a major impact on performance.\n\n\t\t\");\n\t}\n\n\tif(!extension_loaded(\"curl\")){\n\t\t$logger->critical(\"Unable to find the cURL extension.\");\n\t\t++$errors;\n\t}\n\n\tif(!extension_loaded(\"yaml\")){\n\t\t$logger->critical(\"Unable to find the YAML extension.\");\n\t\t++$errors;\n\t}\n\n\tif(!extension_loaded(\"sqlite3\")){\n\t\t$logger->critical(\"Unable to find the SQLite3 extension.\");\n\t\t++$errors;\n\t}\n\n\tif(!extension_loaded(\"zlib\")){\n\t\t$logger->critical(\"Unable to find the Zlib extension.\");\n\t\t++$errors;\n\t}\n\n\tif($errors > 0){\n\t\t$logger->critical(\"Please update your PHP from itxtech.org/genisys/get/, or recompile PHP again.\");\n\t\t$logger->shutdown();\n\t\t$logger->join();\n\t\texit(1); //Exit with error\n\t}\n\n\tif(file_exists(\\pocketmine\\PATH . \".git/refs/heads/master\")){ //Found Git information!\n\t\tdefine('pocketmine\\GIT_COMMIT', strtolower(trim(file_get_contents(\\pocketmine\\PATH . \".git/refs/heads/master\"))));\n\t}else{\n\t\tdefine('pocketmine\\GIT_COMMIT', \"8f465763c590293e2003ce616832b6507edf5b1c\");\n\t}\n\n\t@define(\"ENDIANNESS\", (pack(\"d\", 1) === \"\\77\\360\\0\\0\\0\\0\\0\\0\" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));\n\t@define(\"INT32_MASK\", is_int(0xffffffff) ? 0xffffffff : -1);\n\t@ini_set(\"opcache.mmap_base\", bin2hex(random_bytes(8))); //Fix OPCache address errors\n\n\t$lang = \"unknown\";\n\tif(!file_exists(\\pocketmine\\DATA . \"server.properties\") and !isset($opts[\"no-wizard\"])){\n\t\t$inst = new Installer();\n\t\t$lang = $inst->getDefaultLang();\n\t}\n\n\t/*if(\\Phar::running(true) === \"\"){\n\t\t$logger->warning(\"Non-packaged PocketMine-MP installation detected, do not use on production.\");\n\t}*/\n\n\tThreadManager::init();\n\tnew Server($autoloader, $logger, \\pocketmine\\PATH, \\pocketmine\\DATA, \\pocketmine\\PLUGIN_PATH, $lang);\n\n\t$logger->info(\"Stopping other threads\");\n\n\tforeach(ThreadManager::getInstance()->getAll() as $id => $thread){\n\t\t$logger->debug(\"Stopping \" . (new \\ReflectionClass($thread))->getShortName() . \" thread\");\n\t\t$thread->quit();\n\t}\n\n\t$killer = new ServerKiller(8);\n\t$killer->start();\n\n\t$logger->shutdown();\n\t$logger->join();\n\n\techo \"Server has stopped\" . Terminal::$FORMAT_RESET . \"\\n\";\n\n\texit(0);\n\n}\n"
  },
  {
    "path": "src/pocketmine/Server.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\command\\CommandReader;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\command\\ConsoleCommandSender;\nuse pocketmine\\command\\PluginIdentifiableCommand;\nuse pocketmine\\command\\SimpleCommandMap;\nuse pocketmine\\event\\HandlerList;\nuse pocketmine\\event\\level\\LevelInitEvent;\nuse pocketmine\\event\\level\\LevelLoadEvent;\nuse pocketmine\\event\\server\\QueryRegenerateEvent;\nuse pocketmine\\event\\server\\ServerCommandEvent;\nuse pocketmine\\event\\Timings;\nuse pocketmine\\event\\TimingsHandler;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\inventory\\CraftingManager;\nuse pocketmine\\inventory\\InventoryType;\nuse pocketmine\\inventory\\Recipe;\nuse pocketmine\\inventory\\ShapedRecipe;\nuse pocketmine\\inventory\\ShapelessRecipe;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\item\\enchantment\\EnchantmentLevelTable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\lang\\BaseLang;\nuse pocketmine\\level\\format\\io\\LevelProviderManager;\nuse pocketmine\\level\\format\\io\\region\\Anvil;\nuse pocketmine\\level\\format\\io\\region\\McRegion;\nuse pocketmine\\level\\format\\io\\region\\PMAnvil;\nuse pocketmine\\level\\generator\\biome\\Biome;\nuse pocketmine\\level\\generator\\Flat;\nuse pocketmine\\level\\generator\\Void;\nuse pocketmine\\level\\generator\\Generator;\nuse pocketmine\\level\\generator\\nether\\Nether;\nuse pocketmine\\level\\generator\\normal\\Normal;\nuse pocketmine\\level\\generator\\normal\\Normal2;\nuse pocketmine\\level\\Level;\nuse pocketmine\\metadata\\EntityMetadataStore;\nuse pocketmine\\metadata\\LevelMetadataStore;\nuse pocketmine\\metadata\\PlayerMetadataStore;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\LongTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\network\\CompressBatchedTask;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\BatchPacket;\nuse pocketmine\\network\\protocol\\CraftingDataPacket;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\network\\protocol\\PlayerListPacket;\nuse pocketmine\\network\\query\\QueryHandler;\nuse pocketmine\\network\\RakLibInterface;\nuse pocketmine\\network\\rcon\\RCON;\nuse pocketmine\\network\\SourceInterface;\nuse pocketmine\\network\\upnp\\UPnP;\nuse pocketmine\\permission\\BanList;\nuse pocketmine\\permission\\DefaultPermissions;\nuse pocketmine\\plugin\\PharPluginLoader;\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\plugin\\PluginLoadOrder;\nuse pocketmine\\plugin\\PluginManager;\nuse pocketmine\\plugin\\ScriptPluginLoader;\nuse pocketmine\\scheduler\\CallbackTask;\nuse pocketmine\\scheduler\\DServerTask;\nuse pocketmine\\scheduler\\FileWriteTask;\nuse pocketmine\\scheduler\\SendUsageTask;\nuse pocketmine\\scheduler\\ServerScheduler;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\utils\\Binary;\nuse pocketmine\\utils\\Color;\nuse pocketmine\\utils\\Config;\nuse pocketmine\\utils\\LevelException;\nuse pocketmine\\utils\\MainLogger;\nuse pocketmine\\utils\\ServerException;\nuse pocketmine\\utils\\Terminal;\nuse pocketmine\\utils\\TextFormat;\nuse pocketmine\\utils\\Utils;\nuse pocketmine\\utils\\UUID;\nuse pocketmine\\utils\\VersionString;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Attribute;\n\n/**\n * The class that manages everything\n */\nclass Server{\n\tconst BROADCAST_CHANNEL_ADMINISTRATIVE = \"pocketmine.broadcast.admin\";\n\tconst BROADCAST_CHANNEL_USERS = \"pocketmine.broadcast.user\";\n\n\tconst PLAYER_MSG_TYPE_MESSAGE = 0;\n\tconst PLAYER_MSG_TYPE_TIP = 1;\n\tconst PLAYER_MSG_TYPE_POPUP = 2;\n\n\t/** @var Server */\n\tprivate static $instance = null;\n\n\t/** @var \\Threaded */\n\tprivate static $sleeper = null;\n\n\t/** @var BanList */\n\tprivate $banByName = null;\n\n\t/** @var BanList */\n\tprivate $banByIP = null;\n\n\t/** @var BanList */\n\tprivate $banByCID = \\null;\n\n\t/** @var Config */\n\tprivate $operators = null;\n\n\t/** @var Config */\n\tprivate $whitelist = null;\n\n\t/** @var bool */\n\tprivate $isRunning = true;\n\n\tprivate $hasStopped = false;\n\n\t/** @var PluginManager */\n\tprivate $pluginManager = null;\n\n\tprivate $profilingTickRate = 20;\n\n\t/** @var ServerScheduler */\n\tprivate $scheduler = null;\n\n\t/**\n\t * Counts the ticks since the server start\n\t *\n\t * @var int\n\t */\n\tprivate $tickCounter;\n\tprivate $nextTick = 0;\n\tprivate $tickAverage = [20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20];\n\tprivate $useAverage = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];\n\tprivate $maxTick = 20;\n\tprivate $maxUse = 0;\n\n\tprivate $sendUsageTicker = 0;\n\n\tprivate $dispatchSignals = false;\n\n\t/** @var \\AttachableThreadedLogger */\n\tprivate $logger;\n\n\t/** @var MemoryManager */\n\tprivate $memoryManager;\n\n\t/** @var CommandReader */\n\tprivate $console = null;\n\t//private $consoleThreaded;\n\n\t/** @var SimpleCommandMap */\n\tprivate $commandMap = null;\n\n\t/** @var CraftingManager */\n\tprivate $craftingManager;\n\n\t/** @var ConsoleCommandSender */\n\tprivate $consoleSender;\n\n\t/** @var int */\n\tprivate $maxPlayers;\n\n\t/** @var bool */\n\tprivate $autoSave;\n\n\t/** @var RCON */\n\tprivate $rcon;\n\n\t/** @var EntityMetadataStore */\n\tprivate $entityMetadata;\n\n\t/** @var PlayerMetadataStore */\n\tprivate $playerMetadata;\n\n\t/** @var LevelMetadataStore */\n\tprivate $levelMetadata;\n\n\t/** @var Network */\n\tprivate $network;\n\n\tprivate $networkCompressionAsync = true;\n\tpublic $networkCompressionLevel = 7;\n\n\tprivate $autoTickRate = true;\n\tprivate $autoTickRateLimit = 20;\n\tprivate $alwaysTickPlayers = false;\n\tprivate $baseTickRate = 1;\n\n\tprivate $autoSaveTicker = 0;\n\tprivate $autoSaveTicks = 6000;\n\n\t/** @var BaseLang */\n\tprivate $baseLang;\n\n\tprivate $forceLanguage = false;\n\n\tprivate $serverID;\n\n\tprivate $autoloader;\n\tprivate $filePath;\n\tprivate $dataPath;\n\tprivate $pluginPath;\n\n\tprivate $uniquePlayers = [];\n\n\t/** @var QueryHandler */\n\tprivate $queryHandler;\n\n\t/** @var QueryRegenerateEvent */\n\tprivate $queryRegenerateTask = null;\n\n\t/** @var Config */\n\tprivate $properties;\n\n\tprivate $propertyCache = [];\n\n\t/** @var Config */\n\tprivate $config;\n\n\t/** @var Player[] */\n\tprivate $players = [];\n\n\t/** @var Player[] */\n\tprivate $playerList = [];\n\n\tprivate $identifiers = [];\n\n\t/** @var Level[] */\n\tprivate $levels = [];\n\n\t/** @var Level */\n\tprivate $levelDefault = null;\n\n\tprivate $aboutContent = \"\";\n\n\t/** Advanced Config */\n\tpublic $advancedConfig = null;\n\n\tpublic $weatherEnabled = true;\n\tpublic $foodEnabled = true;\n\tpublic $expEnabled = true;\n\tpublic $keepInventory = false;\n\tpublic $netherEnabled = false;\n\tpublic $netherName = \"nether\";\n\tpublic $netherLevel = null;\n\tpublic $weatherRandomDurationMin = 6000;\n\tpublic $weatherRandomDurationMax = 12000;\n\tpublic $lightningTime = 200;\n\tpublic $lightningFire = false;\n\tpublic $version;\n\tpublic $allowSnowGolem;\n\tpublic $allowIronGolem;\n\tpublic $autoClearInv = true;\n\tpublic $dserverConfig = [];\n\tpublic $dserverPlayers = 0;\n\tpublic $dserverAllPlayers = 0;\n\tpublic $redstoneEnabled = false;\n\tpublic $allowFrequencyPulse = true;\n\tpublic $anvilEnabled = false;\n\tpublic $pulseFrequency = 20;\n\tpublic $playerMsgType = self::PLAYER_MSG_TYPE_MESSAGE;\n\tpublic $playerLoginMsg = \"\";\n\tpublic $playerLogoutMsg = \"\";\n\tpublic $antiFly = false;\n\tpublic $asyncChunkRequest = true;\n\tpublic $checkMovement = false;\n\tpublic $keepExperience = false;\n\tpublic $limitedCreative = true;\n\tpublic $chunkRadius = -1;\n\tpublic $destroyBlockParticle = true;\n\tpublic $allowSplashPotion = true;\n\tpublic $fireSpread = false;\n\tpublic $advancedCommandSelector = false;\n\tpublic $enchantingTableEnabled = true;\n\tpublic $countBookshelf = false;\n\tpublic $allowInventoryCheats = false;\n\tpublic $allowInstabreak = false;\n\n\t/** @var CraftingDataPacket */\n\tprivate $recipeList = null;\n\t/**\n\t * @return string\n\t */\n\tpublic function getName(){\n\t\treturn \"Elywing\";\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isRunning(){\n\t\treturn $this->isRunning === true;\n\t}\n\n\t/**\n\t * @return string\n\t * Returns a formatted string of how long the server has been running for\n\t */\n\tpublic function getUptime(){\n\t\t$time = microtime(true) - \\pocketmine\\START_TIME;\n\n\t\t$seconds = floor($time % 60);\n\t\t$minutes = null;\n\t\t$hours = null;\n\t\t$days = null;\n\n\t\tif($time >= 60){\n\t\t\t$minutes = floor(($time % 3600) / 60);\n\t\t\tif($time >= 3600){\n\t\t\t\t$hours = floor(($time % (3600 * 24)) / 3600);\n\t\t\t\tif($time >= 3600 * 24){\n\t\t\t\t\t$days = floor($time / (3600 * 24));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$uptime = ($minutes !== null ?\n\t\t\t\t($hours !== null ?\n\t\t\t\t\t($days !== null ?\n\t\t\t\t\t\t\"$days \" . $this->getLanguage()->translateString(\"%pocketmine.command.status.days\") . \" \"\n\t\t\t\t\t\t: \"\") . \"$hours \" . $this->getLanguage()->translateString(\"%pocketmine.command.status.hours\") . \" \"\n\t\t\t\t\t: \"\") . \"$minutes \" . $this->getLanguage()->translateString(\"%pocketmine.command.status.minutes\") . \" \"\n\t\t\t\t: \"\") . \"$seconds \" . $this->getLanguage()->translateString(\"%pocketmine.command.status.seconds\");\n\t\treturn $uptime;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getPocketMineVersion(){\n\t\treturn \\pocketmine\\VERSION;\n\t}\n\n\tpublic function getFormattedVersion($prefix = \"\"){\n\t\treturn (\\pocketmine\\VERSION !== \"\"? $prefix . \\pocketmine\\VERSION : \"\");\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getCodename(){\n\t\treturn \\pocketmine\\CODENAME;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getVersion(){\n\t\treturn \\pocketmine\\MINECRAFT_VERSION;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getApiVersion(){\n\t\treturn \\pocketmine\\API_VERSION;\n\t}\n\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getiTXApiVersion(){\n\t\treturn \\pocketmine\\GENISYS_API_VERSION;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getGeniApiVersion(){\n\t\treturn \\pocketmine\\GENISYS_API_VERSION;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getFilePath(){\n\t\treturn $this->filePath;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getDataPath(){\n\t\treturn $this->dataPath;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getPluginPath(){\n\t\treturn $this->pluginPath;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getMaxPlayers(){\n\t\treturn $this->maxPlayers;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getPort(){\n\t\treturn $this->getConfigInt(\"server-port\", 19132);\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getViewDistance(){\n\t\treturn max(56, $this->getProperty(\"chunk-sending.max-chunks\", 256));\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getIp(){\n\t\treturn $this->getConfigString(\"server-ip\", \"0.0.0.0\");\n\t}\n\n\tpublic function getServerUniqueId(){\n\t\treturn $this->serverID;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function getAutoSave(){\n\t\treturn $this->autoSave;\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setAutoSave($value){\n\t\t$this->autoSave = (bool) $value;\n\t\tforeach($this->getLevels() as $level){\n\t\t\t$level->setAutoSave($this->autoSave);\n\t\t}\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getLevelType(){\n\t\treturn $this->getConfigString(\"level-type\", \"DEFAULT\");\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function getGenerateStructures(){\n\t\treturn $this->getConfigBoolean(\"generate-structures\", true);\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getGamemode(){\n\t\treturn $this->getConfigInt(\"gamemode\", 0) & 0b11;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function getForceGamemode(){\n\t\treturn $this->getConfigBoolean(\"force-gamemode\", false);\n\t}\n\n\t/**\n\t * Returns the gamemode text name\n\t *\n\t * @param int $mode\n\t *\n\t * @return string\n\t */\n\tpublic static function getGamemodeString($mode){\n\t\tswitch((int) $mode){\n\t\t\tcase Player::SURVIVAL:\n\t\t\t\treturn \"%gameMode.survival\";\n\t\t\tcase Player::CREATIVE:\n\t\t\t\treturn \"%gameMode.creative\";\n\t\t\tcase Player::ADVENTURE:\n\t\t\t\treturn \"%gameMode.adventure\";\n\t\t\tcase Player::SPECTATOR:\n\t\t\t\treturn \"%gameMode.spectator\";\n\t\t}\n\n\t\treturn \"UNKNOWN\";\n\t}\n\n\t/**\n\t * Parses a string and returns a gamemode integer, -1 if not found\n\t *\n\t * @param string $str\n\t *\n\t * @return int\n\t */\n\tpublic static function getGamemodeFromString($str){\n\t\tswitch(strtolower(trim($str))){\n\t\t\tcase (string) Player::SURVIVAL:\n\t\t\tcase \"survival\":\n\t\t\tcase \"s\":\n\t\t\t\treturn Player::SURVIVAL;\n\n\t\t\tcase (string) Player::CREATIVE:\n\t\t\tcase \"creative\":\n\t\t\tcase \"c\":\n\t\t\t\treturn Player::CREATIVE;\n\n\t\t\tcase (string) Player::ADVENTURE:\n\t\t\tcase \"adventure\":\n\t\t\tcase \"a\":\n\t\t\t\treturn Player::ADVENTURE;\n\n\t\t\tcase (string) Player::SPECTATOR:\n\t\t\tcase \"spectator\":\n\t\t\tcase \"view\":\n\t\t\tcase \"v\":\n\t\t\t\treturn Player::SPECTATOR;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * @param string $str\n\t *\n\t * @return int\n\t */\n\tpublic static function getDifficultyFromString($str){\n\t\tswitch(strtolower(trim($str))){\n\t\t\tcase \"0\":\n\t\t\tcase \"peaceful\":\n\t\t\tcase \"p\":\n\t\t\t\treturn 0;\n\n\t\t\tcase \"1\":\n\t\t\tcase \"easy\":\n\t\t\tcase \"e\":\n\t\t\t\treturn 1;\n\n\t\t\tcase \"2\":\n\t\t\tcase \"normal\":\n\t\t\tcase \"n\":\n\t\t\t\treturn 2;\n\n\t\t\tcase \"3\":\n\t\t\tcase \"hard\":\n\t\t\tcase \"h\":\n\t\t\t\treturn 3;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getDifficulty(){\n\t\treturn $this->getConfigInt(\"difficulty\", 1);\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function hasWhitelist(){\n\t\treturn $this->getConfigBoolean(\"white-list\", false);\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSpawnRadius(){\n\t\treturn $this->getConfigInt(\"spawn-protection\", 16);\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function getAllowFlight(){\n\t\treturn $this->getConfigBoolean(\"allow-flight\", false);\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isHardcore(){\n\t\treturn $this->getConfigBoolean(\"hardcore\", false);\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getDefaultGamemode(){\n\t\treturn $this->getConfigInt(\"gamemode\", 0) & 0b11;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getMotd(){\n\t\treturn $this->getConfigString(\"motd\", \"Minecraft: PE Server\");\n\t}\n\n\t/**\n\t * @return \\ClassLoader\n\t */\n\tpublic function getLoader(){\n\t\treturn $this->autoloader;\n\t}\n\n\t/**\n\t * @return MainLogger\n\t */\n\tpublic function getLogger(){\n\t\treturn $this->logger;\n\t}\n\n\t/**\n\t * @return EntityMetadataStore\n\t */\n\tpublic function getEntityMetadata(){\n\t\treturn $this->entityMetadata;\n\t}\n\n\t/**\n\t * @return PlayerMetadataStore\n\t */\n\tpublic function getPlayerMetadata(){\n\t\treturn $this->playerMetadata;\n\t}\n\n\t/**\n\t * @return LevelMetadataStore\n\t */\n\tpublic function getLevelMetadata(){\n\t\treturn $this->levelMetadata;\n\t}\n\n\t/**\n\t * @return PluginManager\n\t */\n\tpublic function getPluginManager(){\n\t\treturn $this->pluginManager;\n\t}\n\n\t/**\n\t * @return CraftingManager\n\t */\n\tpublic function getCraftingManager(){\n\t\treturn $this->craftingManager;\n\t}\n\n\t/**\n\t * @return ServerScheduler\n\t */\n\tpublic function getScheduler(){\n\t\treturn $this->scheduler;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getTick(){\n\t\treturn $this->tickCounter;\n\t}\n\n\t/**\n\t * Returns the last server TPS measure\n\t *\n\t * @return float\n\t */\n\tpublic function getTicksPerSecond(){\n\t\treturn round($this->maxTick, 2);\n\t}\n\n\t/**\n\t * Returns the last server TPS average measure\n\t *\n\t * @return float\n\t */\n\tpublic function getTicksPerSecondAverage(){\n\t\treturn round(array_sum($this->tickAverage) / count($this->tickAverage), 2);\n\t}\n\n\t/**\n\t * Returns the TPS usage/load in %\n\t *\n\t * @return float\n\t */\n\tpublic function getTickUsage(){\n\t\treturn round($this->maxUse * 100, 2);\n\t}\n\n\t/**\n\t * Returns the TPS usage/load average in %\n\t *\n\t * @return float\n\t */\n\tpublic function getTickUsageAverage(){\n\t\treturn round((array_sum($this->useAverage) / count($this->useAverage)) * 100, 2);\n\t}\n\n\t/**\n\t * @return SimpleCommandMap\n\t */\n\tpublic function getCommandMap(){\n\t\treturn $this->commandMap;\n\t}\n\n\t/**\n\t * @return Player[]\n\t */\n\tpublic function getOnlinePlayers(){\n\t\treturn $this->playerList;\n\t}\n\n\tpublic function addRecipe(Recipe $recipe){\n\t\t$this->craftingManager->registerRecipe($recipe);\n\t\t$this->generateRecipeList();\n\t}\n\n\tpublic function shouldSavePlayerData() : bool{\n\t\treturn (bool) $this->getProperty(\"player.save-player-data\", true);\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return OfflinePlayer|Player\n\t */\n\tpublic function getOfflinePlayer($name){\n\t\t$name = strtolower($name);\n\t\t$result = $this->getPlayerExact($name);\n\n\t\tif($result === null){\n\t\t\t$result = new OfflinePlayer($this, $name);\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return CompoundTag\n\t */\n\tpublic function getOfflinePlayerData($name){\n\t\t$name = strtolower($name);\n\t\t$path = $this->getDataPath() . \"players/\";\n\t\tif($this->shouldSavePlayerData()){\n\t\t\tif(file_exists($path . \"$name.dat\")){\n\t\t\t\ttry{\n\t\t\t\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\t\t\t\t$nbt->readCompressed(file_get_contents($path . \"$name.dat\"));\n\n\t\t\t\t\treturn $nbt->getData();\n\t\t\t\t}catch(\\Throwable $e){ //zlib decode error / corrupt data\n\t\t\t\t\trename($path . \"$name.dat\", $path . \"$name.dat.bak\");\n\t\t\t\t\t$this->logger->notice($this->getLanguage()->translateString(\"pocketmine.data.playerCorrupted\", [$name]));\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->logger->notice($this->getLanguage()->translateString(\"pocketmine.data.playerNotFound\", [$name]));\n\t\t\t}\n\t\t}\n\t\t$spawn = $this->getDefaultLevel()->getSafeSpawn();\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew LongTag(\"firstPlayed\", floor(microtime(true) * 1000)),\n\t\t\tnew LongTag(\"lastPlayed\", floor(microtime(true) * 1000)),\n\t\t\tnew ListTag(\"Pos\", [\n\t\t\t\tnew DoubleTag(0, $spawn->x),\n\t\t\t\tnew DoubleTag(1, $spawn->y),\n\t\t\t\tnew DoubleTag(2, $spawn->z)\n\t\t\t]),\n\t\t\tnew StringTag(\"Level\", $this->getDefaultLevel()->getName()),\n\t\t\t//new StringTag(\"SpawnLevel\", $this->getDefaultLevel()->getName()),\n\t\t\t//new IntTag(\"SpawnX\", (int) $spawn->x),\n\t\t\t//new IntTag(\"SpawnY\", (int) $spawn->y),\n\t\t\t//new IntTag(\"SpawnZ\", (int) $spawn->z),\n\t\t\t//new ByteTag(\"SpawnForced\", 1), //TODO\n\t\t\tnew ListTag(\"Inventory\", []),\n\t\t\tnew ListTag(\"EnderChestInventory\", []),\n\t\t\tnew CompoundTag(\"Achievements\", []),\n\t\t\tnew IntTag(\"playerGameType\", $this->getGamemode()),\n\t\t\tnew ListTag(\"Motion\", [\n\t\t\t\tnew DoubleTag(0, 0.0),\n\t\t\t\tnew DoubleTag(1, 0.0),\n\t\t\t\tnew DoubleTag(2, 0.0)\n\t\t\t]),\n\t\t\tnew ListTag(\"Rotation\", [\n\t\t\t\tnew FloatTag(0, 0.0),\n\t\t\t\tnew FloatTag(1, 0.0)\n\t\t\t]),\n\t\t\tnew FloatTag(\"FallDistance\", 0.0),\n\t\t\tnew ShortTag(\"Fire\", 0),\n\t\t\tnew ShortTag(\"Air\", 300),\n\t\t\tnew ByteTag(\"OnGround\", 1),\n\t\t\tnew ByteTag(\"Invulnerable\", 0),\n\t\t\tnew StringTag(\"NameTag\", $name),\n\t\t\tnew ShortTag(\"Health\", 20),\n\t\t\tnew ShortTag(\"MaxHealth\", 20),\n\t\t]);\n\t\t$nbt->Pos->setTagType(NBT::TAG_Double);\n\t\t$nbt->Inventory->setTagType(NBT::TAG_Compound);\n\t\t$nbt->EnderChestInventory->setTagType(NBT::TAG_Compound);\n\t\t$nbt->Motion->setTagType(NBT::TAG_Double);\n\t\t$nbt->Rotation->setTagType(NBT::TAG_Float);\n\n\t\t/*if(file_exists($path . \"$name.yml\")){ //Importing old PocketMine-MP files\n\t\t\t$data = new Config($path . \"$name.yml\", Config::YAML, []);\n\t\t\t$nbt[\"playerGameType\"] = (int) $data->get(\"gamemode\");\n\t\t\t$nbt[\"Level\"] = $data->get(\"position\")[\"level\"];\n\t\t\t$nbt[\"Pos\"][0] = $data->get(\"position\")[\"x\"];\n\t\t\t$nbt[\"Pos\"][1] = $data->get(\"position\")[\"y\"];\n\t\t\t$nbt[\"Pos\"][2] = $data->get(\"position\")[\"z\"];\n\t\t\t$nbt[\"SpawnLevel\"] = $data->get(\"spawn\")[\"level\"];\n\t\t\t$nbt[\"SpawnX\"] = (int) $data->get(\"spawn\")[\"x\"];\n\t\t\t$nbt[\"SpawnY\"] = (int) $data->get(\"spawn\")[\"y\"];\n\t\t\t$nbt[\"SpawnZ\"] = (int) $data->get(\"spawn\")[\"z\"];\n\t\t\t$this->logger->notice($this->getLanguage()->translateString(\"pocketmine.data.playerOld\", [$name]));\n\t\t\tforeach($data->get(\"inventory\") as $slot => $item){\n\t\t\t\tif(count($item) === 3){\n\t\t\t\t\t$nbt->Inventory[$slot + 9] = new CompoundTag(\"\", [\n\t\t\t\t\t\tnew ShortTag(\"id\", $item[0]),\n\t\t\t\t\t\tnew ShortTag(\"Damage\", $item[1]),\n\t\t\t\t\t\tnew ByteTag(\"Count\", $item[2]),\n\t\t\t\t\t\tnew ByteTag(\"Slot\", $slot + 9),\n\t\t\t\t\t\tnew ByteTag(\"TrueSlot\", $slot + 9)\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tforeach($data->get(\"hotbar\") as $slot => $itemSlot){\n\t\t\t\tif(isset($nbt->Inventory[$itemSlot + 9])){\n\t\t\t\t\t$item = $nbt->Inventory[$itemSlot + 9];\n\t\t\t\t\t$nbt->Inventory[$slot] = new CompoundTag(\"\", [\n\t\t\t\t\t\tnew ShortTag(\"id\", $item[\"id\"]),\n\t\t\t\t\t\tnew ShortTag(\"Damage\", $item[\"Damage\"]),\n\t\t\t\t\t\tnew ByteTag(\"Count\", $item[\"Count\"]),\n\t\t\t\t\t\tnew ByteTag(\"Slot\", $slot),\n\t\t\t\t\t\tnew ByteTag(\"TrueSlot\", $item[\"TrueSlot\"])\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tforeach($data->get(\"armor\") as $slot => $item){\n\t\t\t\tif(count($item) === 2){\n\t\t\t\t\t$nbt->Inventory[$slot + 100] = new CompoundTag(\"\", [\n\t\t\t\t\t\tnew ShortTag(\"id\", $item[0]),\n\t\t\t\t\t\tnew ShortTag(\"Damage\", $item[1]),\n\t\t\t\t\t\tnew ByteTag(\"Count\", 1),\n\t\t\t\t\t\tnew ByteTag(\"Slot\", $slot + 100)\n\t\t\t\t\t]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tforeach($data->get(\"achievements\") as $achievement => $status){\n\t\t\t\t$nbt->Achievements[$achievement] = new ByteTag($achievement, $status == true ? 1 : 0);\n\t\t\t}\n\t\t\tunlink($path . \"$name.yml\");\n\t\t}*/\n\t\t$this->saveOfflinePlayerData($name, $nbt);\n\n\t\treturn $nbt;\n\n\t}\n\n\t/**\n\t * @param string   $name\n\t * @param CompoundTag $nbtTag\n\t * @param bool     $async\n\t */\n\tpublic function saveOfflinePlayerData($name, CompoundTag $nbtTag, $async = false){\n\t\tif($this->shouldSavePlayerData()){\n\t\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\t\ttry{\n\t\t\t\t$nbt->setData($nbtTag);\n\n\t\t\t\tif($async){\n\t\t\t\t\t$this->getScheduler()->scheduleAsyncTask(new FileWriteTask($this->getDataPath() . \"players/\" . strtolower($name) . \".dat\", $nbt->writeCompressed()));\n\t\t\t\t}else{\n\t\t\t\t\tfile_put_contents($this->getDataPath() . \"players/\" . strtolower($name) . \".dat\", $nbt->writeCompressed());\n\t\t\t\t}\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$this->logger->critical($this->getLanguage()->translateString(\"pocketmine.data.saveError\", [$name, $e->getMessage()]));\n\t\t\t\t$this->logger->logException($e);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return Player\n\t */\n\tpublic function getPlayer(string $name){\n\t\t$found = null;\n\t\t$name = strtolower($name);\n\t\t$delta = PHP_INT_MAX;\n\t\tforeach($this->getOnlinePlayers() as $player){\n\t\t\tif(stripos($player->getName(), $name) === 0){\n\t\t\t\t$curDelta = strlen($player->getName()) - strlen($name);\n\t\t\t\tif($curDelta < $delta){\n\t\t\t\t\t$found = $player;\n\t\t\t\t\t$delta = $curDelta;\n\t\t\t\t}\n\t\t\t\tif($curDelta === 0){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $found;\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return Player\n\t */\n\tpublic function getPlayerExact(string $name){\n\t\t$name = strtolower($name);\n\t\tforeach($this->getOnlinePlayers() as $player){\n\t\t\tif(strtolower($player->getName()) === $name){\n\t\t\t\treturn $player;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param string $partialName\n\t *\n\t * @return Player[]\n\t */\n\tpublic function matchPlayer($partialName){\n\t\t$partialName = strtolower($partialName);\n\t\t$matchedPlayers = [];\n\t\tforeach($this->getOnlinePlayers() as $player){\n\t\t\tif(strtolower($player->getName()) === $partialName){\n\t\t\t\t$matchedPlayers = [$player];\n\t\t\t\tbreak;\n\t\t\t}elseif(stripos($player->getName(), $partialName) !== false){\n\t\t\t\t$matchedPlayers[] = $player;\n\t\t\t}\n\t\t}\n\n\t\treturn $matchedPlayers;\n\t}\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function removePlayer(Player $player){\n\t\tif(isset($this->identifiers[$hash = spl_object_hash($player)])){\n\t\t\t$identifier = $this->identifiers[$hash];\n\t\t\tunset($this->players[$identifier]);\n\t\t\tunset($this->identifiers[$hash]);\n\t\t\treturn;\n\t\t}\n\n\t\tforeach($this->players as $identifier => $p){\n\t\t\tif($player === $p){\n\t\t\t\tunset($this->players[$identifier]);\n\t\t\t\tunset($this->identifiers[spl_object_hash($player)]);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return Level[]\n\t */\n\tpublic function getLevels(){\n\t\treturn $this->levels;\n\t}\n\n\t/**\n\t * @return Level\n\t */\n\tpublic function getDefaultLevel(){\n\t\treturn $this->levelDefault;\n\t}\n\n\t/**\n\t * Sets the default level to a different level\n\t * This won't change the level-name property,\n\t * it only affects the server on runtime\n\t *\n\t * @param Level $level\n\t */\n\tpublic function setDefaultLevel($level){\n\t\tif($level === null or ($this->isLevelLoaded($level->getFolderName()) and $level !== $this->levelDefault)){\n\t\t\t$this->levelDefault = $level;\n\t\t}\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isLevelLoaded($name){\n\t\treturn $this->getLevelByName($name) instanceof Level;\n\t}\n\n\t/**\n\t * @param int $levelId\n\t *\n\t * @return Level\n\t */\n\tpublic function getLevel($levelId){\n\t\tif(isset($this->levels[$levelId])){\n\t\t\treturn $this->levels[$levelId];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param $name\n\t *\n\t * @return Level\n\t */\n\tpublic function getLevelByName($name){\n\t\tforeach($this->getLevels() as $level){\n\t\t\tif($level->getFolderName() === $name){\n\t\t\t\treturn $level;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param Level $level\n\t * @param bool  $forceUnload\n\t *\n\t * @return bool\n\t */\n\tpublic function unloadLevel(Level $level, $forceUnload = false){\n\t\tif($level === $this->getDefaultLevel() and !$forceUnload){\n\t\t\tthrow new \\InvalidStateException(\"The default level cannot be unloaded while running, please switch levels.\");\n\t\t}\n\t\tif($level->unload($forceUnload) === true){\n\t\t\tunset($this->levels[$level->getId()]);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Loads a level from the data directory\n\t *\n\t * @param string $name\n\t *\n\t * @return bool\n\t *\n\t * @throws LevelException\n\t */\n\tpublic function loadLevel($name){\n\t\tif(trim($name) === \"\"){\n\t\t\tthrow new LevelException(\"Invalid empty level name\");\n\t\t}\n\t\tif($this->isLevelLoaded($name)){\n\t\t\treturn true;\n\t\t}elseif(!$this->isLevelGenerated($name)){\n\t\t\t$this->logger->notice($this->getLanguage()->translateString(\"pocketmine.level.notFound\", [$name]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$path = $this->getDataPath() . \"worlds/\" . $name . \"/\";\n\n\t\t$provider = LevelProviderManager::getProvider($path);\n\n\t\tif($provider === null){\n\t\t\t$this->logger->error($this->getLanguage()->translateString(\"pocketmine.level.loadError\", [$name, \"Unknown provider\"]));\n\n\t\t\treturn false;\n\t\t}\n\t\t//$entities = new Config($path.\"entities.yml\", Config::YAML);\n\t\t//if(file_exists($path . \"tileEntities.yml\")){\n\t\t//\t@rename($path . \"tileEntities.yml\", $path . \"tiles.yml\");\n\t\t//}\n\n\t\ttry{\n\t\t\t$level = new Level($this, $name, $path, $provider);\n\t\t}catch(\\Throwable $e){\n\n\t\t\t$this->logger->error($this->getLanguage()->translateString(\"pocketmine.level.loadError\", [$name, $e->getMessage()]));\n\t\t\tif($this->logger instanceof MainLogger){\n\t\t\t\t$this->logger->logException($e);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->levels[$level->getId()] = $level;\n\n\t\t$level->initLevel();\n\n\t\t$this->getPluginManager()->callEvent(new LevelLoadEvent($level));\n\n\t\t$level->setTickRate($this->baseTickRate);\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Generates a new level if it does not exists\n\t *\n\t * @param string $name\n\t * @param int    $seed\n\t * @param string $generator Class name that extends pocketmine\\level\\generator\\Noise\n\t * @param array  $options\n\t *\n\t * @return bool\n\t */\n\tpublic function generateLevel($name, $seed = null, $generator = null, $options = []){\n\t\tif(trim($name) === \"\" or $this->isLevelGenerated($name)){\n\t\t\treturn false;\n\t\t}\n\n\t\t$seed = $seed === null ? Binary::readInt(random_bytes(4)) : (int) $seed;\n\n\t\tif(!isset($options[\"preset\"])){\n\t\t\t$options[\"preset\"] = $this->getConfigString(\"generator-settings\", \"\");\n\t\t}\n\n\t\tif(!($generator !== null and class_exists($generator, true) and is_subclass_of($generator, Generator::class))){\n\t\t\t$generator = Generator::getGenerator($this->getLevelType());\n\t\t}\n\n\t\tif(($provider = LevelProviderManager::getProviderByName($providerName = $this->getProperty(\"level-settings.default-format\", \"pmanvil\"))) === null){\n\t\t\t$provider = LevelProviderManager::getProviderByName($providerName = \"pmanvil\");\n\t\t}\n\n\t\ttry{\n\t\t\t$path = $this->getDataPath() . \"worlds/\" . $name . \"/\";\n\t\t\t/** @var \\pocketmine\\level\\format\\LevelProvider $provider */\n\t\t\t$provider::generate($path, $name, $seed, $generator, $options);\n\n\t\t\t$level = new Level($this, $name, $path, $provider);\n\t\t\t$this->levels[$level->getId()] = $level;\n\n\t\t\t$level->initLevel();\n\n\t\t\t$level->setTickRate($this->baseTickRate);\n\t\t}catch(\\Throwable $e){\n\t\t\t$this->logger->error($this->getLanguage()->translateString(\"pocketmine.level.generateError\", [$name, $e->getMessage()]));\n\t\t\tif($this->logger instanceof MainLogger){\n\t\t\t\t$this->logger->logException($e);\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->getPluginManager()->callEvent(new LevelInitEvent($level));\n\n\t\t$this->getPluginManager()->callEvent(new LevelLoadEvent($level));\n\n\t\t$this->getLogger()->notice($this->getLanguage()->translateString(\"pocketmine.level.backgroundGeneration\", [$name]));\n\n\t\t$centerX = $level->getSpawnLocation()->getX() >> 4;\n\t\t$centerZ = $level->getSpawnLocation()->getZ() >> 4;\n\n\t\t$order = [];\n\n\t\tfor($X = -3; $X <= 3; ++$X){\n\t\t\tfor($Z = -3; $Z <= 3; ++$Z){\n\t\t\t\t$distance = $X ** 2 + $Z ** 2;\n\t\t\t\t$chunkX = $X + $centerX;\n\t\t\t\t$chunkZ = $Z + $centerZ;\n\t\t\t\t$index = Level::chunkHash($chunkX, $chunkZ);\n\t\t\t\t$order[$index] = $distance;\n\t\t\t}\n\t\t}\n\n\t\tasort($order);\n\n\t\tforeach($order as $index => $distance){\n\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\t\t\t$level->populateChunk($chunkX, $chunkZ, true);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isLevelGenerated($name){\n\t\tif(trim($name) === \"\"){\n\t\t\treturn false;\n\t\t}\n\t\t$path = $this->getDataPath() . \"worlds/\" . $name . \"/\";\n\t\tif(!($this->getLevelByName($name) instanceof Level)){\n\n\t\t\tif(LevelProviderManager::getProvider($path) === null){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t/*if(file_exists($path)){\n\t\t\t\t$level = new LevelImport($path);\n\t\t\t\tif($level->import() === false){ //Try importing a world\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}*/\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param string $variable\n\t * @param string $defaultValue\n\t *\n\t * @return string\n\t */\n\tpublic function getConfigString($variable, $defaultValue = \"\"){\n\t\t$v = getopt(\"\", [\"$variable::\"]);\n\t\tif(isset($v[$variable])){\n\t\t\treturn (string) $v[$variable];\n\t\t}\n\n\t\treturn $this->properties->exists($variable) ? $this->properties->get($variable) : $defaultValue;\n\t}\n\n\t/**\n\t * @param string $variable\n\t * @param mixed  $defaultValue\n\t *\n\t * @return mixed\n\t */\n\tpublic function getProperty($variable, $defaultValue = null){\n\t\tif(!array_key_exists($variable, $this->propertyCache)){\n\t\t\t$v = getopt(\"\", [\"$variable::\"]);\n\t\t\tif(isset($v[$variable])){\n\t\t\t\t$this->propertyCache[$variable] = $v[$variable];\n\t\t\t}else{\n\t\t\t\t$this->propertyCache[$variable] = $this->config->getNested($variable);\n\t\t\t}\n\t\t}\n\n\t\treturn $this->propertyCache[$variable] === null ? $defaultValue : $this->propertyCache[$variable];\n\t}\n\n\t/**\n\t * @param string $variable\n\t * @param string $value\n\t */\n\tpublic function setConfigString($variable, $value){\n\t\t$this->properties->set($variable, $value);\n\t}\n\n\t/**\n\t * @param string $variable\n\t * @param int    $defaultValue\n\t *\n\t * @return int\n\t */\n\tpublic function getConfigInt($variable, $defaultValue = 0){\n\t\t$v = getopt(\"\", [\"$variable::\"]);\n\t\tif(isset($v[$variable])){\n\t\t\treturn (int) $v[$variable];\n\t\t}\n\n\t\treturn $this->properties->exists($variable) ? (int) $this->properties->get($variable) : (int) $defaultValue;\n\t}\n\n\t/**\n\t * @param string $variable\n\t * @param int    $value\n\t */\n\tpublic function setConfigInt($variable, $value){\n\t\t$this->properties->set($variable, (int) $value);\n\t}\n\n\t/**\n\t * @param string  $variable\n\t * @param boolean $defaultValue\n\t *\n\t * @return boolean\n\t */\n\tpublic function getConfigBoolean($variable, $defaultValue = false){\n\t\t$v = getopt(\"\", [\"$variable::\"]);\n\t\tif(isset($v[$variable])){\n\t\t\t$value = $v[$variable];\n\t\t}else{\n\t\t\t$value = $this->properties->exists($variable) ? $this->properties->get($variable) : $defaultValue;\n\t\t}\n\n\t\tif(is_bool($value)){\n\t\t\treturn $value;\n\t\t}\n\t\tswitch(strtolower($value)){\n\t\t\tcase \"on\":\n\t\t\tcase \"true\":\n\t\t\tcase \"1\":\n\t\t\tcase \"yes\":\n\t\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param string $variable\n\t * @param bool   $value\n\t */\n\tpublic function setConfigBool($variable, $value){\n\t\t$this->properties->set($variable, $value == true ? \"1\" : \"0\");\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return PluginIdentifiableCommand\n\t */\n\tpublic function getPluginCommand($name){\n\t\tif(($command = $this->commandMap->getCommand($name)) instanceof PluginIdentifiableCommand){\n\t\t\treturn $command;\n\t\t}else{\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/**\n\t * @return BanList\n\t */\n\tpublic function getNameBans(){\n\t\treturn $this->banByName;\n\t}\n\n\t/**\n\t * @return BanList\n\t */\n\tpublic function getIPBans(){\n\t\treturn $this->banByIP;\n\t}\n\n\tpublic function getCIDBans(){\n\t\treturn $this->banByCID;\n\t}\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function addOp($name){\n\t\t$this->operators->set(strtolower($name), true);\n\n\t\tif(($player = $this->getPlayerExact($name)) !== null){\n\t\t\t$player->recalculatePermissions();\n\t\t}\n\t\t$this->operators->save(true);\n\t}\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function removeOp($name){\n\t\tforeach($this->operators->getAll() as $opName => $dummyValue){\n\t\t\tif(strtolower($name) === strtolower($opName)){\n\t\t\t\t$this->operators->remove($opName);\n\t\t\t}\n\t\t}\n\n\t\tif(($player = $this->getPlayerExact($name)) !== null){\n\t\t\t$player->recalculatePermissions();\n\t\t}\n\t\t$this->operators->save();\n\t}\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function addWhitelist($name){\n\t\t$this->whitelist->set(strtolower($name), true);\n\t\t$this->whitelist->save(true);\n\t}\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function removeWhitelist($name){\n\t\t$this->whitelist->remove(strtolower($name));\n\t\t$this->whitelist->save();\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isWhitelisted($name){\n\t\treturn !$this->hasWhitelist() or $this->whitelist->exists($name, true);\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isOp($name){\n\t\treturn $this->operators->exists($name, true);\n\t}\n\n\t/**\n\t * @return Config\n\t */\n\tpublic function getWhitelisted(){\n\t\treturn $this->whitelist;\n\t}\n\n\t/**\n\t * @return Config\n\t */\n\tpublic function getOps(){\n\t\treturn $this->operators;\n\t}\n\n\tpublic function reloadWhitelist(){\n\t\t$this->whitelist->reload();\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic function getCommandAliases(){\n\t\t$section = $this->getProperty(\"aliases\");\n\t\t$result = [];\n\t\tif(is_array($section)){\n\t\t\tforeach($section as $key => $value){\n\t\t\t\t$commands = [];\n\t\t\t\tif(is_array($value)){\n\t\t\t\t\t$commands = $value;\n\t\t\t\t}else{\n\t\t\t\t\t$commands[] = $value;\n\t\t\t\t}\n\n\t\t\t\t$result[$key] = $commands;\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\tpublic function getCrashPath(){\n\t\treturn $this->dataPath . \"crashdumps/\";\n\t}\n\n\t/**\n\t * @return Server\n\t */\n\tpublic static function getInstance() : Server{\n\t\treturn self::$instance;\n\t}\n\n\tpublic static function microSleep(int $microseconds){\n\t\tServer::$sleeper->synchronized(function(int $ms){\n\t\t\tServer::$sleeper->wait($ms);\n\t\t}, $microseconds);\n\t}\n\n\tpublic function about(){\n\t\t$string = \"§b\n                ____          \n               |  __|_              _\n               | |__| |      _    _(_)_ __   ___\n               |  __| |_   _| |  | | | '_ \\ / _ \\\n               | |__| | | | | |/\\| | | | | | (_) |\n               |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n                       _|  /                 __| |\n                      |___/                 |___/\n\n\t§fA stable §e\" . \\pocketmine\\MINECRAFT_VERSION . \"§f fork of §3PocketMine-MP (pmmp)§f.\n\t\t\t§fModified by §bH§e4§3PM§f.\n\t    Source code: §3https://github.com/H4PM/Elywing§f\n\t\";\n\t\n\t\t$this->getLogger()->info($string);\n\t}\n\n\n\tpublic function loadAdvancedConfig(){\n\t\t$this->playerMsgType = $this->getAdvancedProperty(\"server.player-msg-type\", self::PLAYER_MSG_TYPE_MESSAGE);\n\t\t$this->playerLoginMsg = $this->getAdvancedProperty(\"server.login-msg\", \"§3@player joined the game\");\n\t\t$this->playerLogoutMsg = $this->getAdvancedProperty(\"server.logout-msg\", \"§3@player left the game\");\n\t\t$this->weatherEnabled = $this->getAdvancedProperty(\"level.weather\", true);\n\t\t$this->foodEnabled = $this->getAdvancedProperty(\"player.hunger\", true);\n\t\t$this->expEnabled = $this->getAdvancedProperty(\"player.experience\", true);\n\t\t$this->keepInventory = $this->getAdvancedProperty(\"player.keep-inventory\", false);\n\t\t$this->keepExperience = $this->getAdvancedProperty(\"player.keep-experience\", false);\n\t\t$this->netherEnabled = $this->getAdvancedProperty(\"nether.allow-nether\", false);\n\t\t$this->netherName = $this->getAdvancedProperty(\"nether.level-name\", \"nether\");\n\t\t$this->weatherRandomDurationMin = $this->getAdvancedProperty(\"level.weather-random-duration-min\", 6000);\n\t\t$this->weatherRandomDurationMax = $this->getAdvancedProperty(\"level.weather-random-duration-max\", 12000);\n\t\t$this->lightningTime = $this->getAdvancedProperty(\"level.lightning-time\", 200);\n\t\t$this->lightningFire = $this->getAdvancedProperty(\"level.lightning-fire\", false);\n\t\t$this->allowSnowGolem = $this->getAdvancedProperty(\"server.allow-snow-golem\", false);\n\t\t$this->allowIronGolem = $this->getAdvancedProperty(\"server.allow-iron-golem\", false);\n\t\t$this->autoClearInv = $this->getAdvancedProperty(\"player.auto-clear-inventory\", true);\n\t\t$this->dserverConfig = [\n\t\t\t\"enable\" => $this->getAdvancedProperty(\"dserver.enable\", false),\n\t\t\t\"queryAutoUpdate\" => $this->getAdvancedProperty(\"dserver.query-auto-update\", false),\n\t\t\t\"queryTickUpdate\" => $this->getAdvancedProperty(\"dserver.query-tick-update\", true),\n\t\t\t\"motdMaxPlayers\" => $this->getAdvancedProperty(\"dserver.motd-max-players\", 0),\n\t\t\t\"queryMaxPlayers\" => $this->getAdvancedProperty(\"dserver.query-max-players\", 0),\n\t\t\t\"motdAllPlayers\" => $this->getAdvancedProperty(\"dserver.motd-all-players\", false),\n\t\t\t\"queryAllPlayers\" => $this->getAdvancedProperty(\"dserver.query-all-players\", false),\n\t\t\t\"motdPlayers\" => $this->getAdvancedProperty(\"dserver.motd-players\", false),\n\t\t\t\"queryPlayers\" => $this->getAdvancedProperty(\"dserver.query-players\", false),\n\t\t\t\"timer\" => $this->getAdvancedProperty(\"dserver.time\", 40),\n\t\t\t\"retryTimes\" => $this->getAdvancedProperty(\"dserver.retry-times\", 3),\n\t\t\t\"serverList\" => explode(\";\", $this->getAdvancedProperty(\"dserver.server-list\", \"\"))\n\t\t];\n\t\t$this->redstoneEnabled = $this->getAdvancedProperty(\"redstone.enable\", false);\n\t\t$this->allowFrequencyPulse = $this->getAdvancedProperty(\"redstone.allow-frequency-pulse\", false);\n\t\t$this->pulseFrequency = $this->getAdvancedProperty(\"redstone.pulse-frequency\", 20);\n\t\t$this->getLogger()->setWrite(!$this->getAdvancedProperty(\"server.disable-log\", false));\n\t\t$this->antiFly = $this->getAdvancedProperty(\"server.anti-fly\", true);\n\t\t$this->asyncChunkRequest = $this->getAdvancedProperty(\"server.async-chunk-request\", true);\n\t\t$this->checkMovement = $this->getAdvancedProperty(\"server.check-movement\", true);\n\t\t$this->limitedCreative = $this->getAdvancedProperty(\"server.limited-creative\", true);\n\t\t$this->chunkRadius = $this->getAdvancedProperty(\"player.chunk-radius\", -1);\n\t\t$this->destroyBlockParticle = $this->getAdvancedProperty(\"server.destroy-block-particle\", true);\n\t\t$this->allowSplashPotion = $this->getAdvancedProperty(\"server.allow-splash-potion\", true);\n\t\t$this->fireSpread = $this->getAdvancedProperty(\"level.fire-spread\", false);\n\t\t$this->advancedCommandSelector = $this->getAdvancedProperty(\"server.advanced-command-selector\", false);\n\t\t$this->anvilEnabled = $this->getAdvancedProperty(\"enchantment.enable-anvil\", true);\n\t\t$this->enchantingTableEnabled = $this->getAdvancedProperty(\"enchantment.enable-enchanting-table\", true);\n\t\t$this->countBookshelf = $this->getAdvancedProperty(\"enchantment.count-bookshelf\", false);\n\t\t$this->allowInstabreak = $this->getAdvancedProperty(\"server.allow-instabreak\", false);\n\n\t\t$this->allowInventoryCheats = $this->getAdvancedProperty(\"inventory.allow-cheats\", false);\n\t}\n\t\n\t/**\n\t * @deprecated Use SynapsePM plugin instead\n\t * @return bool\n\t */\n\tpublic function isSynapseEnabled() : bool {\n\t\treturn $this->getSynapse() !== null;\n\t}\n\n\t/**\n\t * @return int\n\t *\n\t * Get DServer max players\n\t */\n\tpublic function getDServerMaxPlayers(){\n\t\treturn ($this->dserverAllPlayers + $this->getMaxPlayers());\n\t}\n\n\t/**\n\t * @return int\n\t *\n\t * Get DServer all online player count\n\t */\n\tpublic function getDServerOnlinePlayers(){\n\t\treturn ($this->dserverPlayers + count($this->getOnlinePlayers()));\n\t}\n\n\tpublic function isDServerEnabled(){\n\t\treturn $this->dserverConfig[\"enable\"];\n\t}\n\n\tpublic function updateDServerInfo(){\n\t\t$this->scheduler->scheduleAsyncTask(new DServerTask($this->dserverConfig[\"serverList\"], $this->dserverConfig[\"retryTimes\"]));\n\t}\n\n\tpublic function getBuild(){\n\t\treturn $this->version->getBuild();\n\t}\n\n\tpublic function getGameVersion(){\n\t\treturn $this->version->getRelease();\n\t}\n\n\t/**\n\t * @param \\ClassLoader    $autoloader\n\t * @param \\ThreadedLogger $logger\n\t * @param string          $filePath\n\t * @param string          $dataPath\n\t * @param string          $pluginPath\n\t * @param string          $defaultLang\n\t */\n\tpublic function __construct(\\ClassLoader $autoloader, \\ThreadedLogger $logger, $filePath, $dataPath, $pluginPath, $defaultLang = \"unknown\"){\n\t\tself::$instance = $this;\n\t\tself::$sleeper = new \\Threaded;\n\t\t$this->autoloader = $autoloader;\n\t\t$this->logger = $logger;\n\t\t$this->filePath = $filePath;\n\t\ttry{\n\t\t\tif(!file_exists($dataPath . \"worlds/\")){\n\t\t\t\tmkdir($dataPath . \"worlds/\", 0777);\n\t\t\t}\n\n\t\t\tif(!file_exists($dataPath . \"players/\")){\n\t\t\t\tmkdir($dataPath . \"players/\", 0777);\n\t\t\t}\n\n\t\t\tif(!file_exists($pluginPath)){\n\t\t\t\tmkdir($pluginPath, 0777);\n\t\t\t}\n\n\t\t\tif(!file_exists($dataPath . \"crashdumps/\")){\n\t\t\t\tmkdir($dataPath . \"crashdumps/\", 0777);\n\t\t\t}\n\n\t\t\t$this->dataPath = realpath($dataPath) . DIRECTORY_SEPARATOR;\n\t\t\t$this->pluginPath = realpath($pluginPath) . DIRECTORY_SEPARATOR;\n\n\t\t\t$this->console = new CommandReader($logger);\n\n\t\t\t$version = new VersionString($this->getPocketMineVersion());\n\t\t\t$this->version = $version;\n\n\t\t\t$this->about();\n\n\t\t\t$this->logger->info(\"Loading properties and configuration...\");\n\t\t\tif(!file_exists($this->dataPath . \"pocketmine.yml\")){\n\t\t\t\t$content = file_get_contents($this->filePath . \"src/pocketmine/resources/pocketmine.yml\");\n\t\t\t\t@file_put_contents($this->dataPath . \"pocketmine.yml\", $content);\n\t\t\t}\n\t\t\t$this->config = new Config($configPath = $this->dataPath . \"pocketmine.yml\", Config::YAML, []);\n\t\t\t$nowLang = $this->getProperty(\"settings.language\", \"eng\");\n\n\t\t\t//Crashes unsupported builds without the correct configuration\n\t\t\tif(strpos(\\pocketmine\\VERSION, \"unsupported\") !== false and getenv(\"GITLAB_CI\") === false){\n\t\t\t\tif($this->getProperty(\"settings.enable-testing\", false) !== true){\n\t\t\t\t\tthrow new ServerException(\"This build is not intended for production use. You may set 'settings.enable-testing: true' under pocketmine.yml to allow use of non-production builds. Do so at your own risk and ONLY if you know what you are doing.\");\n\t\t\t\t}else{\n\t\t\t\t\t$this->logger->warning(\"You are using an unsupported build. Do not use this build in a production environment.\");\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($defaultLang != \"unknown\" and $nowLang != $defaultLang){\n\t\t\t\t@file_put_contents($configPath, str_replace('language: \"' . $nowLang . '\"', 'language: \"' . $defaultLang . '\"', file_get_contents($configPath)));\n\t\t\t\t$this->config->reload();\n\t\t\t\tunset($this->propertyCache[\"settings.language\"]);\n\t\t\t}\n\n\t\t\t$lang = $this->getProperty(\"settings.language\", BaseLang::FALLBACK_LANGUAGE);\n\t\t\tif(file_exists($this->filePath . \"src/pocketmine/resources/genisys_$lang.yml\")){\n\t\t\t\t$content = file_get_contents($file = $this->filePath . \"src/pocketmine/resources/genisys_$lang.yml\");\n\t\t\t}else{\n\t\t\t\t$content = file_get_contents($file = $this->filePath . \"src/pocketmine/resources/genisys_eng.yml\");\n\t\t\t}\n\n\t\t\tif(!file_exists($this->dataPath . \"genisys.yml\")){\n\t\t\t\t@file_put_contents($this->dataPath . \"genisys.yml\", $content);\n\t\t\t}\n\t\t\t$internelConfig = new Config($file, Config::YAML, []);\n\t\t\t$this->advancedConfig = new Config($this->dataPath . \"genisys.yml\", Config::YAML, []);\n\t\t\t$cfgVer = $this->getAdvancedProperty(\"config.version\", 0, $internelConfig);\n\t\t\t$advVer = $this->getAdvancedProperty(\"config.version\", 0);\n\n\t\t\t$this->loadAdvancedConfig();\n\n\t\t\t$this->properties = new Config($this->dataPath . \"server.properties\", Config::PROPERTIES, [\n\t\t\t\t\"motd\" => \"Minecraft: PE Server\",\n\t\t\t\t\"server-port\" => 19132,\n\t\t\t\t\"white-list\" => false,\n\t\t\t\t\"announce-player-achievements\" => true,\n\t\t\t\t\"spawn-protection\" => 16,\n\t\t\t\t\"max-players\" => 20,\n\t\t\t\t\"allow-flight\" => false,\n\t\t\t\t\"spawn-animals\" => true,\n\t\t\t\t\"spawn-mobs\" => true,\n\t\t\t\t\"gamemode\" => 0,\n\t\t\t\t\"force-gamemode\" => false,\n\t\t\t\t\"hardcore\" => false,\n\t\t\t\t\"pvp\" => true,\n\t\t\t\t\"difficulty\" => 1,\n\t\t\t\t\"generator-settings\" => \"\",\n\t\t\t\t\"level-name\" => \"world\",\n\t\t\t\t\"level-seed\" => \"\",\n\t\t\t\t\"level-type\" => \"DEFAULT\",\n\t\t\t\t\"enable-query\" => true,\n\t\t\t\t\"enable-rcon\" => false,\n\t\t\t\t\"rcon.password\" => substr(base64_encode(random_bytes(20)), 3, 10),\n\t\t\t\t\"auto-save\" => true,\n\t\t\t\t\"online-mode\" => false,\n\t\t\t]);\n\n\t\t\t$onlineMode = $this->getConfigBoolean(\"online-mode\", false);\n\t\t\tif(!extension_loaded(\"openssl\")){\n\t\t\t\t$this->logger->warning(\"The OpenSSL extension is not loaded, and this is required for XBOX authentication to work. If you want to use Xbox Live auth, please update your PHP binaries at itxtech.org/genisys/get/, or recompile PHP with the OpenSSL extension.\");\n\t\t\t\t$this->setConfigBool(\"online-mode\", false);\n\t\t\t}elseif(!$onlineMode){\n\t\t\t\t$this->logger->warning(\"SERVER IS RUNNING IN OFFLINE/INSECURE MODE!\");\n\t\t\t\t$this->logger->warning(\"The server will make no attempt to authenticate usernames. Beware.\");\n\t\t\t\t$this->logger->warning(\"While this makes the game possible to play without internet access, it also opens up the ability for hackers to connect with any username they choose.\");\n\t\t\t\t$this->logger->warning(\"To change this, set \\\"online-mode\\\" to \\\"true\\\" in the server.properties file.\");\n\t\t\t}\n\n\t\t\t$this->forceLanguage = $this->getProperty(\"settings.force-language\", false);\n\t\t\t$this->baseLang = new BaseLang($this->getProperty(\"settings.language\", BaseLang::FALLBACK_LANGUAGE));\n\t\t\t$this->logger->info($this->getLanguage()->translateString(\"language.selected\", [$this->getLanguage()->getName(), $this->getLanguage()->getLang()]));\n\n\t\t\t$this->memoryManager = new MemoryManager($this);\n\n\t\t\tif(($poolSize = $this->getProperty(\"settings.async-workers\", \"auto\")) === \"auto\"){\n\t\t\t\t$poolSize = ServerScheduler::$WORKERS;\n\t\t\t\t$processors = Utils::getCoreCount() - 2;\n\n\t\t\t\tif($processors > 0){\n\t\t\t\t\t$poolSize = max(1, $processors);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tServerScheduler::$WORKERS = $poolSize;\n\n\t\t\tif($this->getProperty(\"network.batch-threshold\", 256) >= 0){\n\t\t\t\tNetwork::$BATCH_THRESHOLD = (int) $this->getProperty(\"network.batch-threshold\", 256);\n\t\t\t}else{\n\t\t\t\tNetwork::$BATCH_THRESHOLD = -1;\n\t\t\t}\n\t\t\t$this->networkCompressionLevel = $this->getProperty(\"network.compression-level\", 7);\n\t\t\t$this->networkCompressionAsync = $this->getProperty(\"network.async-compression\", true);\n\n\t\t\t$this->autoTickRate = (bool) $this->getProperty(\"level-settings.auto-tick-rate\", true);\n\t\t\t$this->autoTickRateLimit = (int) $this->getProperty(\"level-settings.auto-tick-rate-limit\", 20);\n\t\t\t$this->alwaysTickPlayers = (int) $this->getProperty(\"level-settings.always-tick-players\", false);\n\t\t\t$this->baseTickRate = (int) $this->getProperty(\"level-settings.base-tick-rate\", 1);\n\n\t\t\t$this->scheduler = new ServerScheduler();\n\n\t\t\tif($this->getConfigBoolean(\"enable-rcon\", false) === true){\n\t\t\t\t$this->rcon = new RCON($this, $this->getConfigString(\"rcon.password\", \"\"), $this->getConfigInt(\"rcon.port\", $this->getPort()), ($ip = $this->getIp()) != \"\" ? $ip : \"0.0.0.0\", $this->getConfigInt(\"rcon.threads\", 1), $this->getConfigInt(\"rcon.clients-per-thread\", 50));\n\t\t\t}\n\n\t\t\t$this->entityMetadata = new EntityMetadataStore();\n\t\t\t$this->playerMetadata = new PlayerMetadataStore();\n\t\t\t$this->levelMetadata = new LevelMetadataStore();\n\n\t\t\t$this->operators = new Config($this->dataPath . \"ops.txt\", Config::ENUM);\n\t\t\t$this->whitelist = new Config($this->dataPath . \"white-list.txt\", Config::ENUM);\n\t\t\tif(file_exists($this->dataPath . \"banned.txt\") and !file_exists($this->dataPath . \"banned-players.txt\")){\n\t\t\t\t@rename($this->dataPath . \"banned.txt\", $this->dataPath . \"banned-players.txt\");\n\t\t\t}\n\t\t\t@touch($this->dataPath . \"banned-players.txt\");\n\t\t\t$this->banByName = new BanList($this->dataPath . \"banned-players.txt\");\n\t\t\t$this->banByName->load();\n\t\t\t@touch($this->dataPath . \"banned-ips.txt\");\n\t\t\t$this->banByIP = new BanList($this->dataPath . \"banned-ips.txt\");\n\t\t\t$this->banByIP->load();\n\t\t\t@touch($this->dataPath . \"banned-cids.txt\");\n\t\t\t$this->banByCID = new BanList($this->dataPath . \"banned-cids.txt\");\n\t\t\t$this->banByCID->load();\n\n\t\t\t$this->maxPlayers = $this->getConfigInt(\"max-players\", 20);\n\t\t\t$this->setAutoSave($this->getConfigBoolean(\"auto-save\", true));\n\n\t\t\tif($this->getConfigBoolean(\"hardcore\", false) === true and $this->getDifficulty() < 3){\n\t\t\t\t$this->setConfigInt(\"difficulty\", 3);\n\t\t\t}\n\n\t\t\tdefine(\"pocketmine\\\\DEBUG\", (int) $this->getProperty(\"debug.level\", 1));\n\t\t\tif($this->logger instanceof MainLogger){\n\t\t\t\t$this->logger->setLogDebug(\\pocketmine\\DEBUG > 1);\n\t\t\t}\n\n\t\t\tif(\\pocketmine\\DEBUG >= 0){\n\t\t\t\t@cli_set_process_title($this->getName() . \" \" . $this->getPocketMineVersion());\n\t\t\t}\n\n\t\t\t$this->logger->info($this->getLanguage()->translateString(\"pocketmine.server.networkStart\", [$this->getIp() === \"\" ? \"*\" : $this->getIp(), $this->getPort()]));\n\t\t\t$this->serverID = Utils::getMachineUniqueId($this->getIp() . $this->getPort());\n\n\t\t\t$this->getLogger()->debug(\"Server unique id: \" . $this->getServerUniqueId());\n\t\t\t$this->getLogger()->debug(\"Machine unique id: \" . Utils::getMachineUniqueId());\n\n\t\t\t$this->network = new Network($this);\n\t\t\t$this->network->setName($this->getMotd());\n\n\t\t\t$this->logger->info($this->getLanguage()->translateString(\"pocketmine.server.license\", [$this->getName()]));\n\n\t\t\tTimings::init();\n\n\t\t\t$this->consoleSender = new ConsoleCommandSender();\n\t\t\t$this->commandMap = new SimpleCommandMap($this);\n\n\t\t\tEntity::init();\n\t\t\tTile::init();\n\t\t\tInventoryType::init();\n\t\t\tBlock::init();\n\t\t\tEnchantment::init();\n\t\t\tItem::init();\n\t\t\tBiome::init();\n\t\t\tEffect::init();\n\t\t\tAttribute::init();\n\t\t\tEnchantmentLevelTable::init();\n\t\t\tColor::init();\n\t\t\t$this->craftingManager = new CraftingManager();\n\n\t\t\t$this->pluginManager = new PluginManager($this, $this->commandMap);\n\t\t\t$this->pluginManager->subscribeToPermission(Server::BROADCAST_CHANNEL_ADMINISTRATIVE, $this->consoleSender);\n\t\t\t$this->pluginManager->setUseTimings($this->getProperty(\"settings.enable-profiling\", false));\n\t\t\t$this->profilingTickRate = (float) $this->getProperty(\"settings.profile-report-trigger\", 20);\n\t\t\t$this->pluginManager->registerInterface(PharPluginLoader::class);\n\t\t\t$this->pluginManager->registerInterface(ScriptPluginLoader::class);\n\n\t\t\t//set_exception_handler([$this, \"exceptionHandler\"]);\n\t\t\tregister_shutdown_function([$this, \"crashDump\"]);\n\n\t\t\t$this->queryRegenerateTask = new QueryRegenerateEvent($this, 5);\n\n\t\t\t$this->network->registerInterface(new RakLibInterface($this));\n\n\t\t\t$this->pluginManager->loadPlugins($this->pluginPath);\n\n\t\t\t$this->enablePlugins(PluginLoadOrder::STARTUP);\n\n\t\t\tLevelProviderManager::addProvider(Anvil::class);\n\t\t\tLevelProviderManager::addProvider(McRegion::class);\n\t\t\tLevelProviderManager::addProvider(PMAnvil::class);\n\n\n\t\t\tGenerator::addGenerator(Flat::class, \"flat\");\n\t\t\tGenerator::addGenerator(Normal::class, \"normal\");\n\t\t\tGenerator::addGenerator(Normal::class, \"default\");\n\t\t\tGenerator::addGenerator(Nether::class, \"hell\");\n\t\t\tGenerator::addGenerator(Nether::class, \"nether\");\n\t\t\tGenerator::addGenerator(Void::class, \"void\");\n\t\t\tGenerator::addGenerator(Normal2::class, \"normal2\");\n\n\t\t\tforeach((array) $this->getProperty(\"worlds\", []) as $name => $worldSetting){\n\t\t\t\tif($this->loadLevel($name) === false){\n\t\t\t\t\t$seed = $this->getProperty(\"worlds.$name.seed\", time());\n\t\t\t\t\t$options = explode(\":\", $this->getProperty(\"worlds.$name.generator\", Generator::getGenerator(\"default\")));\n\t\t\t\t\t$generator = Generator::getGenerator(array_shift($options));\n\t\t\t\t\tif(count($options) > 0){\n\t\t\t\t\t\t$options = [\n\t\t\t\t\t\t\t\"preset\" => implode(\":\", $options),\n\t\t\t\t\t\t];\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$options = [];\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->generateLevel($name, $seed, $generator, $options);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($this->getDefaultLevel() === null){\n\t\t\t\t$default = $this->getConfigString(\"level-name\", \"world\");\n\t\t\t\tif(trim($default) == \"\"){\n\t\t\t\t\t$this->getLogger()->warning(\"level-name cannot be null, using default\");\n\t\t\t\t\t$default = \"world\";\n\t\t\t\t\t$this->setConfigString(\"level-name\", \"world\");\n\t\t\t\t}\n\t\t\t\tif($this->loadLevel($default) === false){\n\t\t\t\t\t$seed = getopt(\"\", [\"level-seed::\"])[\"level-seed\"] ?? $this->properties->get(\"level-seed\", time());\n\t\t\t\t\tif(!is_numeric($seed) or bccomp($seed, \"9223372036854775807\") > 0){\n\t\t\t\t\t\t$seed = Utils::javaStringHash($seed);\n\t\t\t\t\t}elseif(PHP_INT_SIZE === 8){\n\t\t\t\t\t\t$seed = (int) $seed;\n\t\t\t\t\t}\n\t\t\t\t\t$this->generateLevel($default, $seed === 0 ? time() : $seed);\n\t\t\t\t}\n\n\t\t\t\t$this->setDefaultLevel($this->getLevelByName($default));\n\t\t\t}\n\n\n\t\t\t$this->properties->save(true);\n\n\t\t\tif(!($this->getDefaultLevel() instanceof Level)){\n\t\t\t\t$this->getLogger()->emergency($this->getLanguage()->translateString(\"pocketmine.level.defaultError\"));\n\t\t\t\t$this->forceShutdown();\n\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif($this->netherEnabled){\n\t\t\t\tif(!$this->loadLevel($this->netherName)){\n\t\t\t\t\t//$this->logger->info(\"Level nether load\".$this->netherName);\n\t\t\t\t\t$this->generateLevel($this->netherName, time(), Generator::getGenerator(\"nether\"));\n\t\t\t\t}\n\t\t\t\t$this->netherLevel = $this->getLevelByName($this->netherName);\n\t\t\t}\n\n\t\t\tif($this->getProperty(\"ticks-per.autosave\", 6000) > 0){\n\t\t\t\t$this->autoSaveTicks = (int) $this->getProperty(\"ticks-per.autosave\", 6000);\n\t\t\t}\n\n\t\t\t$this->enablePlugins(PluginLoadOrder::POSTWORLD);\n\n\t\t\tif($this->dserverConfig[\"enable\"] and ($this->getAdvancedProperty(\"dserver.server-list\", \"\") != \"\")) $this->scheduler->scheduleRepeatingTask(new CallbackTask([\n\t\t\t\t$this,\n\t\t\t\t\"updateDServerInfo\"\n\t\t\t]), $this->dserverConfig[\"timer\"]);\n\n\t\t\tif($cfgVer > $advVer){\n\t\t\t\t$this->logger->notice(\"Your genisys.yml needs update\");\n\t\t\t\t$this->logger->notice(\"Current Version: $advVer   Latest Version: $cfgVer\");\n\t\t\t}\n\n\t\t\t$this->generateRecipeList();\n\n\t\t\t$this->start();\n\t\t}catch(\\Throwable $e){\n\t\t\t$this->exceptionHandler($e);\n\t\t}\n\t}\n\n\t/**\n\t * @deprecated Use SynapsePM plugin instead\n\t * @return Synapse|null\n\t */\n\tpublic function getSynapse(){\n\t\t$plugin = $this->pluginManager->getPlugin('SynapsePM');\n\t\tif ($plugin === null or $plugin->isDisabled()) {\n\t\t\treturn null;\n\t\t}\n\t\treturn $plugin->getSynapse();\n\t}\n\n\t/**\n\t * @param string        $message\n\t * @param Player[]|null $recipients\n\t *\n\t * @return int\n\t */\n\tpublic function broadcastMessage($message, $recipients = null) : int{\n\t\tif(!is_array($recipients)){\n\t\t\treturn $this->broadcast($message, self::BROADCAST_CHANNEL_USERS);\n\t\t}\n\n\t\t/** @var Player[] $recipients */\n\t\tforeach($recipients as $recipient){\n\t\t\t$recipient->sendMessage($message);\n\t\t}\n\n\t\treturn count($recipients);\n\t}\n\n\t/**\n\t * @param string        $tip\n\t * @param Player[]|null $recipients\n\t *\n\t * @return int\n\t */\n\tpublic function broadcastTip(string $tip, $recipients = null) : int{\n\t\tif(!is_array($recipients)){\n\t\t\t/** @var Player[] $recipients */\n\t\t\t$recipients = [];\n\n\t\t\tforeach($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $permissible){\n\t\t\t\tif($permissible instanceof Player and $permissible->hasPermission(self::BROADCAST_CHANNEL_USERS)){\n\t\t\t\t\t$recipients[spl_object_hash($permissible)] = $permissible; // do not send messages directly, or some might be repeated\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/** @var Player[] $recipients */\n\t\tforeach($recipients as $recipient){\n\t\t\t$recipient->sendTip($tip);\n\t\t}\n\n\t\treturn count($recipients);\n\t}\n\n\t/**\n\t * @param string        $popup\n\t * @param Player[]|null $recipients\n\t *\n\t * @return int\n\t */\n\tpublic function broadcastPopup(string $popup, $recipients = null) : int{\n\t\tif(!is_array($recipients)){\n\t\t\t/** @var Player[] $recipients */\n\t\t\t$recipients = [];\n\n\t\t\tforeach($this->pluginManager->getPermissionSubscriptions(self::BROADCAST_CHANNEL_USERS) as $permissible){\n\t\t\t\tif($permissible instanceof Player and $permissible->hasPermission(self::BROADCAST_CHANNEL_USERS)){\n\t\t\t\t\t$recipients[spl_object_hash($permissible)] = $permissible; // do not send messages directly, or some might be repeated\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t/** @var Player[] $recipients */\n\t\tforeach($recipients as $recipient){\n\t\t\t$recipient->sendPopup($popup);\n\t\t}\n\n\t\treturn count($recipients);\n\t}\n\n\t/**\n\t * @param string $message\n\t * @param string $permissions\n\t *\n\t * @return int\n\t */\n\tpublic function broadcast($message, string $permissions) : int{\n\t\t/** @var CommandSender[] $recipients */\n\t\t$recipients = [];\n\t\tforeach(explode(\";\", $permissions) as $permission){\n\t\t\tforeach($this->pluginManager->getPermissionSubscriptions($permission) as $permissible){\n\t\t\t\tif($permissible instanceof CommandSender and $permissible->hasPermission($permission)){\n\t\t\t\t\t$recipients[spl_object_hash($permissible)] = $permissible; // do not send messages directly, or some might be repeated\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach($recipients as $recipient){\n\t\t\t$recipient->sendMessage($message);\n\t\t}\n\n\t\treturn count($recipients);\n\t}\n\n\t/**\n\t * Broadcasts a Minecraft packet to a list of players\n\t *\n\t * @param Player[]   $players\n\t * @param DataPacket $packet\n\t */\n\tpublic function broadcastPacket(array $players, DataPacket $packet){\n\t\t$packet->encode();\n\t\t$packet->isEncoded = true;\n\t\tif(Network::$BATCH_THRESHOLD >= 0 and strlen($packet->buffer) >= Network::$BATCH_THRESHOLD){\n\t\t\t$this->batchPackets($players, [$packet->buffer], false);\n\t\t\treturn;\n\t\t}\n\n\t\tforeach($players as $player){\n\t\t\t$player->dataPacket($packet);\n\t\t}\n\t\tif(isset($packet->__encapsulatedPacket)){\n\t\t\tunset($packet->__encapsulatedPacket);\n\t\t}\n\t}\n\n\t/**\n\t * Broadcasts a list of packets in a batch to a list of players\n\t *\n\t * @param Player[]            $players\n\t * @param DataPacket[]|string $packets\n\t * @param bool                $forceSync\n\t */\n\tpublic function batchPackets(array $players, array $packets, $forceSync = false){\n\t\tTimings::$playerNetworkTimer->startTiming();\n\t\t$str = \"\";\n\n\t\tforeach($packets as $p){\n\t\t\tif($p instanceof DataPacket){\n\t\t\t\tif(!$p->isEncoded){\n\t\t\t\t\t$p->encode();\n\t\t\t\t}\n\t\t\t\t$str .= Binary::writeUnsignedVarInt(strlen($p->buffer)) . $p->buffer;\n\t\t\t}else{\n\t\t\t\t$str .= Binary::writeUnsignedVarInt(strlen($p)) . $p;\n\t\t\t}\n\t\t}\n\n\t\t$targets = [];\n\t\tforeach($players as $p){\n\t\t\tif($p->isConnected()){\n\t\t\t\t$targets[] = $this->identifiers[spl_object_hash($p)];\n\t\t\t}\n\t\t}\n\n\t\tif(!$forceSync and $this->networkCompressionAsync){\n\t\t\t$task = new CompressBatchedTask($str, $targets, $this->networkCompressionLevel);\n\t\t\t$this->getScheduler()->scheduleAsyncTask($task);\n\t\t}else{\n\t\t\t$this->broadcastPacketsCallback(zlib_encode($str, ZLIB_ENCODING_DEFLATE, $this->networkCompressionLevel), $targets);\n\t\t}\n\n\t\tTimings::$playerNetworkTimer->stopTiming();\n\t}\n\n\tpublic function broadcastPacketsCallback($data, array $identifiers){\n\t\t$pk = new BatchPacket();\n\t\t$pk->payload = $data;\n\t\t$pk->encode();\n\t\t$pk->isEncoded = true;\n\n\t\tforeach($identifiers as $i){\n\t\t\tif(isset($this->players[$i])){\n\t\t\t\t$this->players[$i]->dataPacket($pk);\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * @param int $type\n\t */\n\tpublic function enablePlugins(int $type){\n\t\tforeach($this->pluginManager->getPlugins() as $plugin){\n\t\t\tif(!$plugin->isEnabled() and $plugin->getDescription()->getOrder() === $type){\n\t\t\t\t$this->enablePlugin($plugin);\n\t\t\t}\n\t\t}\n\n\t\tif($type === PluginLoadOrder::POSTWORLD){\n\t\t\t$this->commandMap->registerServerAliases();\n\t\t\tDefaultPermissions::registerCorePermissions();\n\t\t}\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function enablePlugin(Plugin $plugin){\n\t\t$this->pluginManager->enablePlugin($plugin);\n\t}\n\n\tpublic function disablePlugins(){\n\t\t$this->pluginManager->disablePlugins();\n\t}\n\n\tpublic function checkConsole(){\n\t\tTimings::$serverCommandTimer->startTiming();\n\t\tif(($line = $this->console->getLine()) !== null){\n\t\t\t$this->pluginManager->callEvent($ev = new ServerCommandEvent($this->consoleSender, $line));\n\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t$this->dispatchCommand($ev->getSender(), $ev->getCommand());\n\t\t\t}\n\t\t}\n\t\tTimings::$serverCommandTimer->stopTiming();\n\t}\n\n\t/**\n\t * Executes a command from a CommandSender\n\t *\n\t * @param CommandSender $sender\n\t * @param string        $commandLine\n\t *\n\t * @return bool\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function dispatchCommand(CommandSender $sender, $commandLine){\n\t\tif($this->commandMap->dispatch($sender, $commandLine)){\n\t\t\treturn true;\n\t\t}\n\n\n\t\t$sender->sendMessage(new TranslationContainer(TextFormat::GOLD . \"%commands.generic.notFound\"));\n\n\t\treturn false;\n\t}\n\n\tpublic function reload(){\n\t\t$this->logger->info(\"Saving levels...\");\n\n\t\tforeach($this->levels as $level){\n\t\t\t$level->save();\n\t\t}\n\n\t\t$this->pluginManager->disablePlugins();\n\t\t$this->pluginManager->clearPlugins();\n\t\t$this->commandMap->clearCommands();\n\n\t\t$this->logger->info(\"Reloading properties...\");\n\t\t$this->properties->reload();\n\t\t$this->advancedConfig->reload();\n\t\t$this->loadAdvancedConfig();\n\t\t$this->maxPlayers = $this->getConfigInt(\"max-players\", 20);\n\n\t\tif($this->getConfigBoolean(\"hardcore\", false) === true and $this->getDifficulty() < 3){\n\t\t\t$this->setConfigInt(\"difficulty\", 3);\n\t\t}\n\n\t\t$this->banByIP->load();\n\t\t$this->banByName->load();\n\t\t$this->banByCID->load();\n\t\t$this->reloadWhitelist();\n\t\t$this->operators->reload();\n\n\t\t$this->memoryManager->doObjectCleanup();\n\n\t\tforeach($this->getIPBans()->getEntries() as $entry){\n\t\t\t$this->getNetwork()->blockAddress($entry->getName(), -1);\n\t\t}\n\n\t\t$this->pluginManager->registerInterface(PharPluginLoader::class);\n\t\t$this->pluginManager->registerInterface(ScriptPluginLoader::class);\n\t\t$this->pluginManager->loadPlugins($this->pluginPath);\n\t\t$this->enablePlugins(PluginLoadOrder::STARTUP);\n\t\t$this->enablePlugins(PluginLoadOrder::POSTWORLD);\n\t\tTimingsHandler::reload();\n\t}\n\n\t/**\n\t * Shutdowns the server correctly\n\t * @param bool   $restart\n\t * @param string $msg\n\t */\n\tpublic function shutdown(bool $restart = false, string $msg = \"\"){\n\t\t/*if($this->isRunning){\n\t\t\t$killer = new ServerKiller(90);\n\t\t\t$killer->start();\n\t\t\t$killer->kill();\n\t\t}*/\n\t\t$this->isRunning = false;\n\t\tif($msg != \"\"){\n\t\t\t$this->propertyCache[\"settings.shutdown-message\"] = $msg;\n\t\t}\n\t}\n\n\tpublic function forceShutdown(){\n\t\tif($this->hasStopped){\n\t\t\treturn;\n\t\t}\n\n\t\ttry{\n\t\t\tif(!$this->isRunning()){\n\t\t\t\t$this->sendUsage(SendUsageTask::TYPE_CLOSE);\n\t\t\t}\n\n\t\t\t$this->hasStopped = true;\n\n\t\t\t$this->shutdown();\n\t\t\tif($this->rcon instanceof RCON){\n\t\t\t\t$this->rcon->stop();\n\t\t\t}\n\n\t\t\tif($this->getProperty(\"network.upnp-forwarding\", false) === true){\n\t\t\t\t$this->logger->info(\"[UPnP] Removing port forward...\");\n\t\t\t\tUPnP::RemovePortForward($this->getPort());\n\t\t\t}\n\n\t\t\t$this->getLogger()->debug(\"Disabling all plugins\");\n\t\t\t$this->pluginManager->disablePlugins();\n\n\t\t\tforeach($this->players as $player){\n\t\t\t\t$player->close($player->getLeaveMessage(), $this->getProperty(\"settings.shutdown-message\", \"Server closed\"));\n\t\t\t}\n\n\t\t\t$this->getLogger()->debug(\"Unloading all levels\");\n\t\t\tforeach($this->getLevels() as $level){\n\t\t\t\t$this->unloadLevel($level, true);\n\t\t\t}\n\n\t\t\t$this->getLogger()->debug(\"Removing event handlers\");\n\t\t\tHandlerList::unregisterAll();\n\n\t\t\t$this->getLogger()->debug(\"Stopping all tasks\");\n\t\t\t$this->scheduler->cancelAllTasks();\n\t\t\t$this->scheduler->mainThreadHeartbeat(PHP_INT_MAX);\n\n\t\t\t$this->getLogger()->debug(\"Saving properties\");\n\t\t\t$this->properties->save();\n\n\t\t\t$this->getLogger()->debug(\"Closing console\");\n\t\t\t$this->console->shutdown();\n\t\t\t$this->console->notify();\n\n\t\t\t$this->getLogger()->debug(\"Stopping network interfaces\");\n\t\t\tforeach($this->network->getInterfaces() as $interface){\n\t\t\t\t$interface->shutdown();\n\t\t\t\t$this->network->unregisterInterface($interface);\n\t\t\t}\n\n\t\t\t//$this->memoryManager->doObjectCleanup();\n\n\t\t\tgc_collect_cycles();\n\t\t}catch(\\Throwable $e){\n\t\t\t$this->logger->logException($e);\n\t\t\t$this->logger->emergency(\"Crashed while crashing, killing process\");\n\t\t\t@kill(getmypid());\n\t\t}\n\n\t}\n\n\tpublic function getQueryInformation(){\n\t\treturn $this->queryRegenerateTask;\n\t}\n\n\t/**\n\t * Starts the PocketMine-MP server and starts processing ticks and packets\n\t */\n\tpublic function start(){\n\t\tif($this->getConfigBoolean(\"enable-query\", true) === true){\n\t\t\t$this->queryHandler = new QueryHandler();\n\t\t}\n\n\t\tforeach($this->getIPBans()->getEntries() as $entry){\n\t\t\t$this->network->blockAddress($entry->getName(), -1);\n\t\t}\n\n\t\tif($this->getProperty(\"settings.send-usage\", true)){\n\t\t\t$this->sendUsageTicker = 6000;\n\t\t\t$this->sendUsage(SendUsageTask::TYPE_OPEN);\n\t\t}\n\n\n\t\tif($this->getProperty(\"network.upnp-forwarding\", false) == true){\n\t\t\t$this->logger->info(\"[UPnP] Trying to port forward...\");\n\t\t\tUPnP::PortForward($this->getPort());\n\t\t}\n\n\t\t$this->tickCounter = 0;\n\n\t\tif(function_exists(\"pcntl_signal\")){\n\t\t\tpcntl_signal(SIGTERM, [$this, \"handleSignal\"]);\n\t\t\tpcntl_signal(SIGINT, [$this, \"handleSignal\"]);\n\t\t\tpcntl_signal(SIGHUP, [$this, \"handleSignal\"]);\n\t\t\t$this->dispatchSignals = true;\n\t\t}\n\n\t\t$this->logger->info($this->getLanguage()->translateString(\"pocketmine.server.defaultGameMode\", [self::getGamemodeString($this->getGamemode())]));\n\n\t\t$this->logger->info($this->getLanguage()->translateString(\"pocketmine.server.startFinished\", [round(microtime(true) - \\pocketmine\\START_TIME, 3)]));\n\n\t\t$this->tickProcessor();\n\t\t$this->forceShutdown();\n\n\t\tgc_collect_cycles();\n\t}\n\n\tpublic function handleSignal($signo){\n\t\tif($signo === SIGTERM or $signo === SIGINT or $signo === SIGHUP){\n\t\t\t$this->shutdown();\n\t\t}\n\t}\n\n\tpublic function exceptionHandler(\\Throwable $e, $trace = null){\n\t\tif($e === null){\n\t\t\treturn;\n\t\t}\n\n\t\tglobal $lastError;\n\n\t\tif($trace === null){\n\t\t\t$trace = $e->getTrace();\n\t\t}\n\n\t\t$errstr = $e->getMessage();\n\t\t$errfile = $e->getFile();\n\t\t$errno = $e->getCode();\n\t\t$errline = $e->getLine();\n\n\t\t$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? \\LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? \\LogLevel::WARNING : \\LogLevel::NOTICE);\n\t\tif(($pos = strpos($errstr, \"\\n\")) !== false){\n\t\t\t$errstr = substr($errstr, 0, $pos);\n\t\t}\n\n\t\t$errfile = cleanPath($errfile);\n\n\t\tif($this->logger instanceof MainLogger){\n\t\t\t$this->logger->logException($e, $trace);\n\t\t}\n\n\t\t$lastError = [\n\t\t\t\"type\" => $type,\n\t\t\t\"message\" => $errstr,\n\t\t\t\"fullFile\" => $e->getFile(),\n\t\t\t\"file\" => $errfile,\n\t\t\t\"line\" => $errline,\n\t\t\t\"trace\" => @getTrace(1, $trace)\n\t\t];\n\n\t\tglobal $lastExceptionError, $lastError;\n\t\t$lastExceptionError = $lastError;\n\t\t$this->crashDump();\n\t}\n\n\tpublic function crashDump(){\n\t\tif($this->isRunning === false){\n\t\t\treturn;\n\t\t}\n\t\tif($this->sendUsageTicker > 0){\n\t\t\t$this->sendUsage(SendUsageTask::TYPE_CLOSE);\n\t\t}\n\t\t$this->hasStopped = false;\n\n\t\tini_set(\"error_reporting\", 0);\n\t\tini_set(\"memory_limit\", -1); //Fix error dump not dumped on memory problems\n\t\t$this->logger->emergency($this->getLanguage()->translateString(\"pocketmine.crash.create\"));\n\t\ttry{\n\t\t\t$dump = new CrashDump($this);\n\t\t}catch(\\Throwable $e){\n\t\t\t$this->logger->critical($this->getLanguage()->translateString(\"pocketmine.crash.error\", $e->getMessage()));\n\t\t\treturn;\n\t\t}\n\n\t\t$this->logger->emergency($this->getLanguage()->translateString(\"pocketmine.crash.submit\", [$dump->getPath()]));\n\n\n\t\tif($this->getProperty(\"auto-report.enabled\", true) !== false){\n\t\t\t$report = true;\n\t\t\t$plugin = $dump->getData()[\"plugin\"];\n\t\t\tif(is_string($plugin)){\n\t\t\t\t$p = $this->pluginManager->getPlugin($plugin);\n\t\t\t\tif($p instanceof Plugin and !($p->getPluginLoader() instanceof PharPluginLoader)){\n\t\t\t\t\t$report = false;\n\t\t\t\t}\n\t\t\t}elseif(\\Phar::running(true) == \"\"){\n\t\t\t\t$report = false;\n\t\t\t}\n\t\t\tif($dump->getData()[\"error\"][\"type\"] === \"E_PARSE\" or $dump->getData()[\"error\"][\"type\"] === \"E_COMPILE_ERROR\"){\n\t\t\t\t$report = false;\n\t\t\t}\n\n\t\t\tif($report){\n\t\t\t\t$reply = Utils::postURL(\"http://\" . $this->getProperty(\"auto-report.host\", \"crash.pocketmine.net\") . \"/submit/api\", [\n\t\t\t\t\t\"report\" => \"yes\",\n\t\t\t\t\t\"name\" => $this->getName() . \" \" . $this->getPocketMineVersion(),\n\t\t\t\t\t\"email\" => \"crash@pocketmine.net\",\n\t\t\t\t\t\"reportPaste\" => base64_encode($dump->getEncodedData())\n\t\t\t\t]);\n\n\t\t\t\tif(($data = json_decode($reply)) !== false and isset($data->crashId)){\n\t\t\t\t\t$reportId = $data->crashId;\n\t\t\t\t\t$reportUrl = $data->crashUrl;\n\t\t\t\t\t$this->logger->emergency($this->getLanguage()->translateString(\"pocketmine.crash.archive\", [$reportUrl, $reportId]));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//$this->checkMemory();\n\t\t//$dump .= \"Memory Usage Tracking: \\r\\n\" . chunk_split(base64_encode(gzdeflate(implode(\";\", $this->memoryStats), 9))) . \"\\r\\n\";\n\n\t\t$this->forceShutdown();\n\t\t$this->isRunning = false;\n\t\t@kill(getmypid());\n\t\texit(1);\n\t}\n\n\tpublic function __debugInfo(){\n\t\treturn [];\n\t}\n\n\tprivate function tickProcessor(){\n\t\t$this->nextTick = microtime(true);\n\t\twhile($this->isRunning){\n\t\t\t$this->tick();\n\t\t\t$next = $this->nextTick - 0.0001;\n\t\t\tif($next > microtime(true)){\n\t\t\t\t@time_sleep_until($next);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onPlayerLogin(Player $player){\n\t\tif($this->sendUsageTicker > 0){\n\t\t\t$this->uniquePlayers[$player->getRawUniqueId()] = $player->getRawUniqueId();\n\t\t}\n\n\t\t$this->sendFullPlayerListData($player);\n\t\t$this->sendRecipeList($player);\n\t}\n\n\tpublic function addPlayer($identifier, Player $player){\n\t\t$this->players[$identifier] = $player;\n\t\t$this->identifiers[spl_object_hash($player)] = $identifier;\n\t}\n\n\tpublic function addOnlinePlayer(Player $player){\n\t\t$this->playerList[$player->getRawUniqueId()] = $player;\n\n\t\t$this->updatePlayerListData($player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkinId(), $player->getSkinData());\n\t}\n\n\tpublic function removeOnlinePlayer(Player $player){\n\t\tif(isset($this->playerList[$player->getRawUniqueId()])){\n\t\t\tunset($this->playerList[$player->getRawUniqueId()]);\n\n\t\t\t$pk = new PlayerListPacket();\n\t\t\t$pk->type = PlayerListPacket::TYPE_REMOVE;\n\t\t\t$pk->entries[] = [$player->getUniqueId()];\n\t\t\t$this->broadcastPacket($this->playerList, $pk);\n\t\t}\n\t}\n\n\tpublic function updatePlayerListData(UUID $uuid, $entityId, $name, $skinId, $skinData, array $players = null){\n\t\t$pk = new PlayerListPacket();\n\t\t$pk->type = PlayerListPacket::TYPE_ADD;\n\t\t$pk->entries[] = [$uuid, $entityId, $name, $skinId, $skinData];\n\t\t$this->broadcastPacket($players === null ? $this->playerList : $players, $pk);\n\t}\n\n\tpublic function removePlayerListData(UUID $uuid, array $players = null){\n\t\t$pk = new PlayerListPacket();\n\t\t$pk->type = PlayerListPacket::TYPE_REMOVE;\n\t\t$pk->entries[] = [$uuid];\n\t\t$this->broadcastPacket($players === null ? $this->playerList : $players, $pk);\n\t}\n\n\tpublic function sendFullPlayerListData(Player $p){\n\t\t$pk = new PlayerListPacket();\n\t\t$pk->type = PlayerListPacket::TYPE_ADD;\n\t\tforeach($this->playerList as $player){\n\t\t\tif($p === $player){\n\t\t\t\tcontinue; //fixes duplicates\n\t\t\t}\n\t\t\t$pk->entries[] = [$player->getUniqueId(), $player->getId(), $player->getDisplayName(), $player->getSkinId(), $player->getSkinData()];\n\t\t}\n\n\t\t$p->dataPacket($pk);\n\t}\n\n\tpublic function generateRecipeList(){\n\n\t\t$pk = new CraftingDataPacket();\n\t\t$pk->cleanRecipes = true;\n\n\t\tforeach($this->getCraftingManager()->getRecipes() as $recipe){\n\t\t\tif($recipe instanceof ShapedRecipe){\n\t\t\t\t$pk->addShapedRecipe($recipe);\n\t\t\t}elseif($recipe instanceof ShapelessRecipe){\n\t\t\t\t$pk->addShapelessRecipe($recipe);\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->getCraftingManager()->getFurnaceRecipes() as $recipe){\n\t\t\t$pk->addFurnaceRecipe($recipe);\n\t\t}\n\n\t\t$pk->encode();\n\t\t$pk->isEncoded = true;\n\n\t\t$this->recipeList = $pk;\n\t}\n\n\tpublic function sendRecipeList(Player $p){\n\t\t$p->dataPacket($this->recipeList);\n\t}\n\n\tprivate function checkTickUpdates($currentTick, $tickTime){\n\t\tforeach($this->players as $p){\n\t\t\tif(!$p->loggedIn and ($tickTime - $p->creationTime) >= 10){\n\t\t\t\t$p->close(\"\", \"Login timeout\");\n\t\t\t}elseif($this->alwaysTickPlayers){\n\t\t\t\t$p->onUpdate($currentTick);\n\t\t\t}\n\t\t}\n\n\t\t//Do level ticks\n\t\tforeach($this->getLevels() as $level){\n\t\t\tif($level->getTickRate() > $this->baseTickRate and --$level->tickRateCounter > 0){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ttry{\n\t\t\t\t$levelTime = microtime(true);\n\t\t\t\t$level->doTick($currentTick);\n\t\t\t\t$tickMs = (microtime(true) - $levelTime) * 1000;\n\t\t\t\t$level->tickRateTime = $tickMs;\n\n\t\t\t\tif($this->autoTickRate){\n\t\t\t\t\tif($tickMs < 50 and $level->getTickRate() > $this->baseTickRate){\n\t\t\t\t\t\t$level->setTickRate($r = $level->getTickRate() - 1);\n\t\t\t\t\t\tif($r > $this->baseTickRate){\n\t\t\t\t\t\t\t$level->tickRateCounter = $level->getTickRate();\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->getLogger()->debug(\"Raising level \\\"\" . $level->getName() . \"\\\" tick rate to \" . $level->getTickRate() . \" ticks\");\n\t\t\t\t\t}elseif($tickMs >= 50){\n\t\t\t\t\t\tif($level->getTickRate() === $this->baseTickRate){\n\t\t\t\t\t\t\t$level->setTickRate(max($this->baseTickRate + 1, min($this->autoTickRateLimit, floor($tickMs / 50))));\n\t\t\t\t\t\t\t$this->getLogger()->debug(\"Level \\\"\" . $level->getName() . \"\\\" took \" . round($tickMs, 2) . \"ms, setting tick rate to \" . $level->getTickRate() . \" ticks\");\n\t\t\t\t\t\t}elseif(($tickMs / $level->getTickRate()) >= 50 and $level->getTickRate() < $this->autoTickRateLimit){\n\t\t\t\t\t\t\t$level->setTickRate($level->getTickRate() + 1);\n\t\t\t\t\t\t\t$this->getLogger()->debug(\"Level \\\"\" . $level->getName() . \"\\\" took \" . round($tickMs, 2) . \"ms, setting tick rate to \" . $level->getTickRate() . \" ticks\");\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$level->tickRateCounter = $level->getTickRate();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$this->logger->critical($this->getLanguage()->translateString(\"pocketmine.level.tickError\", [$level->getName(), $e->getMessage()]));\n\t\t\t\tif(\\pocketmine\\DEBUG > 1 and $this->logger instanceof MainLogger){\n\t\t\t\t\t$this->logger->logException($e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function doAutoSave(){\n\t\tif($this->getAutoSave()){\n\t\t\tTimings::$worldSaveTimer->startTiming();\n\t\t\tforeach($this->players as $index => $player){\n\t\t\t\tif($player->isOnline()){\n\t\t\t\t\t$player->save(true);\n\t\t\t\t}elseif(!$player->isConnected()){\n\t\t\t\t\t$this->removePlayer($player);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tforeach($this->getLevels() as $level){\n\t\t\t\t$level->save(false);\n\t\t\t}\n\t\t\tTimings::$worldSaveTimer->stopTiming();\n\t\t}\n\t}\n\n\tpublic function sendUsage($type = SendUsageTask::TYPE_STATUS){\n\t\t$this->scheduler->scheduleAsyncTask(new SendUsageTask($this, $type, $this->uniquePlayers));\n\t\t$this->uniquePlayers = [];\n\t}\n\n\n\t/**\n\t * @return BaseLang\n\t */\n\tpublic function getLanguage(){\n\t\treturn $this->baseLang;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isLanguageForced(){\n\t\treturn $this->forceLanguage;\n\t}\n\n\t/**\n\t * @return Network\n\t */\n\tpublic function getNetwork(){\n\t\treturn $this->network;\n\t}\n\n\t/**\n\t * @return MemoryManager\n\t */\n\tpublic function getMemoryManager(){\n\t\treturn $this->memoryManager;\n\t}\n\n\tprivate function titleTick(){\n\t\tif(!Terminal::hasFormattingCodes()){\n\t\t\treturn;\n\t\t}\n\n\t\t$d = Utils::getRealMemoryUsage();\n\n\t\t$u = Utils::getMemoryUsage(true);\n\t\t$usage = round(($u[0] / 1024) / 1024, 2) . \"/\" . round(($d[0] / 1024) / 1024, 2) . \"/\" . round(($u[1] / 1024) / 1024, 2) . \"/\" . round(($u[2] / 1024) / 1024, 2) . \" MB @ \" . Utils::getThreadCount() . \" threads\";\n\n\t\techo \"\\x1b]0;\" . $this->getName() . $this->getFormattedVersion(\"-\") .\n\t\t\t\" | Online \" . count($this->players) . \"/\" . $this->getMaxPlayers() .\n\t\t\t\" | Memory \" . $usage .\n\t\t\t\" | U \" . round($this->network->getUpload() / 1024, 2) .\n\t\t\t\" D \" . round($this->network->getDownload() / 1024, 2) .\n\t\t\t\" kB/s | TPS \" . $this->getTicksPerSecondAverage() .\n\t\t\t\" | Load \" . $this->getTickUsageAverage() . \"%\\x07\";\n\n\t\t$this->network->resetStatistics();\n\t}\n\n\t/**\n\t * @param string $address\n\t * @param int    $port\n\t * @param string $payload\n\t *\n\t * TODO: move this to Network\n\t */\n\tpublic function handlePacket($address, $port, $payload){\n\t\ttry{\n\t\t\tif(strlen($payload) > 2 and substr($payload, 0, 2) === \"\\xfe\\xfd\" and $this->queryHandler instanceof QueryHandler){\n\t\t\t\t$this->queryHandler->handle($address, $port, $payload);\n\t\t\t}\n\t\t}catch(\\Throwable $e){\n\t\t\tif(\\pocketmine\\DEBUG > 1){\n\t\t\t\tif($this->logger instanceof MainLogger){\n\t\t\t\t\t$this->logger->logException($e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->getNetwork()->blockAddress($address, 600);\n\t\t}\n\t\t//TODO: add raw packet events\n\t}\n\n\t/**\n\t * @param             $variable\n\t * @param null        $defaultValue\n\t * @param Config|null $cfg\n\t * @return bool|mixed|null\n\t */\n\tpublic function getAdvancedProperty($variable, $defaultValue = null, Config $cfg = null){\n\t\t$vars = explode(\".\", $variable);\n\t\t$base = array_shift($vars);\n\t\tif($cfg == null) $cfg = $this->advancedConfig;\n\t\tif($cfg->exists($base)){\n\t\t\t$base = $cfg->get($base);\n\t\t}else{\n\t\t\treturn $defaultValue;\n\t\t}\n\n\t\twhile(count($vars) > 0){\n\t\t\t$baseKey = array_shift($vars);\n\t\t\tif(is_array($base) and isset($base[$baseKey])){\n\t\t\t\t$base = $base[$baseKey];\n\t\t\t}else{\n\t\t\t\treturn $defaultValue;\n\t\t\t}\n\t\t}\n\n\t\treturn $base;\n\t}\n\n\tpublic function updateQuery(){\n\t\ttry{\n\t\t\t$this->getPluginManager()->callEvent($this->queryRegenerateTask = new QueryRegenerateEvent($this, 5));\n\t\t\tif($this->queryHandler !== null){\n\t\t\t\t$this->queryHandler->regenerateInfo();\n\t\t\t}\n\t\t}catch(\\Throwable $e){\n\t\t\t$this->logger->logException($e);\n\t\t}\n\t}\n\n\n\t/**\n\t * Tries to execute a server tick\n\t */\n\tprivate function tick(){\n\t\t$tickTime = microtime(true);\n\t\tif(($tickTime - $this->nextTick) < -0.025){ //Allow half a tick of diff\n\t\t\treturn false;\n\t\t}\n\n\t\tTimings::$serverTickTimer->startTiming();\n\n\t\t++$this->tickCounter;\n\n\t\t$this->checkConsole();\n\n\t\tTimings::$connectionTimer->startTiming();\n\t\t$this->network->processInterfaces();\n\n\t\tif($this->rcon !== null){\n\t\t\t$this->rcon->check();\n\t\t}\n\n\t\tTimings::$connectionTimer->stopTiming();\n\n\t\tTimings::$schedulerTimer->startTiming();\n\t\t$this->scheduler->mainThreadHeartbeat($this->tickCounter);\n\t\tTimings::$schedulerTimer->stopTiming();\n\n\t\t$this->checkTickUpdates($this->tickCounter, $tickTime);\n\n\t\tforeach($this->players as $player){\n\t\t\t$player->checkNetwork();\n\t\t}\n\n\t\tif(($this->tickCounter & 0b1111) === 0){\n\t\t\t$this->titleTick();\n\t\t\t$this->maxTick = 20;\n\t\t\t$this->maxUse = 0;\n\n\t\t\tif(($this->tickCounter & 0b111111111) === 0){\n\t\t\t\tif(($this->dserverConfig[\"enable\"] and $this->dserverConfig[\"queryTickUpdate\"]) or !$this->dserverConfig[\"enable\"]){\n\t\t\t\t\t$this->updateQuery();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->getNetwork()->updateName();\n\t\t}\n\n\t\tif($this->autoSave and ++$this->autoSaveTicker >= $this->autoSaveTicks){\n\t\t\t$this->autoSaveTicker = 0;\n\t\t\t$this->doAutoSave();\n\t\t}\n\n\t\t/*if($this->sendUsageTicker > 0 and --$this->sendUsageTicker === 0){\n\t\t\t$this->sendUsageTicker = 6000;\n\t\t\t$this->sendUsage(SendUsageTask::TYPE_STATUS);\n\t\t}*/\n\n\t\tif(($this->tickCounter % 100) === 0){\n\t\t\tforeach($this->levels as $level){\n\t\t\t\t$level->clearCache();\n\t\t\t}\n\n\t\t\tif($this->getTicksPerSecondAverage() < 1){\n\t\t\t\t$this->logger->warning($this->getLanguage()->translateString(\"pocketmine.server.tickOverload\"));\n\t\t\t}\n\t\t}\n\n\t\tif($this->dispatchSignals and $this->tickCounter % 5 === 0){\n\t\t\tpcntl_signal_dispatch();\n\t\t}\n\n\t\t$this->getMemoryManager()->check();\n\n\t\tTimings::$serverTickTimer->stopTiming();\n\n\t\t$now = microtime(true);\n\t\t$tick = min(20, 1 / max(0.001, $now - $tickTime));\n\t\t$use = min(1, ($now - $tickTime) / 0.05);\n\n\t\t//TimingsHandler::tick($tick <= $this->profilingTickRate);\n\n\t\tif($this->maxTick > $tick){\n\t\t\t$this->maxTick = $tick;\n\t\t}\n\n\t\tif($this->maxUse < $use){\n\t\t\t$this->maxUse = $use;\n\t\t}\n\n\t\tarray_shift($this->tickAverage);\n\t\t$this->tickAverage[] = $tick;\n\t\tarray_shift($this->useAverage);\n\t\t$this->useAverage[] = $use;\n\n\t\tif(($this->nextTick - $tickTime) < -1){\n\t\t\t$this->nextTick = $tickTime;\n\t\t}else{\n\t\t\t$this->nextTick += 0.05;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/Thread.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\n/**\n * This class must be extended by all custom threading classes\n */\nabstract class Thread extends \\Thread{\n\n\t/** @var \\ClassLoader */\n\tprotected $classLoader;\n\tprotected $isKilled = false;\n\n\tpublic function getClassLoader(){\n\t\treturn $this->classLoader;\n\t}\n\n\tpublic function setClassLoader(\\ClassLoader $loader = null){\n\t\tif($loader === null){\n\t\t\t$loader = Server::getInstance()->getLoader();\n\t\t}\n\t\t$this->classLoader = $loader;\n\t}\n\n\tpublic function registerClassLoader(){\n\t\tif(!interface_exists(\"ClassLoader\", false)){\n\t\t\trequire(\\pocketmine\\PATH . \"src/spl/ClassLoader.php\");\n\t\t\trequire(\\pocketmine\\PATH . \"src/spl/BaseClassLoader.php\");\n\t\t\trequire(\\pocketmine\\PATH . \"src/pocketmine/CompatibleClassLoader.php\");\n\t\t}\n\t\tif($this->classLoader !== null){\n\t\t\t$this->classLoader->register(true);\n\t\t}\n\t}\n\n\tpublic function start(int $options = PTHREADS_INHERIT_ALL){\n\t\tThreadManager::getInstance()->add($this);\n\n\t\tif(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){\n\t\t\tif($this->getClassLoader() === null){\n\t\t\t\t$this->setClassLoader();\n\t\t\t}\n\t\t\treturn parent::start($options);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Stops the thread using the best way possible. Try to stop it yourself before calling this.\n\t */\n\tpublic function quit(){\n\t\t$this->isKilled = true;\n\n\t\t$this->notify();\n\n\t\tif(!$this->isJoined()){\n\t\t\tif(!$this->isTerminated()){\n\t\t\t\t$this->join();\n\t\t\t}\n\t\t}\n\n\t\tThreadManager::getInstance()->remove($this);\n\t}\n\n\tpublic function getThreadName(){\n\t\treturn (new \\ReflectionClass($this))->getShortName();\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/ThreadManager.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\nclass ThreadManager extends \\Volatile{\n\n\t/** @var ThreadManager */\n\tprivate static $instance = null;\n\n\tpublic static function init(){\n\t\tself::$instance = new ThreadManager();\n\t}\n\n\t/**\n\t * @return ThreadManager\n\t */\n\tpublic static function getInstance(){\n\t\treturn self::$instance;\n\t}\n\n\t/**\n\t * @param Worker|Thread $thread\n\t */\n\tpublic function add($thread){\n\t\tif($thread instanceof Thread or $thread instanceof Worker){\n\t\t\t$this->{spl_object_hash($thread)} = $thread;\n\t\t}\n\t}\n\n\t/**\n\t * @param Worker|Thread $thread\n\t */\n\tpublic function remove($thread){\n\t\tif($thread instanceof Thread or $thread instanceof Worker){\n\t\t\tunset($this->{spl_object_hash($thread)});\n\t\t}\n\t}\n\n\t/**\n\t * @return Worker[]|Thread[]\n\t */\n\tpublic function getAll(){\n\t\t$array = [];\n\t\tforeach($this as $key => $thread){\n\t\t\t$array[$key] = $thread;\n\t\t}\n\n\t\treturn $array;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/Worker.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine;\n\n/**\n * This class must be extended by all custom threading classes\n */\nabstract class Worker extends \\Worker{\n\n\t/** @var \\ClassLoader */\n\tprotected $classLoader;\n\t\n\tprotected $isKilled = false;\n\n\tpublic function getClassLoader(){\n\t\treturn $this->classLoader;\n\t}\n\n\tpublic function setClassLoader(\\ClassLoader $loader = null){\n\t\tif($loader === null){\n\t\t\t$loader = Server::getInstance()->getLoader();\n\t\t}\n\t\t$this->classLoader = $loader;\n\t}\n\n\tpublic function registerClassLoader(){\n\t\tif(!interface_exists(\"ClassLoader\", false)){\n\t\t\trequire(\\pocketmine\\PATH . \"src/spl/ClassLoader.php\");\n\t\t\trequire(\\pocketmine\\PATH . \"src/spl/BaseClassLoader.php\");\n\t\t\trequire(\\pocketmine\\PATH . \"src/pocketmine/CompatibleClassLoader.php\");\n\t\t}\n\t\tif($this->classLoader !== null){\n\t\t\t$this->classLoader->register(true);\n\t\t}\n\t}\n\n\tpublic function start(int $options = PTHREADS_INHERIT_ALL){\n\t\tThreadManager::getInstance()->add($this);\n\n\t\tif(!$this->isRunning() and !$this->isJoined() and !$this->isTerminated()){\n\t\t\tif($this->getClassLoader() === null){\n\t\t\t\t$this->setClassLoader();\n\t\t\t}\n\t\t\treturn parent::start($options);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Stops the thread using the best way possible. Try to stop it yourself before calling this.\n\t */\n\tpublic function quit(){\n\t\t$this->isKilled = true;\n\n\t\t$this->notify();\n\t\t\n\t\tif($this->isRunning()){\n\t\t\t$this->shutdown();\n\t\t\t$this->notify();\n\t\t\t$this->unstack();\n\t\t}elseif(!$this->isJoined()){\n\t\t\tif(!$this->isTerminated()){\n\t\t\t\t$this->join();\n\t\t\t}\n\t\t}\n\n\t\tThreadManager::getInstance()->remove($this);\n\t}\n\n\tpublic function getThreadName(){\n\t\treturn (new \\ReflectionClass($this))->getShortName();\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/AcaciaDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass AcaciaDoor extends Door{\n\n\tprotected $id = self::ACACIA_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Acacia Door Block\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::ACACIA_DOOR, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/AcaciaDoorBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass AcaciaDoorBlock extends Solid{\n\n\tprotected $id = self::ACACIA_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Acacia Door Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/AcaciaWoodStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass AcaciaWoodStairs extends WoodStairs{\n\n\tprotected $id = self::ACACIA_WOOD_STAIRS;\n\n\tpublic function getName(){\n\t\treturn \"Acacia Wood Stairs\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/ActivatorRail.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass ActivatorRail extends PoweredRail {\n\n    protected $id = self::ACTIVATOR_RAIL;\n\n    public function __construct($meta = 0){\n        $this->meta = $meta;\n    }\n\n    public function getName() {\n        return \"Activator Rail\";\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/block/ActiveRedstoneLamp.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\Vector3;\n\nclass ActiveRedstoneLamp extends Solid implements ElectricalAppliance, SolidLight{\n\tprotected $id = self::ACTIVE_REDSTONE_LAMP;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Active Redstone Lamp\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::INACTIVE_REDSTONE_LAMP, 0 ,1],\n\t\t];\n\t}\n\n\tpublic function isLightedByAround(){\n\t\treturn ($this->meta == 1);\n\t}\n\n\tprotected function checkPower(array $ignore = []){\n\t\tif($this->isLightedByAround()){\n\t\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP, Vector3::SIDE_DOWN];\n\t\t\tforeach($sides as $side){\n\t\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t\t/** @var ActiveRedstoneLamp $block */\n\t\t\t\t\t$block = $this->getSide($side);\n\t\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\t\tif(!$block->isLightedByAround()) return true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function lightAround(){\n\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP, Vector3::SIDE_DOWN];\n\t\tforeach($sides as $side){\n\t\t\t/** @var InactiveRedstoneLamp $block */\n\t\t\t$block = $this->getSide($side);\n\t\t\tif($block->getId() == self::INACTIVE_REDSTONE_LAMP){\n\t\t\t\t$block->turnOn();\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected function turnAroundOff(array $ignore = []){\n\t\tif(!$this->isLightedByAround()){\n\t\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP, Vector3::SIDE_DOWN];\n\n\t\t\tforeach($sides as $side){\n\t\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t\t/** @var ActiveRedstoneLamp $block */\n\t\t\t\t\t$block = $this->getSide($side);\n\t\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\t\tif($block->isLightedByAround()){\n\t\t\t\t\t\t\tif(!$block->checkPower([$this->getOppositeSide($side)])) $block->turnOff();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function turnOn(){\n\t\t/*if($this->isLightedByAround()){\n\t\t\t$this->meta = 0;\n\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t$this->lightAround();\n\t\t}*/\n\t\t$this->meta = 0;\n\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\treturn true;\n\t}\n\n\tpublic function turnOff(){\n\t\t$this->getLevel()->setBlock($this, new InactiveRedstoneLamp(), true, true);\n\t\t//$this->turnAroundOff();\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Air.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\n\n\n/**\n * Air block\n */\nclass Air extends Transparent{\n\n\tprotected $id = self::AIR;\n\tprotected $meta = 0;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Air\";\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn true;\n\t}\n\n\tpublic function isBreakable(Item $item){\n\t\treturn false;\n\t}\n\n\tpublic function canBeFlowedInto(){\n\t\treturn true;\n\t}\n\n\tpublic function canBeReplaced(){\n\t\treturn true;\n\t}\n\n\tpublic function canBePlaced(){\n\t\treturn false;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn null;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 0;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Anvil.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\inventory\\AnvilInventory;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\level\\sound\\AnvilFallSound;\nuse pocketmine\\Player;\n\nclass Anvil extends Fallable{\n\t\n\tconst NORMAL = 0;\n\tconst SLIGHTLY_DAMAGED = 4;\n\tconst VERY_DAMAGED = 8;\n\t\n\tprotected $id = self::ANVIL;\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 6000;\n\t}\n\n\tpublic function getName(){\n\t\t$names = [\n\t\t\tself::NORMAL => \"Anvil\",\n\t\t\tself::SLIGHTLY_DAMAGED => \"Slightly Damaged Anvil\",\n\t\t\tself::VERY_DAMAGED => \"Very Damaged Anvil\",\n\t\t\t12 => \"Anvil\" //just in case somebody uses /give to get an anvil with damage 12 or higher, to prevent crash\n\t\t];\n\t\treturn $names[$this->meta & 0x0c];\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif(!$this->getLevel()->getServer()->anvilEnabled){\n\t\t\treturn true;\n\t\t}\n\t\tif($player instanceof Player){\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$player->addWindow(new AnvilInventory($this));\n\t\t\t$player->craftingType = Player::CRAFTING_ANVIL;\n\t\t}\n\n\t\treturn true;\n\t}\n\t\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$direction = ($player !== null? $player->getDirection(): 0) & 0x03;\n\t\t$this->meta = ($this->meta & 0x0c) | $direction;\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[$this->id, $this->meta & 0x0c, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Beacon.php",
    "content": "<?php\n\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author H4PM Team\n * @link http://www.github.net/H4PM\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n//use pocketmine\\inventory\\BeaconInventory;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\nuse pocketmine\\item\\Tool;\n\nclass Beacon extends Transparent implements SolidLight{\n\n\tprotected $id = self::BEACON;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\t/*public function canBeActivated() : bool{\n\t\treturn true;\n\t}*/\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 3;\n\t}\n\n\tpublic function getName(){\n        return \"Beacon\";\n\t}\n\n\t/*public function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$player->addWindow(new BeaconInventory($this));\n\t\t}\n\n\t\treturn true;\n\t}*/\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Bed.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Explosion;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass Bed extends Transparent{\n\n\tprotected $id = self::BED_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.2;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Bed Block\";\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 0.5625,\n\t\t\t$this->z + 1\n\t\t);\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($this->getLevel()->getDimension() == Level::DIMENSION_NETHER){\n\t\t\t$explosion = new Explosion($this, 6, $this);\n\t\t\t$explosion->explode();\n\t\t\treturn true;\n\t\t}\n\n\t\t$time = $this->getLevel()->getTime() % Level::TIME_FULL;\n\n\t\t$isNight = ($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE);\n\n\t\tif($player instanceof Player and !$isNight){\n\t\t\t$player->sendMessage(TextFormat::GRAY . \"You can only sleep at night\");\n\t\t\treturn true;\n\t\t}\n\n\t\t$blockNorth = $this->getSide(2); //Gets the blocks around them\n\t\t$blockSouth = $this->getSide(3);\n\t\t$blockEast = $this->getSide(5);\n\t\t$blockWest = $this->getSide(4);\n\t\tif(($this->meta & 0x08) === 0x08){ //This is the Top part of bed\n\t\t\t$b = $this;\n\t\t}else{ //Bottom Part of Bed\n\t\t\tif($blockNorth->getId() === $this->id and ($blockNorth->meta & 0x08) === 0x08){\n\t\t\t\t$b = $blockNorth;\n\t\t\t}elseif($blockSouth->getId() === $this->id and ($blockSouth->meta & 0x08) === 0x08){\n\t\t\t\t$b = $blockSouth;\n\t\t\t}elseif($blockEast->getId() === $this->id and ($blockEast->meta & 0x08) === 0x08){\n\t\t\t\t$b = $blockEast;\n\t\t\t}elseif($blockWest->getId() === $this->id and ($blockWest->meta & 0x08) === 0x08){\n\t\t\t\t$b = $blockWest;\n\t\t\t}else{\n\t\t\t\tif($player instanceof Player){\n\t\t\t\t\t$player->sendMessage(TextFormat::GRAY . \"This bed is incomplete\");\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\tif($player instanceof Player and $player->sleepOn($b) === false){\n\t\t\t$player->sendMessage(TextFormat::GRAY . \"This bed is occupied\");\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->isTransparent() === false){\n\t\t\t$faces = [\n\t\t\t\t0 => 3,\n\t\t\t\t1 => 4,\n\t\t\t\t2 => 2,\n\t\t\t\t3 => 5,\n\t\t\t];\n\t\t\t$d = $player instanceof Player ? $player->getDirection() : 0;\n\t\t\t$next = $this->getSide($faces[(($d + 3) % 4)]);\n\t\t\t$downNext = $this->getSide(0);\n\t\t\tif($next->canBeReplaced() === true and $downNext->isTransparent() === false){\n\t\t\t\t$meta = (($d + 3) % 4) & 0x03;\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get($this->id, $meta), true, true);\n\t\t\t\t$this->getLevel()->setBlock($next, Block::get($this->id, $meta | 0x08), true, true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$sides = [\n\t\t\t0 => 3,\n\t\t\t1 => 4,\n\t\t\t2 => 2,\n\t\t\t3 => 5,\n\t\t\t8 => 2,\n\t\t\t9 => 5,\n\t\t\t10 => 3,\n\t\t\t11 => 4,\n\t\t];\n\n\t\tif(($this->meta & 0x08) === 0x08){ //This is the Top part of bed\n\t\t\t$next = $this->getSide($sides[$this->meta]);\n\t\t\tif($next->getId() === $this->id and ($next->meta | 0x08) === $this->meta){ //Checks if the block ID and meta are right\n\t\t\t\t$this->getLevel()->setBlock($next, new Air(), true, true);\n\t\t\t}\n\t\t}else{ //Bottom Part of Bed\n\t\t\t$next = $this->getSide($sides[$this->meta]);\n\t\t\tif($next->getId() === $this->id and $next->meta === ($this->meta | 0x08)){\n\t\t\t\t$this->getLevel()->setBlock($next, new Air(), true, true);\n\t\t\t}\n\t\t}\n\t\t$this->getLevel()->setBlock($this, new Air(), true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::BED, 0, 1],\n\t\t];\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Bedrock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\n\nclass Bedrock extends Solid{\n\n\tprotected $id = self::BEDROCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Bedrock\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn -1;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 18000000;\n\t}\n\n\tpublic function isBreakable(Item $item){\n\t\treturn false;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Beetroot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\n\nclass Beetroot extends Crops{\n\n\tprotected $id = self::BEETROOT_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Beetroot Block\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($this->meta >= 0x07){\n\t\t\t$drops[] = [Item::BEETROOT, 0, 1];\n\t\t\t$drops[] = [Item::BEETROOT_SEEDS, 0, mt_rand(0, 3)];\n\t\t}else{\n\t\t\t$drops[] = [Item::BEETROOT_SEEDS, 0, 1];\n\t\t}\n\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/BirchDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass BirchDoor extends Door{\n\n\tprotected $id = self::BIRCH_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Birch Door Block\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::BIRCH_DOOR, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/BirchDoorBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass BirchDoorBlock extends Solid{\n\n\tprotected $id = self::BIRCH_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Birch Door Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/BirchWoodStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass BirchWoodStairs extends WoodStairs{\n\n\tprotected $id = self::BIRCH_WOOD_STAIRS;\n\n\tpublic function getName(){\n\t\treturn \"Birch Wood Stairs\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Block.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * All Block classes are in here\n */\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\block\\BlockBurnEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\MovingObjectPosition;\nuse pocketmine\\level\\Position;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\metadata\\Metadatable;\nuse pocketmine\\metadata\\MetadataValue;\nuse pocketmine\\Player;\nuse pocketmine\\plugin\\Plugin;\n\nclass Block extends Position implements BlockIds, Metadatable{\t\n\n\t/** @var \\SplFixedArray */\n\tpublic static $list = null;\n\t/** @var \\SplFixedArray */\n\tpublic static $fullList = null;\n\n\t/** @var \\SplFixedArray */\n\tpublic static $light = null;\n\t/** @var \\SplFixedArray */\n\tpublic static $lightFilter = null;\n\t/** @var \\SplFixedArray */\n\tpublic static $solid = null;\n\t/** @var \\SplFixedArray */\n\tpublic static $hardness = null;\n\t/** @var \\SplFixedArray */\n\tpublic static $transparent = null;\n\n\tprotected $id;\n\tprotected $meta = 0;\n\n\t/** @var AxisAlignedBB */\n\tpublic $boundingBox = null;\n\n\tpublic static function init(){\n\t\tif(self::$list === null){\n\t\t\tself::$list = new \\SplFixedArray(256);\n\t\t\tself::$fullList = new \\SplFixedArray(4096);\n\t\t\tself::$light = new \\SplFixedArray(256);\n\t\t\tself::$lightFilter = new \\SplFixedArray(256);\n\t\t\tself::$solid = new \\SplFixedArray(256);\n\t\t\tself::$hardness = new \\SplFixedArray(256);\n\t\t\tself::$transparent = new \\SplFixedArray(256);\n\t\t\tself::$list[self::AIR] = Air::class;\n\t\t\tself::$list[self::STONE] = Stone::class;\n\t\t\tself::$list[self::GRASS] = Grass::class;\n\t\t\tself::$list[self::DIRT] = Dirt::class;\n\t\t\tself::$list[self::COBBLESTONE] = Cobblestone::class;\n\t\t\tself::$list[self::PLANKS] = Planks::class;\n\t\t\tself::$list[self::SAPLING] = Sapling::class;\n\t\t\tself::$list[self::BEDROCK] = Bedrock::class;\n\t\t\tself::$list[self::WATER] = Water::class;\n\t\t\tself::$list[self::STILL_WATER] = StillWater::class;\n\t\t\tself::$list[self::LAVA] = Lava::class;\n\t\t\tself::$list[self::STILL_LAVA] = StillLava::class;\n\t\t\tself::$list[self::SAND] = Sand::class;\n\t\t\tself::$list[self::GRAVEL] = Gravel::class;\n\t\t\tself::$list[self::GOLD_ORE] = GoldOre::class;\n\t\t\tself::$list[self::IRON_ORE] = IronOre::class;\n\t\t\tself::$list[self::COAL_ORE] = CoalOre::class;\n\t\t\tself::$list[self::WOOD] = Wood::class;\n\t\t\tself::$list[self::LEAVES] = Leaves::class;\n\t\t\tself::$list[self::SPONGE] = Sponge::class;\n\t\t\tself::$list[self::GLASS] = Glass::class;\n\t\t\tself::$list[self::LAPIS_ORE] = LapisOre::class;\n\t\t\tself::$list[self::LAPIS_BLOCK] = Lapis::class;\n\t\t\tself::$list[self::SANDSTONE] = Sandstone::class;\n\t\t\tself::$list[self::RED_SANDSTONE] = RedSandstone::class;\n\t\t\tself::$list[self::RED_SANDSTONE_STAIRS] = RedSandstoneStairs::class;\n\t\t\tself::$list[self::BED_BLOCK] = Bed::class;\n\t\t\tself::$list[self::COBWEB] = Cobweb::class;\n\t\t\tself::$list[self::TALL_GRASS] = TallGrass::class;\n\t\t\tself::$list[self::DEAD_BUSH] = DeadBush::class;\n\t\t\tself::$list[self::WOOL] = Wool::class;\n\t\t\tself::$list[self::DANDELION] = Dandelion::class;\n\t\t\tself::$list[self::RED_FLOWER] = Flower::class;\n\t\t\tself::$list[self::BROWN_MUSHROOM] = BrownMushroom::class;\n\t\t\tself::$list[self::RED_MUSHROOM] = RedMushroom::class;\n\t\t\tself::$list[self::GOLD_BLOCK] = Gold::class;\n\t\t\tself::$list[self::IRON_BLOCK] = Iron::class;\n\t\t\tself::$list[self::DOUBLE_SLAB] = DoubleSlab::class;\n\t\t\tself::$list[self::SLAB] = Slab::class;\n\t\t\tself::$list[self::RED_SANDSTONE_SLAB] = RedSandstoneSlab::class;\n\t\t\tself::$list[self::DOUBLE_RED_SANDSTONE_SLAB] = DoubleRedSandstoneSlab::class;\n\t\t\tself::$list[self::BRICKS_BLOCK] = Bricks::class;\n\t\t\tself::$list[self::TNT] = TNT::class;\n\t\t\tself::$list[self::BOOKSHELF] = Bookshelf::class;\n\t\t\tself::$list[self::MOSS_STONE] = MossStone::class;\n\t\t\tself::$list[self::OBSIDIAN] = Obsidian::class;\n\t\t\tself::$list[self::TORCH] = Torch::class;\n\t\t\tself::$list[self::FIRE] = Fire::class;\n\t\t\tself::$list[self::MONSTER_SPAWNER] = MonsterSpawner::class;\n\t\t\tself::$list[self::WOOD_STAIRS] = WoodStairs::class;\n\t\t\tself::$list[self::CHEST] = Chest::class;\n\n\t\t\tself::$list[self::DIAMOND_ORE] = DiamondOre::class;\n\t\t\tself::$list[self::DIAMOND_BLOCK] = Diamond::class;\n\t\t\tself::$list[self::WORKBENCH] = Workbench::class;\n\t\t\tself::$list[self::WHEAT_BLOCK] = Wheat::class;\n\t\t\tself::$list[self::FARMLAND] = Farmland::class;\n\t\t\tself::$list[self::FURNACE] = Furnace::class;\n\t\t\tself::$list[self::BURNING_FURNACE] = BurningFurnace::class;\n\t\t\tself::$list[self::SIGN_POST] = SignPost::class;\n\t\t\tself::$list[self::WOOD_DOOR_BLOCK] = WoodDoor::class;\n\t\t\tself::$list[self::SPRUCE_DOOR_BLOCK] = SpruceDoor::class;\n\t\t\tself::$list[self::BIRCH_DOOR_BLOCK] = BirchDoor::class;\n\t\t\tself::$list[self::JUNGLE_DOOR_BLOCK] = JungleDoor::class;\n\t\t\tself::$list[self::ACACIA_DOOR_BLOCK] = AcaciaDoor::class;\n\t\t\tself::$list[self::DARK_OAK_DOOR_BLOCK] = DarkOakDoor::class;\n\t\t\tself::$list[self::LADDER] = Ladder::class;\n\n\t\t\tself::$list[self::COBBLESTONE_STAIRS] = CobblestoneStairs::class;\n\t\t\tself::$list[self::WALL_SIGN] = WallSign::class;\n\n\t\t\tself::$list[self::IRON_DOOR_BLOCK] = IronDoor::class;\n\t\t\tself::$list[self::REDSTONE_ORE] = RedstoneOre::class;\n\t\t\tself::$list[self::GLOWING_REDSTONE_ORE] = GlowingRedstoneOre::class;\n\n\t\t\tself::$list[self::SNOW_LAYER] = SnowLayer::class;\n\t\t\tself::$list[self::ICE] = Ice::class;\n\t\t\tself::$list[self::SNOW_BLOCK] = Snow::class;\n\t\t\tself::$list[self::CACTUS] = Cactus::class;\n\t\t\tself::$list[self::CLAY_BLOCK] = Clay::class;\n\t\t\tself::$list[self::SUGARCANE_BLOCK] = Sugarcane::class;\n\n\t\t\tself::$list[self::FENCE] = Fence::class;\n\t\t\tself::$list[self::PUMPKIN] = Pumpkin::class;\n\t\t\tself::$list[self::NETHERRACK] = Netherrack::class;\n\t\t\tself::$list[self::SOUL_SAND] = SoulSand::class;\n\t\t\tself::$list[self::GLOWSTONE_BLOCK] = Glowstone::class;\n\n\t\t\tself::$list[self::LIT_PUMPKIN] = LitPumpkin::class;\n\t\t\tself::$list[self::CAKE_BLOCK] = Cake::class;\n\n\t\t\tself::$list[self::TRAPDOOR] = Trapdoor::class;\n\t\t\tself::$list[self::IRON_TRAPDOOR] = IronTrapdoor::class;\n\n\t\t\tself::$list[self::STONE_BRICKS] = StoneBricks::class;\n\t\t\t\n\t\t\tself::$list[self::BROWN_MUSHROOM_BLOCK] = BrownMushroomBlock::class;\n\t\t\tself::$list[self::RED_MUSHROOM_BLOCK] = RedMushroomBlock::class;\n\n\t\t\tself::$list[self::IRON_BARS] = IronBars::class;\n\t\t\tself::$list[self::GLASS_PANE] = GlassPane::class;\n\t\t\tself::$list[self::MELON_BLOCK] = Melon::class;\n\t\t\tself::$list[self::PUMPKIN_STEM] = PumpkinStem::class;\n\t\t\tself::$list[self::MELON_STEM] = MelonStem::class;\n\t\t\tself::$list[self::VINE] = Vine::class;\n\t\t\tself::$list[self::FENCE_GATE] = FenceGate::class;\n\t\t\tself::$list[self::BRICK_STAIRS] = BrickStairs::class;\n\t\t\tself::$list[self::STONE_BRICK_STAIRS] = StoneBrickStairs::class;\n\n\t\t\tself::$list[self::MYCELIUM] = Mycelium::class;\n\t\t\tself::$list[self::WATER_LILY] = WaterLily::class;\n\t\t\tself::$list[self::NETHER_BRICKS] = NetherBrick::class;\n\n\t\t\tself::$list[self::PORTAL] = Portal::class;\n\t\t\tself::$list[self::NETHER_BRICKS_STAIRS] = NetherBrickStairs::class;\n\t\t\tself::$list[self::NETHER_WART_BLOCK] = NetherWart::class;\n\t\t\tself::$list[self::ENCHANTING_TABLE] = EnchantingTable::class;\n\n\t\t\tself::$list[self::BREWING_STAND_BLOCK] = BrewingStand::class;\n\t\t\tself::$list[self::END_PORTAL_FRAME] = EndPortalFrame::class;\n\t\t\tself::$list[self::END_STONE] = EndStone::class;\n\n\t\t\tself::$list[self::END_STONE_BRICKS] = EndStoneBricks::class;\n\t\t\tself::$list[self::END_ROD] = EndRod::class;\n\n\t\t\tself::$list[self::PURPUR_BLOCK] = PurpurBlock::class;\n\t\t\tself::$list[self::PURPUR_STAIRS] = PurpurStairs::class;\n\n\t\t\tself::$list[self::CHORUS_PLANT] = ChorusPlant::class;\n\n\t\t\tself::$list[self::SANDSTONE_STAIRS] = SandstoneStairs::class;\n\t\t\tself::$list[self::EMERALD_ORE] = EmeraldOre::class;\n\n\t\t\tself::$list[self::EMERALD_BLOCK] = Emerald::class;\n\t\t\tself::$list[self::SPRUCE_WOOD_STAIRS] = SpruceWoodStairs::class;\n\t\t\tself::$list[self::BIRCH_WOOD_STAIRS] = BirchWoodStairs::class;\n\t\t\tself::$list[self::JUNGLE_WOOD_STAIRS] = JungleWoodStairs::class;\n\t\t\tself::$list[self::BEACON] = Beacon::class;\n\t\t\tself::$list[self::STONE_WALL] = StoneWall::class;\n\n\t\t\tself::$list[self::FLOWER_POT_BLOCK] = FlowerPot::class;\n\t\t\tself::$list[self::CARROT_BLOCK] = Carrot::class;\n\t\t\tself::$list[self::POTATO_BLOCK] = Potato::class;\n\t\t\tself::$list[self::ANVIL] = Anvil::class;\n\n\t\t\tself::$list[self::TRAPPED_CHEST] = TrappedChest::class;\n\t\t\tself::$list[self::REDSTONE_BLOCK] = Redstone::class;\n\n\t\t\tself::$list[self::QUARTZ_BLOCK] = Quartz::class;\n\t\t\tself::$list[self::QUARTZ_STAIRS] = QuartzStairs::class;\n\t\t\tself::$list[self::DOUBLE_WOOD_SLAB] = DoubleWoodSlab::class;\n\t\t\tself::$list[self::WOOD_SLAB] = WoodSlab::class;\n\t\t\tself::$list[self::STAINED_CLAY] = StainedClay::class;\n\n\t\t\tself::$list[self::LEAVES2] = Leaves2::class;\n\t\t\tself::$list[self::WOOD2] = Wood2::class;\n\t\t\tself::$list[self::ACACIA_WOOD_STAIRS] = AcaciaWoodStairs::class;\n\t\t\tself::$list[self::DARK_OAK_WOOD_STAIRS] = DarkOakWoodStairs::class;\n\n\t\t\tself::$list[self::SLIME_BLOCK] = SlimeBlock::class;\n\t\t\tself::$list[self::PRISMARINE] = Prismarine::class;\n\t\t\tself::$list[self::SEA_LANTERN] = SeaLantern::class;\n\t\t\tself::$list[self::HAY_BALE] = HayBale::class;\n\t\t\tself::$list[self::CARPET] = Carpet::class;\n\t\t\tself::$list[self::HARDENED_CLAY] = HardenedClay::class;\n\t\t\tself::$list[self::COAL_BLOCK] = Coal::class;\n\n\t\t\tself::$list[self::PACKED_ICE] = PackedIce::class;\n\t\t\tself::$list[self::DOUBLE_PLANT] = DoublePlant::class;\n\n\t\t\tself::$list[self::FENCE_GATE_SPRUCE] = FenceGateSpruce::class;\n\t\t\tself::$list[self::FENCE_GATE_BIRCH] = FenceGateBirch::class;\n\t\t\tself::$list[self::FENCE_GATE_JUNGLE] = FenceGateJungle::class;\n\t\t\tself::$list[self::FENCE_GATE_DARK_OAK] = FenceGateDarkOak::class;\n\t\t\tself::$list[self::FENCE_GATE_ACACIA] = FenceGateAcacia::class;\n\n\t\t\tself::$list[self::GRASS_PATH] = GrassPath::class;\n\n\t\t\tself::$list[self::PODZOL] = Podzol::class;\n\t\t\tself::$list[self::BEETROOT_BLOCK] = Beetroot::class;\n\t\t\tself::$list[self::STONECUTTER] = Stonecutter::class;\n\t\t\tself::$list[self::GLOWING_OBSIDIAN] = GlowingObsidian::class;\n\t\t\tself::$list[self::NETHER_REACTOR] = NetherReactor::class;\n\n\t\t\tself::$list[self::NETHER_BRICK_FENCE] = NetherBrickFence::class;\n\t\t\tself::$list[self::POWERED_RAIL] = PoweredRail::class;\n\t\t\tself::$list[self::RAIL] = Rail::class;\n\t\t\tself::$list[self::ENDER_CHEST] = EnderChest::class;\n\t\t\tself::$list[self::WOODEN_PRESSURE_PLATE] = WoodenPressurePlate::class;\n\t\t\tself::$list[self::STONE_PRESSURE_PLATE] = StonePressurePlate::class;\n\t\t\tself::$list[self::LIGHT_WEIGHTED_PRESSURE_PLATE] = LightWeightedPressurePlate::class;\n\t\t\tself::$list[self::HEAVY_WEIGHTED_PRESSURE_PLATE] = HeavyWeightedPressurePlate::class;\n\t\t\tself::$list[self::REDSTONE_WIRE] = RedstoneWire::class;\n\t\t\tself::$list[self::ACTIVE_REDSTONE_LAMP] = ActiveRedstoneLamp::class;\n\t\t\tself::$list[self::INACTIVE_REDSTONE_LAMP] = InactiveRedstoneLamp::class;\n\t\t\tself::$list[self::REDSTONE_TORCH] = RedstoneTorch::class;\n\t\t\tself::$list[self::UNLIT_REDSTONE_TORCH] = UnlitRedstoneTorch::class;\n\t\t\tself::$list[self::WOODEN_BUTTON] = WoodenButton::class;\n\t\t\tself::$list[self::STONE_BUTTON] = StoneButton::class;\n\t\t\tself::$list[self::LEVER] = Lever::class;\n\t\t\tself::$list[self::DAYLIGHT_SENSOR] = DaylightDetector::class;\n\t\t\tself::$list[self::DAYLIGHT_SENSOR_INVERTED] = DaylightDetectorInverted::class;\n\t\t\tself::$list[self::NOTEBLOCK] = Noteblock::class;\n\t\t\tself::$list[self::SKULL_BLOCK] = SkullBlock::class;\n\t\t\tself::$list[self::NETHER_QUARTZ_ORE] = NetherQuartzOre::class;\n\t\t\tself::$list[self::ACTIVATOR_RAIL] = ActivatorRail::class;\n\t\t\tself::$list[self::COCOA_BLOCK] = CocoaBlock::class;\n\t\t\tself::$list[self::DETECTOR_RAIL] = DetectorRail::class;\n\t\t\tself::$list[self::TRIPWIRE] = Tripwire::class;\n\t\t\tself::$list[self::TRIPWIRE_HOOK] = TripwireHook::class;\n\t\t\tself::$list[self::ITEM_FRAME_BLOCK] = ItemFrame::class;\n\t\t\tself::$list[self::DISPENSER] = Dispenser::class;\n\t\t\tself::$list[self::DROPPER] = Dropper::class;\n\t\t\tself::$list[self::POWERED_REPEATER_BLOCK] = PoweredRepeater::class;\n\t\t\tself::$list[self::UNPOWERED_REPEATER_BLOCK] = UnpoweredRepeater::class;\n\t\t\tself::$list[self::CAULDRON_BLOCK] = Cauldron::class;\n\t\t\tself::$list[self::INVISIBLE_BEDROCK] = InvisibleBedrock::class;\n\t\t\tself::$list[self::HOPPER_BLOCK] = Hopper::class;\n\n\t\t\tforeach(self::$list as $id => $class){\n\t\t\t\tif($class !== null){\n\t\t\t\t\t/** @var Block $block */\n\t\t\t\t\t$block = new $class();\n\n\t\t\t\t\tfor($data = 0; $data < 16; ++$data){\n\t\t\t\t\t\tself::$fullList[($id << 4) | $data] = new $class($data);\n\t\t\t\t\t}\n\n\t\t\t\t\tself::$solid[$id] = $block->isSolid();\n\t\t\t\t\tself::$transparent[$id] = $block->isTransparent();\n\t\t\t\t\tself::$hardness[$id] = $block->getHardness();\n\t\t\t\t\tself::$light[$id] = $block->getLightLevel();\n\n\t\t\t\t\tif($block->isSolid()){\n\t\t\t\t\t\tif($block->isTransparent()){\n\t\t\t\t\t\t\tif($block instanceof Liquid or $block instanceof Ice){\n\t\t\t\t\t\t\t\tself::$lightFilter[$id] = 2;\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tself::$lightFilter[$id] = 1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}elseif($block instanceof SolidLight){\n\t\t\t\t\t\t\tself::$lightFilter[$id] = 1;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\tself::$lightFilter[$id] = 15;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tself::$lightFilter[$id] = 1;\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tself::$lightFilter[$id] = 1;\n\t\t\t\t\tfor($data = 0; $data < 16; ++$data){\n\t\t\t\t\t\tself::$fullList[($id << 4) | $data] = new Block($id, $data);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param int      $id\n\t * @param int      $meta\n\t * @param Position $pos\n\t *\n\t * @return Block\n\t */\n\tpublic static function get($id, $meta = 0, Position $pos = null){\n\t\tif($id > 0xff){\n\t\t\ttrigger_error(\"BlockID cannot be higher than 255, defaulting to 0\", E_USER_NOTICE);\n\t\t\t$id = 0;\n\t\t}\n\t\ttry{\n\t\t\t$block = self::$list[$id];\n\t\t\tif($block !== null){\n\t\t\t\t$block = new $block($meta);\n\t\t\t}else{\n\t\t\t\t$block = new Block($id, $meta);\n\t\t\t}\n\t\t}catch(\\RuntimeException $e){\n\t\t\t$block = new Block($id, $meta);\n\t\t}\n\n\t\tif($pos !== null){\n\t\t\t$block->x = $pos->x;\n\t\t\t$block->y = $pos->y;\n\t\t\t$block->z = $pos->z;\n\t\t\t$block->level = $pos->level;\n\t\t}\n\n\t\treturn $block;\n\t}\n\n\t/**\n\t * @param int $id\n\t * @param int $meta\n\t */\n\tpublic function __construct($id, $meta = 0){\n\t\t$this->id = (int) $id;\n\t\t$this->meta = (int) $meta;\n\t}\n\n\t/**\n\t * Places the Block, using block space and block target, and side. Returns if the block has been placed.\n\t *\n\t * @param Item   $item\n\t * @param Block  $block\n\t * @param Block  $target\n\t * @param int    $face\n\t * @param float  $fx\n\t * @param float  $fy\n\t * @param float  $fz\n\t * @param Player $player = null\n\t *\n\t * @return bool\n\t */\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\treturn $this->getLevel()->setBlock($this, $this, true, true);\n\t}\n\n\t/**\n\t * Returns if the item can be broken with an specific Item\n\t *\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function isBreakable(Item $item){\n\t\treturn true;\n\t}\n\n\tpublic function tickRate() : int{\n\t\treturn 10;\n\t}\n\n\t/**\n\t * Do the actions needed so the block is broken with the Item\n\t *\n\t * @param Item $item\n\t *\n\t * @return mixed\n\t */\n\tpublic function onBreak(Item $item){\n\t\treturn $this->getLevel()->setBlock($this, new Air(), true, true);\n\t}\n\n\t/**\n\t * Fires a block update on the Block\n\t *\n\t * @param int $type\n\t *\n\t * @return void\n\t */\n\tpublic function onUpdate($type){\n\n\t}\n\n\t/**\n\t * Do actions when activated by Item. Returns if it has done anything\n\t *\n\t * @param Item   $item\n\t * @param Player $player\n\t *\n\t * @return bool\n\t */\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getHardness(){\n\t\treturn 10;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getResistance(){\n\t\treturn $this->getHardness() * 5;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getBurnChance() : int{\n\t\treturn 0;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getBurnAbility() : int{\n\t\treturn 0;\n\t}\n\n\tpublic function isTopFacingSurfaceSolid(){\n\t\tif($this->isSolid()){\n\t\t\treturn true;\n\t\t}else{\n\t\t\tif($this instanceof Stair and ($this->getDamage() &4) == 4){\n\t\t\t\treturn true;\n\t\t\t}elseif($this instanceof Slab and ($this->getDamage() & 8) == 8){\n\t\t\t\treturn true;\n\t\t\t}elseif($this instanceof SnowLayer and ($this->getDamage() & 7) == 7){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function canNeighborBurn(){\n\t\tfor($face = 0; $face < 5; $face++){\n\t\t\tif($this->getSide($face)->getBurnChance() > 0){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_NONE;\n\t}\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getFrictionFactor(){\n\t\treturn 0.6;\n\t}\n\n\t/**\n\t * @return int 0-15\n\t */\n\tpublic function getLightLevel(){\n\t\treturn 0;\n\t}\n\n\t/**\n\t * AKA: Block->isPlaceable\n\t *\n\t * @return bool\n\t */\n\tpublic function canBePlaced(){\n\t\treturn true;\n\t}\n\n\tpublic function isPlaceable(){\n\t\treturn $this->canBePlaced();\n\t}\n\n\t/**\n\t * AKA: Block->canBeReplaced()\n\t *\n\t * @return bool\n\t */\n\tpublic function canBeReplaced(){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isTransparent(){\n\t\treturn false;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn true;\n\t}\n\n\t/**\n\t * AKA: Block->isFlowable\n\t *\n\t * @return bool\n\t */\n\tpublic function canBeFlowedInto(){\n\t\treturn false;\n\t}\n\n\t/**\n\t * AKA: Block->isActivable\n\t *\n\t * @return bool\n\t */\n\tpublic function canBeActivated() : bool{\n\t\treturn false;\n\t}\n\n\tpublic function activate(){\n\t\treturn false;\n\t}\n\n\tpublic function deactivate(){\n\t\treturn false;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn false;\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn false;\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName(){\n\t\treturn \"Unknown\";\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tfinal public function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function addVelocityToEntity(Entity $entity, Vector3 $vector){\n\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tfinal public function getDamage(){\n\t\treturn $this->meta;\n\t}\n\n\t/**\n\t * @param int $meta\n\t */\n\tfinal public function setDamage($meta){\n\t\t$this->meta = $meta & 0x0f;\n\t}\n\n\t/**\n\t * Sets the block position to a new Position object\n\t *\n\t * @param Position $v\n\t */\n\tfinal public function position(Position $v){\n\t\t$this->x = (int) $v->x;\n\t\t$this->y = (int) $v->y;\n\t\t$this->z = (int) $v->z;\n\t\t$this->level = $v->level;\n\t\t$this->boundingBox = null;\n\t}\n\n\t/**\n\t * Returns an array of Item objects to be dropped\n\t *\n\t * @param Item $item\n\t *\n\t * @return array\n\t */\n\tpublic function getDrops(Item $item) : array{\n\t\tif(!isset(self::$list[$this->getId()])){ //Unknown blocks\n\t\t\treturn [];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[$this->getId(), $this->getDamage(), 1],\n\t\t\t];\n\t\t}\n\t}\n\n\t/**\n\t * Returns the seconds that this block takes to be broken using an specific Item\n\t *\n\t * @param Item $item\n\t *\n\t * @return float\n\t */\n\tpublic function getBreakTime(Item $item){\n\t\t$base = $this->getHardness() * 1.5;\n\t\tif($this->canBeBrokenWith($item)){\n\t\t\tif($this->getToolType() === Tool::TYPE_SHEARS and $item->isShears()){\n\t\t\t\t$base /= 15;\n\t\t\t}elseif(\n\t\t\t\t($this->getToolType() === Tool::TYPE_PICKAXE and ($tier = $item->isPickaxe()) !== false) or\n\t\t\t\t($this->getToolType() === Tool::TYPE_AXE and ($tier = $item->isAxe()) !== false) or\n\t\t\t\t($this->getToolType() === Tool::TYPE_SHOVEL and ($tier = $item->isShovel()) !== false)\n\t\t\t){\n\t\t\t\tswitch($tier){\n\t\t\t\t\tcase Tool::TIER_WOODEN:\n\t\t\t\t\t\t$base /= 2;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Tool::TIER_STONE:\n\t\t\t\t\t\t$base /= 4;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Tool::TIER_IRON:\n\t\t\t\t\t\t$base /= 6;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Tool::TIER_DIAMOND:\n\t\t\t\t\t\t$base /= 8;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Tool::TIER_GOLD:\n\t\t\t\t\t\t$base /= 12;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$base *= 3.33;\n\t\t}\n\n\t\tif($item->isSword()){\n\t\t\t$base *= 0.5;\n\t\t}\n\n\t\treturn $base;\n\t}\n\n\tpublic function canBeBrokenWith(Item $item){\n\t\treturn $this->getHardness() !== -1;\n\t}\n\n\t/**\n\t * Returns the Block on the side $side, works like Vector3::side()\n\t *\n\t * @param int $side\n\t * @param int $step\n\t *\n\t * @return Block\n\t */\n\tpublic function getSide($side, $step = 1){\n\t\tif($this->isValid()){\n\t\t\treturn $this->getLevel()->getBlock(Vector3::getSide($side, $step));\n\t\t}\n\n\t\treturn Block::get(Item::AIR, 0, Position::fromObject(Vector3::getSide($side, $step)));\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function __toString(){\n\t\treturn \"Block[\" . $this->getName() . \"] (\" . $this->getId() . \":\" . $this->getDamage() . \")\";\n\t}\n\n\t/**\n\t * Checks for collision against an AxisAlignedBB\n\t *\n\t * @param AxisAlignedBB $bb\n\t *\n\t * @return bool\n\t */\n\tpublic function collidesWithBB(AxisAlignedBB $bb){\n\t\t$bb2 = $this->getBoundingBox();\n\n\t\treturn $bb2 !== null and $bb->intersectsWith($bb2);\n\t}\n\n\t/**\n\t * @param Entity $entity\n\t */\n\tpublic function onEntityCollide(Entity $entity){\n\n\t}\n\n\t/**\n\t * @return AxisAlignedBB\n\t */\n\tpublic function getBoundingBox(){\n\t\tif($this->boundingBox === null){\n\t\t\t$this->boundingBox = $this->recalculateBoundingBox();\n\t\t}\n\t\treturn $this->boundingBox;\n\t}\n\n\t/**\n\t * @return AxisAlignedBB\n\t */\n\tprotected function recalculateBoundingBox(){\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 1,\n\t\t\t$this->z + 1\n\t\t);\n\t}\n\n\t/**\n\t * @param Vector3 $pos1\n\t * @param Vector3 $pos2\n\t *\n\t * @return MovingObjectPosition\n\t */\n\tpublic function calculateIntercept(Vector3 $pos1, Vector3 $pos2){\n\t\t$bb = $this->getBoundingBox();\n\t\tif($bb === null){\n\t\t\treturn null;\n\t\t}\n\n\t\t$v1 = $pos1->getIntermediateWithXValue($pos2, $bb->minX);\n\t\t$v2 = $pos1->getIntermediateWithXValue($pos2, $bb->maxX);\n\t\t$v3 = $pos1->getIntermediateWithYValue($pos2, $bb->minY);\n\t\t$v4 = $pos1->getIntermediateWithYValue($pos2, $bb->maxY);\n\t\t$v5 = $pos1->getIntermediateWithZValue($pos2, $bb->minZ);\n\t\t$v6 = $pos1->getIntermediateWithZValue($pos2, $bb->maxZ);\n\n\t\tif($v1 !== null and !$bb->isVectorInYZ($v1)){\n\t\t\t$v1 = null;\n\t\t}\n\n\t\tif($v2 !== null and !$bb->isVectorInYZ($v2)){\n\t\t\t$v2 = null;\n\t\t}\n\n\t\tif($v3 !== null and !$bb->isVectorInXZ($v3)){\n\t\t\t$v3 = null;\n\t\t}\n\n\t\tif($v4 !== null and !$bb->isVectorInXZ($v4)){\n\t\t\t$v4 = null;\n\t\t}\n\n\t\tif($v5 !== null and !$bb->isVectorInXY($v5)){\n\t\t\t$v5 = null;\n\t\t}\n\n\t\tif($v6 !== null and !$bb->isVectorInXY($v6)){\n\t\t\t$v6 = null;\n\t\t}\n\n\t\t$vector = $v1;\n\n\t\tif($v2 !== null and ($vector === null or $pos1->distanceSquared($v2) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v2;\n\t\t}\n\n\t\tif($v3 !== null and ($vector === null or $pos1->distanceSquared($v3) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v3;\n\t\t}\n\n\t\tif($v4 !== null and ($vector === null or $pos1->distanceSquared($v4) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v4;\n\t\t}\n\n\t\tif($v5 !== null and ($vector === null or $pos1->distanceSquared($v5) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v5;\n\t\t}\n\n\t\tif($v6 !== null and ($vector === null or $pos1->distanceSquared($v6) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v6;\n\t\t}\n\n\t\tif($vector === null){\n\t\t\treturn null;\n\t\t}\n\n\t\t$f = -1;\n\n\t\tif($vector === $v1){\n\t\t\t$f = 4;\n\t\t}elseif($vector === $v2){\n\t\t\t$f = 5;\n\t\t}elseif($vector === $v3){\n\t\t\t$f = 0;\n\t\t}elseif($vector === $v4){\n\t\t\t$f = 1;\n\t\t}elseif($vector === $v5){\n\t\t\t$f = 2;\n\t\t}elseif($vector === $v6){\n\t\t\t$f = 3;\n\t\t}\n\n\t\treturn MovingObjectPosition::fromBlock($this->x, $this->y, $this->z, $f, $vector->add($this->x, $this->y, $this->z));\n\t}\n\n\tpublic function setMetadata($metadataKey, MetadataValue $metadataValue){\n\t\tif($this->getLevel() instanceof Level){\n\t\t\t$this->getLevel()->getBlockMetadata()->setMetadata($this, $metadataKey, $metadataValue);\n\t\t}\n\t}\n\n\tpublic function getMetadata($metadataKey){\n\t\tif($this->getLevel() instanceof Level){\n\t\t\treturn $this->getLevel()->getBlockMetadata()->getMetadata($this, $metadataKey);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function hasMetadata($metadataKey){\n\t\tif($this->getLevel() instanceof Level){\n\t\t\t$this->getLevel()->getBlockMetadata()->hasMetadata($this, $metadataKey);\n\t\t}\n\t}\n\n\tpublic function removeMetadata($metadataKey, Plugin $plugin){\n\t\tif($this->getLevel() instanceof Level){\n\t\t\t$this->getLevel()->getBlockMetadata()->removeMetadata($this, $metadataKey, $plugin);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/BlockIds.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\ninterface BlockIds{\n\t\n\tconst AIR = 0;\n\tconst STONE = 1;\n\tconst GRASS = 2;\n\tconst DIRT = 3;\n\tconst COBBLESTONE = 4;  const COBBLE = 4;\n\tconst PLANK = 5; const PLANKS = 5; const WOODEN_PLANK = 5; const WOODEN_PLANKS = 5;\n\tconst SAPLING = 6; const SAPLINGS = 6;\n\tconst BEDROCK = 7;\n\tconst WATER = 8;\n\tconst STILL_WATER = 9;\n\tconst LAVA = 10;\n\tconst STILL_LAVA = 11;\n\tconst SAND = 12;\n\tconst GRAVEL = 13;\n\tconst GOLD_ORE = 14;\n\tconst IRON_ORE = 15;\n\tconst COAL_ORE = 16;\n\tconst LOG = 17; const WOOD = 17; const TRUNK = 17;\n\tconst LEAVES = 18;\n\tconst SPONGE = 19;\n\tconst GLASS = 20;\n\tconst LAPIS_ORE = 21;\n\tconst LAPIS_BLOCK = 22;\n\tconst DISPENSER = 23;\n\tconst SANDSTONE = 24;\n\tconst NOTEBLOCK = 25;\n\tconst BED_BLOCK = 26;\n\tconst POWERED_RAIL = 27;\n\tconst DETECTOR_RAIL = 28;\n\tconst STICKY_PISTON = 29;\n\tconst COBWEB = 30;\n\tconst TALL_GRASS = 31;\n\tconst BUSH = 32;\n\tconst DEAD_BUSH = 32;\n\tconst PISTON = 33;\n\tconst PISTON_HEAD = 34;\n\tconst WOOL = 35;\n\n\tconst DANDELION = 37;\n\tconst POPPY = 38; const ROSE = 38; const RED_FLOWER = 38;\n\tconst BROWN_MUSHROOM = 39;\n\tconst RED_MUSHROOM = 40;\n\tconst GOLD_BLOCK = 41;\n\tconst IRON_BLOCK = 42;\n\tconst DOUBLE_SLAB = 43; const DOUBLE_SLABS = 43;\n\tconst SLAB = 44; const SLABS = 44; const STONE_SLAB = 44;\n\tconst BRICKS = 45; const BRICKS_BLOCK = 45;\n\tconst TNT = 46;\n\tconst BOOKSHELF = 47;\n\tconst MOSS_STONE = 48; const MOSSY_STONE = 48;\n\tconst OBSIDIAN = 49;\n\tconst TORCH = 50;\n\tconst FIRE = 51;\n\tconst MONSTER_SPAWNER = 52;\n\tconst WOOD_STAIRS = 53; const WOODEN_STAIRS = 53; const OAK_WOOD_STAIRS = 53; const OAK_WOODEN_STAIRS = 53;\n\tconst CHEST = 54;\n\tconst REDSTONE_WIRE = 55;\n\tconst DIAMOND_ORE = 56;\n\tconst DIAMOND_BLOCK = 57;\n\tconst CRAFTING_TABLE = 58; const WORKBENCH = 58;\n\tconst WHEAT_BLOCK = 59;\n\tconst FARMLAND = 60;\n\tconst FURNACE = 61;\n\tconst BURNING_FURNACE = 62; const LIT_FURNACE = 62;\n\tconst SIGN_POST = 63;\n\tconst DOOR_BLOCK = 64; const WOODEN_DOOR_BLOCK = 64; const WOOD_DOOR_BLOCK = 64;\n\tconst LADDER = 65;\n\tconst RAIL = 66;\n\tconst COBBLESTONE_STAIRS = 67; const COBBLE_STAIRS = 67;\n\tconst WALL_SIGN = 68;\n\tconst LEVER = 69;\n\tconst STONE_PRESSURE_PLATE = 70;\n\tconst IRON_DOOR_BLOCK = 71;\n\tconst WOODEN_PRESSURE_PLATE = 72;\n\tconst REDSTONE_ORE = 73;\n\tconst GLOWING_REDSTONE_ORE = 74; const LIT_REDSTONE_ORE = 74;\n\tconst UNLIT_REDSTONE_TORCH = 75;\n\tconst REDSTONE_TORCH = 76; const LIT_REDSTONE_TORCH = 76;\n\tconst STONE_BUTTON = 77;\n\tconst SNOW = 78; const SNOW_LAYER = 78;\n\tconst ICE = 79;\n\tconst SNOW_BLOCK = 80;\n\tconst CACTUS = 81;\n\tconst CLAY_BLOCK = 82;\n\tconst REEDS = 83; const SUGARCANE_BLOCK = 83;\n\n\tconst FENCE = 85;\n\tconst PUMPKIN = 86;\n\tconst NETHERRACK = 87;\n\tconst SOUL_SAND = 88;\n\tconst GLOWSTONE = 89; const GLOWSTONE_BLOCK = 89;\n\tconst PORTAL_BLOCK = 90; const PORTAL = 90;\n\tconst JACK_O_LANTERN = 91; const LIT_PUMPKIN = 91;\n\tconst CAKE_BLOCK = 92;\n\tconst REPEATER_BLOCK = 93; const UNPOWERED_REPEATER_BLOCK = 93;\n\tconst POWERED_REPEATER_BLOCK = 94;\n\tconst INVISIBLE_BEDROCK = 95;\n\tconst TRAPDOOR = 96; const WOODEN_TRAPDOOR = 96;\n\tconst MONSTER_EGG_BLOCK = 97;\n\tconst STONE_BRICKS = 98; const STONE_BRICK = 98;\n\tconst BROWN_MUSHROOM_BLOCK = 99;\n\tconst RED_MUSHROOM_BLOCK = 100;\n\tconst IRON_BARS = 101; const IRON_BAR = 101;\n\tconst GLASS_PANE = 102; const GLASS_PANEL = 102;\n\tconst MELON_BLOCK = 103;\n\tconst PUMPKIN_STEM = 104;\n\tconst MELON_STEM = 105;\n\tconst VINES = 106; const VINE = 106;\n\tconst FENCE_GATE = 107; const OAK_FENCE_GATE = 107;\n\tconst BRICK_STAIRS = 108;\n\tconst STONE_BRICK_STAIRS = 109;\n\tconst MYCELIUM = 110;\n\tconst LILY_PAD = 111; const WATER_LILY = 111;\n\tconst NETHER_BRICKS = 112; const NETHER_BRICK_BLOCK = 112;\n\tconst NETHER_BRICK_FENCE = 113;\n\tconst NETHER_BRICK_STAIRS = 114; const NETHER_BRICKS_STAIRS = 114;\n\tconst NETHER_WART_BLOCK = 115;\n\tconst ENCHANTING_TABLE = 116; const ENCHANT_TABLE = 116; const ENCHANTMENT_TABLE = 116;\n\tconst BREWING_STAND_BLOCK = 117;\n\tconst CAULDRON_BLOCK = 118;\n\tconst END_PORTAL_FRAME = 120; const END_PORTAL = 120;\n\tconst END_STONE = 121;\n\tconst DRAGON_EGG = 122;\n\tconst REDSTONE_LAMP = 123; const INACTIVE_REDSTONE_LAMP = 123;\n\tconst LIT_REDSTONE_LAMP = 124; const ACTIVE_REDSTONE_LAMP = 124;\n\tconst DROPPER = 125;\n\tconst ACTIVATOR_RAIL = 126;\n\tconst COCOA_BLOCK = 127; const COCOA_PODS = 127;\n\tconst SANDSTONE_STAIRS = 128;\n\tconst EMERALD_ORE = 129;\n\tconst ENDER_CHEST = 130;\n\tconst TRIPWIRE_HOOK = 131;\n\tconst TRIPWIRE = 132;\n\tconst EMERALD_BLOCK = 133;\n\tconst SPRUCE_WOOD_STAIRS = 134; const SPRUCE_WOODEN_STAIRS = 134;\n\tconst BIRCH_WOOD_STAIRS = 135; const BIRCH_WOODEN_STAIRS = 135;\n\tconst JUNGLE_WOOD_STAIRS = 136; const JUNGLE_WOODEN_STAIRS = 136;\n\n\tconst BEACON = 138;\n\tconst COBBLESTONE_WALL = 139; const COBBLE_WALL = 139; const STONE_WALL = 139;\n\tconst FLOWER_POT_BLOCK = 140;\n\tconst CARROT_BLOCK = 141;\n\tconst POTATO_BLOCK = 142;\n\tconst WOODEN_BUTTON = 143;\n\tconst MOB_HEAD_BLOCK = 144; const SKULL_BLOCK = 144;\n\tconst ANVIL = 145;\n\tconst TRAPPED_CHEST = 146;\n\tconst WEIGHTED_PRESSURE_PLATE_LIGHT = 147; const LIGHT_WEIGHTED_PRESSURE_PLATE = 147; const GOLD_PRESSURE_PLATE = 147;\n\tconst WEIGHTED_PRESSURE_PLATE_HEAVY = 148; const HEAVY_WEIGHTED_PRESSURE_PLATE = 148; const IRON_PRESSURE_PLATE = 148;\n\tconst COMPARATOR_BLOCK = 149; const UNPOWERED_COMPARATOR_BLOCK = 149;\n\tconst POWERED_COMPARATOR_BLOCK = 150;\n\tconst DAYLIGHT_SENSOR = 151;\n\tconst REDSTONE_BLOCK = 152;\n\tconst NETHER_QUARTZ_ORE = 153;\n\tconst HOPPER_BLOCK = 154;\n\tconst QUARTZ_BLOCK = 155;\n\tconst QUARTZ_STAIRS = 156;\n\tconst DOUBLE_WOOD_SLAB = 157; const DOUBLE_WOODEN_SLAB = 157; const DOUBLE_WOOD_SLABS = 157; const DOUBLE_WOODEN_SLABS = 157;\n\tconst WOOD_SLAB = 158; const WOODEN_SLAB = 158; const WOOD_SLABS = 158; const WOODEN_SLABS = 158;\n\tconst STAINED_CLAY = 159; const STAINED_HARDENED_CLAY = 159;\n\tconst STAINED_GLASS_PANE = 160; const STAINED_GLASS_PANEL = 160; //We can add their textures but Mojang didn't added their and didn't added on the Creative Mode ! #blamemojang\n\tconst LEAVES2 = 161;\n\tconst WOOD2 = 162; const TRUNK2 = 162; const LOG2 = 162;\n\tconst ACACIA_WOOD_STAIRS = 163; const ACACIA_WOODEN_STAIRS = 163;\n\tconst DARK_OAK_WOOD_STAIRS = 164; const DARK_OAK_WOODEN_STAIRS = 164;\n\tconst SLIME_BLOCK = 165;\n\t\n\tconst IRON_TRAPDOOR = 167;\n\tconst PRISMARINE = 168;\n\tconst SEA_LANTERN = 169;\n\tconst HAY_BALE = 170;\n\tconst CARPET = 171;\n\tconst HARDENED_CLAY = 172;\n\tconst COAL_BLOCK = 173;\n\tconst PACKED_ICE = 174;\n\tconst DOUBLE_PLANT = 175;\n\t\n\tconst INVERTED_DAYLIGHT_SENSOR = 178; const DAYLIGHT_SENSOR_INVERTED = 178;\n\tconst RED_SANDSTONE = 179;\n\tconst RED_SANDSTONE_STAIRS = 180;\n\tconst DOUBLE_RED_SANDSTONE_SLAB = 181, DOUBLE_PURPUR_SLAB = 181, DOUBLE_SLAB2 = 181, DOUBLE_SLABS2 = 181; //Hey, Dan here. #blameeveryonewhodidntlistentomein0.15\n\tconst RED_SANDSTONE_SLAB = 182, PURPUR_SLAB = 182, SLAB2 = 182, SLABS2 = 182;\n\tconst SPRUCE_FENCE_GATE = 183; const FENCE_GATE_SPRUCE = 183;\n\tconst BIRCH_FENCE_GATE = 184; const FENCE_GATE_BIRCH = 184;\n\tconst JUNGLE_FENCE_GATE = 185; const FENCE_GATE_JUNGLE = 185;\n\tconst DARK_OAK_FENCE_GATE = 186; const FENCE_GATE_DARK_OAK = 186;\n\tconst ACACIA_FENCE_GATE = 187; const FENCE_GATE_ACACIA = 187;\n\t\n\tconst SPRUCE_DOOR_BLOCK = 193;\n\tconst BIRCH_DOOR_BLOCK = 194;\n\tconst JUNGLE_DOOR_BLOCK = 195;\n\tconst ACACIA_DOOR_BLOCK = 196;\n\tconst DARK_OAK_DOOR_BLOCK = 197;\n\tconst GRASS_PATH = 198;\n\tconst ITEM_FRAME_BLOCK = 199;\n\tconst CHORUS_FLOWER = 200;\n\tconst PURPUR_BLOCK = 201;\n\n\tconst PURPUR_STAIRS = 203;\n\n\tconst END_STONE_BRICKS = 206; const END_BRICKS = 206;\n\n\tconst END_ROD = 208;\n\tconst END_GATEWAY = 209;\n\n\tconst CHORUS_PLANT = 240;\n\tconst STAINED_GLASS = 241; //We can add their textures but Mojang didn't added their and didn't added on the Creative Mode ! #blamemojang\n\tconst PODZOL = 243;\n\tconst BEETROOT_BLOCK = 244;\n\tconst STONECUTTER = 245;\n\tconst GLOWING_OBSIDIAN = 246;\n\tconst NETHER_REACTOR = 247;\n\tconst UPDATE_BLOCK = 248;\n\tconst ATEUPD_BLOCK = 249;\n\tconst BLOCK_MOVED_BY_PISTON = 250;\n\tconst OBSERVER = 251;\n\tconst INFO_RESERVED6 = 255;\n}"
  },
  {
    "path": "src/pocketmine/block/Bookshelf.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Bookshelf extends Solid{\n\n\tprotected $id = self::BOOKSHELF;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Bookshelf\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 30;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 20;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\treturn [\n\t\t\t[Item::BOOK, 0, 3]\n\t\t];\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/BrewingStand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\tile\\BrewingStand as TileBrewingStand;\nuse pocketmine\\math\\Vector3;\n\nclass BrewingStand extends Transparent{\n\n\tprotected $id = self::BREWING_STAND_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($block->getSide(Vector3::SIDE_DOWN)->isTransparent() === false){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\tnew StringTag(\"id\", Tile::BREWING_STAND),\n\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t]);\n\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\tif($item->hasCustomName()){\n\t\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t\t}\n\n\t\t\tif($item->hasCustomBlockData()){\n\t\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t\t$nbt->{$key} = $v;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tTile::createTile(Tile::BREWING_STAND, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 2.5;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 1;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Brewing Stand\";\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t//TODO lock\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t$t = $this->getLevel()->getTile($this);\n\t\t\t//$brewingStand = false;\n\t\t\tif($t instanceof TileBrewingStand){\n\t\t\t\t$brewingStand = $t;\n\t\t\t}else{\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\t\tnew StringTag(\"id\", Tile::BREWING_STAND),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\t\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\t\t$brewingStand = Tile::createTile(Tile::BREWING_STAND, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\t\t\t$player->addWindow($brewingStand->getInventory());\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\t$drops[] = [Item::BREWING_STAND, 0, 1];\n\t\t}\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/BrickStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass BrickStairs extends Stair{\n\n\tprotected $id = self::BRICK_STAIRS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 30;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Brick Stairs\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Bricks.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Bricks extends Solid{\n\n\tprotected $id = self::BRICKS_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 30;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Bricks\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::BRICKS_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/BrownMushroom.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass BrownMushroom extends Flowable{\n\n\tprotected $id = self::BROWN_MUSHROOM;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Brown Mushroom\";\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 1;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->isTransparent() === false){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn null;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/BrownMushroomBlock.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass BrownMushroomBlock extends Solid{\n\t\n\tconst BROWN = 14;\n\n\tprotected $id = self::BROWN_MUSHROOM_BLOCK;\n\n\tpublic function __construct($meta = 14){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Brown Mushroom Block\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.2;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 1;\n\t}\n\t\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::BROWN_MUSHROOM_BLOCK, SELF::BROWN, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[Item::BROWN_MUSHROOM, 0, mt_rand(0, 2)],\n\t\t\t];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/BurningFurnace.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Furnace as TileFurnace;\nuse pocketmine\\tile\\Tile;\n\nclass BurningFurnace extends Solid{\n\n\tprotected $id = self::BURNING_FURNACE;\n\n\tpublic function __construct(){}\n\n\tpublic function getName(){\n\t\treturn \"Burning Furnace\";\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 13;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 4,\n\t\t\t1 => 2,\n\t\t\t2 => 5,\n\t\t\t3 => 3,\n\t\t];\n\t\t$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew ListTag(\"Items\", []),\n\t\t\tnew StringTag(\"id\", Tile::FURNACE),\n\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\tTile::createTile(\"Furnace\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\tif(!(($furnace = $this->getLevel()->getTile($this)) instanceof TileFurnace)){\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\t\tnew StringTag(\"id\", Tile::FURNACE),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\t\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\t\t$furnace = Tile::createTile(\"Furnace\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\n\t\t\tif(isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag){\n\t\t\t\tif($furnace->namedtag->Lock->getValue() !== $item->getCustomName()){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$player->addWindow($furnace->getInventory());\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\t$drops = [];\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\t$drops[] = [Item::FURNACE, 0, 1];\n\t\t}\n\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Cactus.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\event\\entity\\EntityDamageByBlockEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass Cactus extends Transparent{\n\n\tprotected $id = self::CACTUS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.4;\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Cactus\";\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + 0.0625,\n\t\t\t$this->y + 0.0625,\n\t\t\t$this->z + 0.0625,\n\t\t\t$this->x + 0.9375,\n\t\t\t$this->y + 0.9375,\n\t\t\t$this->z + 0.9375\n\t\t);\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\t$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_CONTACT, 1);\n\t\tif($entity->attack($ev->getFinalDamage(), $ev) === true){\n\t\t\t$ev->useArmors();\n\t\t}\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$down = $this->getSide(0);\n\t\t\tif($down->getId() !== self::SAND and $down->getId() !== self::CACTUS){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t}else{\n\t\t\t\tfor($side = 2; $side <= 5; ++$side){\n\t\t\t\t\t$b = $this->getSide($side);\n\t\t\t\t\tif(!$b->canBeFlowedInto()){\n\t\t\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif($this->getSide(0)->getId() !== self::CACTUS){\n\t\t\t\tif($this->meta == 0x0F){\n\t\t\t\t\tfor($y = 1; $y < 3; ++$y){\n\t\t\t\t\t\t$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));\n\t\t\t\t\t\tif($b->getId() === self::AIR){\n\t\t\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Cactus()));\n\t\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t\t$this->getLevel()->setBlock($b, $ev->getNewState(), true);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$this->meta = 0;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this);\n\t\t\t\t}else{\n\t\t\t\t\t++$this->meta;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === self::SAND or $down->getId() === self::CACTUS){\n\t\t\t$block0 = $this->getSide(2);\n\t\t\t$block1 = $this->getSide(3);\n\t\t\t$block2 = $this->getSide(4);\n\t\t\t$block3 = $this->getSide(5);\n\t\t\tif($block0->isTransparent() === true and $block1->isTransparent() === true and $block2->isTransparent() === true and $block3->isTransparent() === true){\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Cake.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\entity\\EntityEatBlockEvent;\nuse pocketmine\\item\\FoodSource;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\n\n\nclass Cake extends Transparent implements FoodSource{\n\n\tprotected $id = self::CAKE_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Cake Block\";\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$f = (1 + $this->getDamage() * 2) / 16;\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + $f,\n\t\t\t$this->y,\n\t\t\t$this->z + 0.0625,\n\t\t\t$this->x + 1 - 0.0625,\n\t\t\t$this->y + 0.5,\n\t\t\t$this->z + 1 - 0.0625\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() !== self::AIR){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->getId() === self::AIR){ //Replace with common break method\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [];\n\t}\n\n\tpublic function canBeConsumed() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function canBeConsumedBy(Entity $entity) : bool{\n\t\treturn $entity instanceof Player and ($entity->getFood() < $entity->getMaxFood()) and $this->canBeConsumed();\n\t}\n\n\tpublic function getResidue(){\n\t\t$new = clone $this;\n\t\treturn $new;\n\t}\n\n\tpublic function getAdditionalEffects() : array{\n\t\treturn [];\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 2;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 0.4;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player and $player->getFood() < 20){\n\t\t\t$player->getServer()->getPluginManager()->callEvent($ev = new EntityEatBlockEvent($player, $this));\n\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t$player->setFood($player->getFood() + 2);\n\t\t\t\t++$this->meta;\n\n\t\t\t\tif($this->meta >= 0x06){\n\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\t}else{\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t}\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Carpet.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\n\nclass Carpet extends Flowable{\n\n\tprotected $id = self::CARPET;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.1;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"White Carpet\",\n\t\t\t1 => \"Orange Carpet\",\n\t\t\t2 => \"Magenta Carpet\",\n\t\t\t3 => \"Light Blue Carpet\",\n\t\t\t4 => \"Yellow Carpet\",\n\t\t\t5 => \"Lime Carpet\",\n\t\t\t6 => \"Pink Carpet\",\n\t\t\t7 => \"Gray Carpet\",\n\t\t\t8 => \"Light Gray Carpet\",\n\t\t\t9 => \"Cyan Carpet\",\n\t\t\t10 => \"Purple Carpet\",\n\t\t\t11 => \"Blue Carpet\",\n\t\t\t12 => \"Brown Carpet\",\n\t\t\t13 => \"Green Carpet\",\n\t\t\t14 => \"Red Carpet\",\n\t\t\t15 => \"Black Carpet\",\n\t\t];\n\t\treturn $names[$this->meta & 0x0f];\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 0.0625,\n\t\t\t$this->z + 1\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() !== self::AIR){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->getId() === self::AIR){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Carrot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Carrot extends Crops{\n\n\tprotected $id = self::CARROT_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Carrot Block\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($this->meta >= 0x07){\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t$drops[] = [Item::CARROT, 0, mt_rand(1, 4 + $fortunel)];\n\t\t}else{\n\t\t\t$drops[] = [Item::CARROT, 0, 1];\n\t\t}\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Cauldron.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\player\\PlayerBucketEmptyEvent;\nuse pocketmine\\event\\player\\PlayerBucketFillEvent;\nuse pocketmine\\event\\player\\PlayerGlassBottleEvent;\nuse pocketmine\\item\\Armor;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\Potion;\nuse pocketmine\\level\\sound\\ExplodeSound;\nuse pocketmine\\level\\sound\\GraySplashSound;\nuse pocketmine\\level\\sound\\SpellSound;\nuse pocketmine\\level\\sound\\SplashSound;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\tile\\Cauldron as TileCauldron;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\utils\\Color;\n\nclass Cauldron extends Solid{\n\n\tprotected $id = self::CAULDRON_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 2;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Cauldron\";\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::CAULDRON),\n\t\t\tnew IntTag(\"x\", $block->x),\n\t\t\tnew IntTag(\"y\", $block->y),\n\t\t\tnew IntTag(\"z\", $block->z),\n\t\t\tnew ShortTag(\"PotionId\", 0xffff),\n\t\t\tnew ByteTag(\"SplashPotion\", 0),\n\t\t\tnew ListTag(\"Items\", [])\n\t\t]);\n\t\t\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\t\t\n\t\t$chunk = $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4);\n\t\t$tile = Tile::createTile(\"Cauldron\", $chunk, $nbt);//\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::CAULDRON, 0, 1]\n\t\t\t];\n\t\t}\n\t\treturn [];\n\t}\n\n\tpublic function update(){//umm... right update method...?\n\t\t$this->getLevel()->setBlock($this, Block::get($this->id, $this->meta + 1), true);\n\t\t$this->getLevel()->setBlock($this, $this, true);//Undo the damage value\n\t}\n\n\tpublic function isEmpty(){\n\t\treturn $this->meta === 0x00;\n\t}\n\n\tpublic function isFull(){\n\t\treturn $this->meta === 0x06;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){//@author iTX. rewrite @Dog194\n\t\t$tile = $this->getLevel()->getTile($this);\n\t\tif(!($tile instanceof TileCauldron)){\n\t\t\treturn false;\n\t\t}\n\t\tswitch($item->getId()){\n\t\t\tcase Item::BUCKET:\n\t\t\t\tif($item->getDamage() === 0){//empty bucket\n\t\t\t\t\tif(!$this->isFull() or $tile->isCustomColor() or $tile->hasPotion()){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$bucket = clone $item;\n\t\t\t\t\t$bucket->setDamage(8);//water bucket\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new PlayerBucketFillEvent($player, $this, 0, $item, $bucket));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t\t$player->getInventory()->setItemInHand($ev->getItem());\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->meta = 0;//empty\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\t\t$this->getLevel()->addSound(new SplashSound($this->add(0.5, 1, 0.5)));\n\t\t\t\t\t}\n\t\t\t\t}elseif($item->getDamage() === 8){//water bucket\n\t\t\t\t\tif($this->isFull() and !$tile->isCustomColor() and !$tile->hasPotion()){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$bucket = clone $item;\n\t\t\t\t\t$bucket->setDamage(0);//empty bucket\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new PlayerBucketEmptyEvent($player, $this, 0, $item, $bucket));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t\t$player->getInventory()->setItemInHand($ev->getItem());\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($tile->hasPotion()){//if has potion\n\t\t\t\t\t\t\t$this->meta = 0;//empty\n\t\t\t\t\t\t\t$tile->setPotionId(0xffff);//reset potion\n\t\t\t\t\t\t\t$tile->setSplashPotion(false);\n\t\t\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t\t\t$this->getLevel()->addSound(new ExplodeSound($this->add(0.5, 0, 0.5)));\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->meta = 6;//fill\n\t\t\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t\t\t$this->getLevel()->addSound(new SplashSound($this->add(0.5, 1, 0.5)));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->update();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Item::DYE:\n\t\t\t\tif($tile->hasPotion()) break;\n\t\t\t\t$color = Color::getDyeColor($item->getDamage());\n\t\t\t\tif($tile->isCustomColor()){\n\t\t\t\t\t$color = Color::averageColor($color, $tile->getCustomColor());\n\t\t\t\t}\n\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t\t/*if($item->getCount() <= 0){\n\t\t\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::AIR));\n\t\t\t\t\t}*/\n\t\t\t\t}\n\t\t\t\t$tile->setCustomColor($color);\n\t\t\t\t$this->getLevel()->addSound(new SplashSound($this->add(0.5, 1, 0.5)));\n\t\t\t\t$this->update();\n\t\t\t\tbreak;\n\t\t\tcase Item::LEATHER_CAP:\n\t\t\tcase Item::LEATHER_TUNIC:\n\t\t\tcase Item::LEATHER_PANTS:\n\t\t\tcase Item::LEATHER_BOOTS:\n\t\t\t\tif($this->isEmpty()) break;\n\t\t\t\tif($tile->isCustomColor()){\n\t\t\t\t\t--$this->meta;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t$newItem = clone $item;\n\t\t\t\t\t/** @var Armor $newItem */\n\t\t\t\t\t$newItem->setCustomColor($tile->getCustomColor());\n\t\t\t\t\t$player->getInventory()->setItemInHand($newItem);\n\t\t\t\t\t$this->getLevel()->addSound(new SplashSound($this->add(0.5, 1, 0.5)));\n\t\t\t\t\tif($this->isEmpty()){\n\t\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\t--$this->meta;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t$newItem = clone $item;\n\t\t\t\t\t/** @var Armor $newItem */\n\t\t\t\t\t$newItem->clearCustomColor();\n\t\t\t\t\t$player->getInventory()->setItemInHand($newItem);\n\t\t\t\t\t$this->getLevel()->addSound(new SplashSound($this->add(0.5, 1, 0.5)));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Item::POTION:\n\t\t\tcase Item::SPLASH_POTION:\n\t\t\t\tif(!$this->isEmpty() and (($tile->getPotionId() !== $item->getDamage() and $item->getDamage() !== Potion::WATER_BOTTLE) or\n\t\t\t\t\t\t($item->getId() === Item::POTION and $tile->getSplashPotion()) or\n\t\t\t\t\t\t($item->getId() === Item::SPLASH_POTION and !$tile->getSplashPotion()) and $item->getDamage() !== 0 or\n\t\t\t\t\t\t($item->getDamage() === Potion::WATER_BOTTLE and $tile->hasPotion()))\n\t\t\t\t){//long...\n\t\t\t\t\t$this->meta = 0x00;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t$tile->setPotionId(0xffff);//reset\n\t\t\t\t\t$tile->setSplashPotion(false);\n\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::GLASS_BOTTLE));\n\t\t\t\t\t}\n\t\t\t\t\t$this->getLevel()->addSound(new ExplodeSound($this->add(0.5, 0, 0.5)));\n\t\t\t\t}elseif($item->getDamage() === Potion::WATER_BOTTLE){//水瓶 喷溅型水瓶\n\t\t\t\t\t$this->meta += 2;\n\t\t\t\t\tif($this->meta > 0x06) $this->meta = 0x06;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::GLASS_BOTTLE));\n\t\t\t\t\t}\n\t\t\t\t\t$tile->setPotionId(0xffff);\n\t\t\t\t\t$tile->setSplashPotion(false);\n\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\t$this->getLevel()->addSound(new SplashSound($this->add(0.5, 1, 0.5)));\n\t\t\t\t}elseif(!$this->isFull()){\n\t\t\t\t\t$this->meta += 2;\n\t\t\t\t\tif($this->meta > 0x06) $this->meta = 0x06;\n\t\t\t\t\t$tile->setPotionId($item->getDamage());\n\t\t\t\t\t$tile->setSplashPotion($item->getId() === Item::SPLASH_POTION);\n\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::GLASS_BOTTLE));\n\t\t\t\t\t}\n\t\t\t\t\t$color = Potion::getColor($item->getDamage());\n\t\t\t\t\t$this->getLevel()->addSound(new SpellSound($this->add(0.5, 1, 0.5), $color[0], $color[1], $color[2]));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Item::GLASS_BOTTLE:\n\t\t\t\t$player->getServer()->getPluginManager()->callEvent($ev = new PlayerGlassBottleEvent($player, $this, $item));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif($this->meta < 2) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif($tile->hasPotion()){\n\t\t\t\t\t$this->meta -= 2;\n\t\t\t\t\tif($tile->getSplashPotion() === true){\n\t\t\t\t\t\t$result = Item::get(Item::SPLASH_POTION, $tile->getPotionId());\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$result = Item::get(Item::POTION, $tile->getPotionId());\n\t\t\t\t\t}\n\t\t\t\t\tif($this->isEmpty()){\n\t\t\t\t\t\t$tile->setPotionId(0xffff);//reset\n\t\t\t\t\t\t$tile->setSplashPotion(false);\n\t\t\t\t\t\t$tile->clearCustomColor();\n\t\t\t\t\t}\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t$this->addItem($item, $player, $result);\n\t\t\t\t\t$color = Potion::getColor($result->getDamage());\n\t\t\t\t\t$this->getLevel()->addSound(new SpellSound($this->add(0.5, 1, 0.5), $color[0], $color[1], $color[2]));\n\t\t\t\t}else{\n\t\t\t\t\t$this->meta -= 2;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t$result = Item::get(Item::POTION, Potion::WATER_BOTTLE);\n\t\t\t\t\t\t$this->addItem($item, $player, $result);\n\t\t\t\t\t}\n\t\t\t\t\t$this->getLevel()->addSound(new GraySplashSound($this->add(0.5, 1, 0.5)));\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function addItem(Item $item, Player $player, Item $result){\n\t\tif($item->getCount() <= 1){\n\t\t\t$player->getInventory()->setItemInHand($result);\n\t\t}else{\n\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\tif($player->getInventory()->canAddItem($result) === true){\n\t\t\t\t$player->getInventory()->addItem($result);\n\t\t\t}else{\n\t\t\t\t$motion = $player->getDirectionVector()->multiply(0.4);\n\t\t\t\t$position = clone $player->getPosition();\n\t\t\t\t$player->getLevel()->dropItem($position->add(0 , 0.5, 0), $result , $motion, 40);\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/CauldronBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass CauldronBlock extends Solid{\n\n\tprotected $id = self::CAULDRON_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Cauldron Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Chest.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Chest as TileChest;\nuse pocketmine\\tile\\Tile;\n\nclass Chest extends Transparent{\n\n\tprotected $id = self::CHEST;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2.5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Chest\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + 0.0625,\n\t\t\t$this->y,\n\t\t\t$this->z + 0.0625,\n\t\t\t$this->x + 0.9375,\n\t\t\t$this->y + 0.9475,\n\t\t\t$this->z + 0.9375\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 4,\n\t\t\t1 => 2,\n\t\t\t2 => 5,\n\t\t\t3 => 3,\n\t\t];\n\n\t\t$chest = null;\n\t\t$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];\n\n\t\tfor($side = 2; $side <= 5; ++$side){\n\t\t\tif(($this->meta === 4 or $this->meta === 5) and ($side === 4 or $side === 5)){\n\t\t\t\tcontinue;\n\t\t\t}elseif(($this->meta === 3 or $this->meta === 2) and ($side === 2 or $side === 3)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$c = $this->getSide($side);\n\t\t\tif($c instanceof Chest and $c->getDamage() === $this->meta){\n\t\t\t\t$tile = $this->getLevel()->getTile($c);\n\t\t\t\tif($tile instanceof TileChest and !$tile->isPaired()){\n\t\t\t\t\t$chest = $tile;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew ListTag(\"Items\", []),\n\t\t\tnew StringTag(\"id\", Tile::CHEST),\n\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\t$tile = Tile::createTile(\"Chest\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\tif($chest instanceof TileChest and $tile instanceof TileChest){\n\t\t\t$chest->pairWith($tile);\n\t\t\t$tile->pairWith($chest);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$t = $this->getLevel()->getTile($this);\n\t\tif($t instanceof TileChest){\n\t\t\t$t->unpair();\n\t\t}\n\t\t$this->getLevel()->setBlock($this, new Air(), true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$top = $this->getSide(1);\n\t\t\tif($top->isTransparent() !== true){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$t = $this->getLevel()->getTile($this);\n\t\t\t$chest = null;\n\t\t\tif($t instanceof TileChest){\n\t\t\t\t$chest = $t;\n\t\t\t}else{\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\t\tnew StringTag(\"id\", Tile::CHEST),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\t\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\t\t$chest = Tile::createTile(\"Chest\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\n\t\t\tif(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag){\n\t\t\t\tif($chest->namedtag->Lock->getValue() !== $item->getCustomName()){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t$player->addWindow($chest->getInventory());\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/ChorusPlant.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____          \r\n * |  __|_              _\r\n * | |__| |      _    _(_)_ __   ___\r\n * |  __| |_   _| |  | | | '_ \\ / _ \\\r\n * | |__| | | | | |/\\| | | | | | (_) |\r\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\r\n *         _|  /                 __| |\r\n *        |___/                 |____/\r\n * \r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author FunnyBuddys\r\n * @link http://www.github.net/H4PM\r\n * \r\n *\r\n*/\r\n\r\nnamespace pocketmine\\block;\r\n\r\nuse pocketmine\\item\\Item;\r\nuse pocketmine\\item\\enchantment\\enchantment;\r\n\r\nclass ChorusPlant extends Crops\r\n{\r\n\r\n    protected $id = self::CHORUS_PLANT;\r\n\r\n    public function __construct($meta = 0)\r\n    {\r\n        $this->meta = $meta;\r\n    }\r\n\r\n    public function getHardness()\r\n    {\r\n        return 0.4;\r\n    }\r\n\r\n    public function getToolType()\r\n    {\r\n        return Tool::TYPE_AXE;\r\n    }\r\n\r\n    public function getName()\r\n    {\r\n        return \"Chorus Plant\";\r\n    }\r\n\r\n    public function getDrops(Item $item): array\r\n    {\r\n        $drops = [];\r\n        if ($this->meta >= 0x07) {\r\n            $fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\r\n            $fortunel = $fortunel > 3 ? 3 : $fortunel;\r\n            $drops[] = [Item::CHORUS_FRUIT, 0, 1];\r\n        }\r\n        return $drops;\r\n    }\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/block/Clay.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Clay extends Solid{\n\n\tprotected $id = self::CLAY_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.6;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Clay Block\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::CLAY, 0, 4],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Coal.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Coal extends Solid{\n\n\tprotected $id = self::COAL_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Coal Block\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::COAL_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/CoalOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass CoalOre extends Solid{\n\n\tprotected $id = self::COAL_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Coal Ore\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::COAL_ORE, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t\t$times = [1,1,2,3,4];\n\t\t\t\t$time = $times[mt_rand(0, $fortunel + 1)];\n\t\t\t\treturn [\n\t\t\t\t\t[Item::COAL, 0, $time],\n\t\t\t\t];\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Cobblestone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Cobblestone extends Solid{\n\n\tprotected $id = self::COBBLESTONE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Cobblestone\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::COBBLESTONE, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/CobblestoneStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass CobblestoneStairs extends Stair{\n\n\tprotected $id = self::COBBLESTONE_STAIRS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Cobblestone Stairs\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Cobweb.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Cobweb extends Flowable{\n\n\tprotected $id = self::COBWEB;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Cobweb\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 4;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHEARS;\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\t$entity->resetFallDistance();\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isShears()){\n\t\t\treturn [\n\t\t\t\t[Item::COBWEB, 0, 1],\n\t\t\t];\n\t\t}elseif($item->isSword() >= Tool::TIER_WOODEN){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::COBWEB, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\treturn [\n\t\t\t\t\t[Item::STRING, 0, 1],\n\t\t\t\t];\n\t\t\t}\n\t\t}\n\t\treturn [];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/CocoaBlock.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass CocoaBlock extends Solid {\n\n    protected $id = self::COCOA_BLOCK;\n\n    public function __construct($meta = 0) {\n        $this->meta = $meta;\n    }\n\n    public function getName() {\n        return \"Cocoa Block\";\n    }\n\n    public function getHardness() {\n        return 0.2;\n    }\n\n    public function getResistance() {\n        return 15;\n    }\n\n    public function canBeActivated() : bool {\n        return true;\n    }\n\n    public function onActivate(Item $item, Player $player = null) {\n        if ($item->getId() === Item::DYE and $item->getDamage() === 0x0F) {\n            $block = clone $this;\n            if ($block->meta > 7) {\n                return false;\n            }\n            $block->meta += 4;\n            Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n            if (!$ev->isCancelled()) {\n                $this->getLevel()->setBlock($this, $ev->getNewState(), true, true);\n            }\n            $item->count--;\n            return true;\n        }\n        return false;\n    }\n\n    public function onUpdate($type) {\n        if ($type === Level::BLOCK_UPDATE_NORMAL) {\n            $faces = [3, 4, 2, 5, 3, 4, 2, 5, 3, 4, 2, 5];\n            if ($this->getSide($faces[$this->meta])->isTransparent() === true) {\n                $this->getLevel()->useBreakOn($this);\n                return Level::BLOCK_UPDATE_NORMAL;\n            }\n        } elseif ($type === Level::BLOCK_UPDATE_RANDOM) {\n            if (mt_rand(0, 45) === 1) {\n                if ($this->meta <= 7) {\n                    $block = clone $this;\n                    $block->meta += 4;\n                    Server::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n                    if (!$ev->isCancelled()) {\n                        $this->getLevel()->setBlock($this, $ev->getNewState(), true, true);\n                    } else {\n                        return Level::BLOCK_UPDATE_RANDOM;\n                    }\n                }\n            } else {\n                return Level::BLOCK_UPDATE_RANDOM;\n            }\n        }\n        return false;\n    }\n\n    public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null) {\n        if ($target->getId() === Block::WOOD and $target->getDamage() === 3) {\n            if ($face !== 0 and $face !== 1) {\n                $faces = [\n                    2 => 0,\n                    3 => 2,\n                    4 => 3,\n                    5 => 1,\n                ];\n                $this->meta = $faces[$face];\n                $this->getLevel()->setBlock($block, Block::get(Item::COCOA_BLOCK, $this->meta), true);\n                return true;\n            }\n        }\n        return false;\n    }\n\n    public function getDrops(Item $item) : array {\n        $drops = [];\n        if ($this->meta >= 8) {\n            $drops[] = [Item::DYE, 3, 3];\n        } else {\n            $drops[] = [Item::DYE, 3, 1];\n        }\n        return $drops;\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/block/ComparatorBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass ComparatorBlock extends Solid{\n\n\tprotected $id = self::COMPARATOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Comparator Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Crops.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nabstract class Crops extends Flowable{\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === self::FARMLAND){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal\n\t\t\t$block = clone $this;\n\t\t\t$block->meta += mt_rand(2, 5);\n\t\t\tif($block->meta > 7){\n\t\t\t\t$block->meta = 7;\n\t\t\t}\n\n\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n\n\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);\n\t\t\t}\n\n\t\t\t$item->count--;\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif(mt_rand(0, 2) == 1){\n\t\t\t\tif($this->meta < 0x07){\n\t\t\t\t\t$block = clone $this;\n\t\t\t\t\t++$block->meta;\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Dandelion.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass Dandelion extends Flowable{\n\n\tprotected $id = self::DANDELION;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Dandelion\";\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === 2 or $down->getId() === 3 or $down->getId() === 60){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/DarkOakDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass DarkOakDoor extends Door{\n\n\tprotected $id = self::DARK_OAK_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Dark Oak Door Block\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::DARK_OAK_DOOR, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/DarkOakDoorBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass DarkOakDoorBlock extends Solid{\n\n\tprotected $id = self::DARK_OAK_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Dark Oak Door Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/DarkOakWoodStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass DarkOakWoodStairs extends WoodStairs{\n\n\tprotected $id = self::DARK_OAK_WOOD_STAIRS;\n\n\tpublic function getName(){\n\t\treturn \"Dark Oak Wood Stairs\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/DaylightDetector.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\tile\\DLDetector;\n\nclass DaylightDetector extends RedstoneSource{\n\tprotected $id = self::DAYLIGHT_SENSOR;\n\t//protected $hasStartedUpdate = false;\n\n\tpublic function getName(){\n\t\treturn \"Daylight Sensor\";\n\t}\n\n\tpublic function getBoundingBox(){\n\t\tif($this->boundingBox === null){\n\t\t\t$this->boundingBox = $this->recalculateBoundingBox();\n\t\t}\n\t\treturn $this->boundingBox;\n\t}\n\n\tpublic function canBeFlowedInto(){\n\t\treturn false;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return DLDetector\n\t */\n\tprotected function getTile(){\n\t\t$t = $this->getLevel()->getTile($this);\n\t\tif($t instanceof DLDetector){\n\t\t\treturn $t;\n\t\t}else{\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::DAY_LIGHT_DETECTOR),\n\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t]);\n\t\t\treturn Tile::createTile(Tile::DAY_LIGHT_DETECTOR, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t}\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\t$this->getLevel()->setBlock($this, new DaylightDetectorInverted(), true, true);\n\t\t$this->getTile()->onUpdate();\n\t\treturn true;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn $this->getTile()->isActivated();\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air());\n\t\tif($this->isActivated()) $this->deactivate();\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.2;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 1;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[self::DAYLIGHT_SENSOR, 0, 1]\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/DaylightDetectorInverted.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass DaylightDetectorInverted extends DaylightDetector{\n\tprotected $id = self::DAYLIGHT_SENSOR_INVERTED;\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\t$this->getLevel()->setBlock($this, new DaylightDetector(), true, true);\n\t\t$this->getTile()->onUpdate();\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/DaylightSensor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass DaylightSensor extends Solid{\n\n\tprotected $id = self::DAYLIGHT_SENSOR;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Daylight Sensor\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/DaylightSensorInverted.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass DaylightSensorInverted extends Solid{\n\n\tprotected $id = self::DAYLIGHT_SENSOR_INVERTED;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Daylight Sensor Inverted\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/DeadBush.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\level\\Level;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass DeadBush extends Flowable{\n\n\tprotected $id = self::DEAD_BUSH;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Dead Bush\";\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === Block::SAND or $down->getId() === Block::PODZOL or\n\t\t\t$down->getId() === Block::HARDENED_CLAY or $down->getId() === Block::STAINED_CLAY){\n\t\t\t$this->getLevel()->setBlock($block, $this, true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isShears()){\n\t\t\treturn [\n\t\t\t\t[Item::DEAD_BUSH, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[Item::STICK, 0, mt_rand(0, 2)],\n\t\t\t];\n\t\t}\n\t\t\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/DetectorRail.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass DetectorRail extends PoweredRail{\n\n    protected $id = self::DETECTOR_RAIL;\n\n    public function __construct($meta = 0){\n        $this->meta = $meta;\n    }\n\n    public function getName() {\n        return \"Detector Rail\";\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/block/Diamond.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Diamond extends Solid{\n\n\tprotected $id = self::DIAMOND_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Diamond Block\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 4){\n\t\t\treturn [\n\t\t\t\t[Item::DIAMOND_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/DiamondOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass DiamondOre extends Solid{\n\n\tprotected $id = self::DIAMOND_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Diamond Ore\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 4){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::DIAMOND_ORE, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t\t$times = [1,1,2,3,4];\n\t\t\t\t$time = $times[mt_rand(0, $fortunel + 1)];\n\t\t\t\treturn [\n\t\t\t\t\t[Item::DIAMOND, 0, $time],\n\t\t\t\t];\n\t\t\t}\n\t\t\t\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Dirt.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\Player;\n\nclass Dirt extends Solid{\n\n\tprotected $id = self::DIRT;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Dirt\";\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($item->isHoe()){\n\t\t\t$item->useOn($this);\n\t\t\t$this->getLevel()->setBlock($this, Block::get(Item::FARMLAND, 0), true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Dispenser.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Dispenser as TileDispenser;\nuse pocketmine\\tile\\Tile;\n\nclass Dispenser extends Solid{\n\n\tprotected $id = self::DISPENSER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3.5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Dispenser\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$dispenser = null;\n\t\tif($player instanceof Player){\n\t\t\t$pitch = $player->getPitch();\n\t\t\tif(abs($pitch) >= 45){\n\t\t\t\tif($pitch < 0) $f = 4;\n\t\t\t\telse $f = 5;\n\t\t\t} else $f = $player->getDirection();\n\t\t} else $f = 0;\n\t\t$faces = [\n\t\t\t3 => 3,\n\t\t\t0 => 4,\n\t\t\t2 => 5,\n\t\t\t1 => 2,\n\t\t\t4 => 0,\n\t\t\t5 => 1\n\t\t];\n\t\t$this->meta = $faces[$f];\n\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew ListTag(\"Items\", []),\n\t\t\tnew StringTag(\"id\", Tile::DISPENSER),\n\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\tTile::createTile(Tile::DISPENSER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\treturn true;\n\t}\n\n\tpublic function activate(){\n\t\t$tile = $this->getLevel()->getTile($this);\n\t\tif($tile instanceof TileDispenser){\n\t\t\t$tile->activate();\n\t\t}\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$t = $this->getLevel()->getTile($this);\n\t\t\t$dispenser = null;\n\t\t\tif($t instanceof TileDispenser){\n\t\t\t\t$dispenser = $t;\n\t\t\t}else{\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\t\tnew StringTag(\"id\", Tile::DISPENSER),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\t\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\t\t$dispenser = Tile::createTile(Tile::DISPENSER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$player->addWindow($dispenser->getInventory());\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Door.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\sound\\DoorSound;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\n\nabstract class Door extends Transparent implements ElectricalAppliance{\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn true;\n\t}\n\n\tprivate function getFullDamage(){\n\t\t$damage = $this->getDamage();\n\t\t$isUp = ($damage & 0x08) > 0;\n\n\t\tif($isUp){\n\t\t\t$down = $this->getSide(Vector3::SIDE_DOWN)->getDamage();\n\t\t\t$up = $damage;\n\t\t}else{\n\t\t\t$down = $damage;\n\t\t\t$up = $this->getSide(Vector3::SIDE_UP)->getDamage();\n\t\t}\n\n\t\t$isRight = ($up & 0x01) > 0;\n\n\t\treturn $down & 0x07 | ($isUp ? 8 : 0) | ($isRight ? 0x10 : 0);\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$f = 0.1875;\n\t\t$damage = $this->getFullDamage();\n\n\t\t$bb = new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 2,\n\t\t\t$this->z + 1\n\t\t);\n\n\t\t$j = $damage & 0x03;\n\t\t$isOpen = (($damage & 0x04) > 0);\n\t\t$isRight = (($damage & 0x10) > 0);\n\n\t\tif($j === 0){\n\t\t\tif($isOpen){\n\t\t\t\tif(!$isRight){\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z,\n\t\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + $f\n\t\t\t\t\t);\n\t\t\t\t}else{\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z + 1 - $f,\n\t\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + 1\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z,\n\t\t\t\t\t$this->x + $f,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + 1\n\t\t\t\t);\n\t\t\t}\n\t\t}elseif($j === 1){\n\t\t\tif($isOpen){\n\t\t\t\tif(!$isRight){\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x + 1 - $f,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z,\n\t\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + 1\n\t\t\t\t\t);\n\t\t\t\t}else{\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z,\n\t\t\t\t\t\t$this->x + $f,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + 1\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z,\n\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + $f\n\t\t\t\t);\n\t\t\t}\n\t\t}elseif($j === 2){\n\t\t\tif($isOpen){\n\t\t\t\tif(!$isRight){\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z + 1 - $f,\n\t\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + 1\n\t\t\t\t\t);\n\t\t\t\t}else{\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z,\n\t\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + $f\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x + 1 - $f,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z,\n\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + 1\n\t\t\t\t);\n\t\t\t}\n\t\t}elseif($j === 3){\n\t\t\tif($isOpen){\n\t\t\t\tif(!$isRight){\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z,\n\t\t\t\t\t\t$this->x + $f,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + 1\n\t\t\t\t\t);\n\t\t\t\t}else{\n\t\t\t\t\t$bb->setBounds(\n\t\t\t\t\t\t$this->x + 1 - $f,\n\t\t\t\t\t\t$this->y,\n\t\t\t\t\t\t$this->z,\n\t\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t\t$this->z + 1\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z + 1 - $f,\n\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + 1\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn $bb;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(Vector3::SIDE_DOWN)->getId() === self::AIR and $this->getSide(Vector3::SIDE_UP) instanceof Door){ //Block underneath the door was broken\n\t\t\t\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), false, false);\n\t\t\t\t$this->getLevel()->setBlock($this->getSide(Vector3::SIDE_UP), new Air(), false);\n\t\t\t\t\n\t\t\t\tforeach($this->getDrops(Item::get(Item::DIAMOND_PICKAXE)) as $drop){\n\t\t\t\t\t$this->getLevel()->dropItem($this, Item::get($drop[0], $drop[1], $drop[2]));\n\t\t\t\t}\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($face === 1){\n\t\t\t$blockUp = $this->getSide(Vector3::SIDE_UP);\n\t\t\t$blockDown = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\tif($blockUp->canBeReplaced() === false or $blockDown->isTransparent() === true){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$direction = $player instanceof Player ? $player->getDirection() : 0;\n\t\t\t$face = [\n\t\t\t\t0 => 3,\n\t\t\t\t1 => 4,\n\t\t\t\t2 => 2,\n\t\t\t\t3 => 5,\n\t\t\t];\n\t\t\t$next = $this->getSide($face[(($direction + 2) % 4)]);\n\t\t\t$next2 = $this->getSide($face[$direction]);\n\t\t\t$metaUp = 0x08;\n\t\t\tif($next->getId() === $this->getId() or ($next2->isTransparent() === false and $next->isTransparent() === true)){ //Door hinge\n\t\t\t\t$metaUp |= 0x01;\n\t\t\t}\n\n\t\t\t$this->setDamage($player->getDirection() & 0x03);\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true); //Bottom\n\t\t\t$this->getLevel()->setBlock($blockUp, $b = Block::get($this->getId(), $metaUp), true); //Top\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\tif(($this->getDamage() & 0x08) === 0x08){\n\t\t\t$down = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\tif($down->getId() === $this->getId()){\n\t\t\t\t$this->getLevel()->setBlock($down, new Air(), true);\n\t\t\t}\n\t\t}else{\n\t\t\t$up = $this->getSide(Vector3::SIDE_UP);\n\t\t\tif($up->getId() === $this->getId()){\n\t\t\t\t$this->getLevel()->setBlock($up, new Air(), true);\n\t\t\t}\n\t\t}\n\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\n\t\treturn true;\n\t}\n\n\tpublic function isOpened(){\n\t\treturn (($this->getFullDamage() & 0x04) > 0);\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif(($this->getDamage() & 0x08) === 0x08){ //Top\n\t\t\t$down = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\tif($down->getId() === $this->getId()){\n\t\t\t\t$meta = $down->getDamage() ^ 0x04;\n\t\t\t\t$this->getLevel()->setBlock($down, Block::get($this->getId(), $meta), true);\n\t\t\t\t$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);\n\t\t\t\tif($player instanceof Player){\n\t\t\t\t\tunset($players[$player->getLoaderId()]);\n\t\t\t\t}\n\n\t\t\t\t$this->level->addSound(new DoorSound($this));\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\treturn false;\n\t\t}else{\n\t\t\t$this->meta ^= 0x04;\n\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t$players = $this->getLevel()->getChunkPlayers($this->x >> 4, $this->z >> 4);\n\t\t\tif($player instanceof Player){\n\t\t\t\tunset($players[$player->getLoaderId()]);\n\t\t\t}\n\t\t\t$this->level->addSound(new DoorSound($this));\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/DoublePlant.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass DoublePlant extends Flowable{\n\n\tprotected $id = self::DOUBLE_PLANT;\n\t\n\tconst SUNFLOWER = 0;\n\tconst LILAC = 1;\n\tconst DOUBLE_TALLGRASS = 2;\n\tconst LARGE_FERN = 3;\n\tconst ROSE_BUSH = 4;\n\tconst PEONY = 5;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeReplaced(){\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Sunflower\",\n\t\t\t1 => \"Lilac\",\n\t\t\t2 => \"Double Tallgrass\",\n\t\t\t3 => \"Large Fern\",\n\t\t\t4 => \"Rose Bush\",\n\t\t\t5 => \"Peony\"\n\t\t];\n\t\treturn $names[$this->meta & 0x07];\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true && !$this->getSide(0) instanceof DoublePlant){ //Replace with common break method\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), false, false);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\t$up = $this->getSide(1);\n\t\tif($down->getId() === self::GRASS or $down->getId() === self::DIRT){\n\t\t\t$this->getLevel()->setBlock($block, $this, true);\n\t\t\t$this->getLevel()->setBlock($up, Block::get($this->id, $this->meta ^ 0x08), true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$up = $this->getSide(1);\n\t\t$down = $this->getSide(0);\n\t\tif(($this->meta & 0x08) === 0x08){ // This is the Top part of flower\n\t\t\tif($up->getId() === $this->id and $up->meta !== 0x08){ // Checks if the block ID and meta are right\n\t\t\t\t$this->getLevel()->setBlock($up, new Air(), true, true);\n\t\t\t}elseif($down->getId() === $this->id and $down->meta !== 0x08){\n\t\t\t\t$this->getLevel()->setBlock($down, new Air(), true, true);\n\t\t\t}\n\t\t}else{ // Bottom Part of flower\n\t\t\tif($up->getId() === $this->id and ($up->meta & 0x08) === 0x08){\n\t\t\t\t$this->getLevel()->setBlock($up, new Air(), true, true);\n\t\t\t}elseif($down->getId() === $this->id and ($down->meta & 0x08) === 0x08){\n\t\t\t\t$this->getLevel()->setBlock($down, new Air(), true, true);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif(($this->meta & 0x08) !== 0x08){\n\t\t\treturn [[Item::DOUBLE_PLANT, $this->meta, 1]];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/DoubleRedSandstoneSlab.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\n\nclass DoubleRedSandstoneSlab extends DoubleSlab{\n\n\tprotected $id = Block::DOUBLE_RED_SANDSTONE_SLAB;\n\n\tpublic function getName(){\n\t\treturn \"Double Red Sandstone Slab\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::RED_SANDSTONE_SLAB, $this->meta, 2],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/DoubleSlab.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass DoubleSlab extends Solid{\n\n\tprotected $id = self::DOUBLE_SLAB;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Stone\",\n\t\t\t1 => \"Sandstone\",\n\t\t\t2 => \"Wooden\",\n\t\t\t3 => \"Cobblestone\",\n\t\t\t4 => \"Brick\",\n\t\t\t5 => \"Stone Brick\",\n\t\t\t6 => \"Quartz\",\n\t\t\t7 => \"Nether Brick\",\n\t\t];\n\t\treturn \"Double \" . $names[$this->meta & 0x07] . \" Slab\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::SLAB, $this->meta & 0x07, 2],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/DoubleWoodSlab.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass DoubleWoodSlab extends Solid{\n\n\tprotected $id = self::DOUBLE_WOOD_SLAB;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Oak\",\n\t\t\t1 => \"Spruce\",\n\t\t\t2 => \"Birch\",\n\t\t\t3 => \"Jungle\",\n\t\t\t4 => \"Acacia\",\n\t\t\t5 => \"Dark Oak\",\n\t\t\t6 => \"\",\n\t\t\t7 => \"\"\n\t\t];\n\t\treturn \"Double \" . $names[$this->meta & 0x07] . \" Wooden Slab\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::WOOD_SLAB, $this->meta & 0x07, 2],\n\t\t];\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/DragonEgg.php",
    "content": "<?php\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author erkam2002\n * @link http://www.github.net/H4PM\n * \n *\n*/\nnamespace pocketmine\\block;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nclass DragonEgg extends Solid{\n\tprotected $id = self::DRAGON_EGG;\n\tpublic function __construct(){\n\t}\n\tpublic function getName(){\n\t\treturn \"Dragon Egg\";\n\t}\n\tpublic function getHardness(){\n\t\treturn -1;\n\t}\n\t\n\tpublic function getResistance(){\n\t\treturn 18000000;\n\t}\n\tpublic function isBreakable(Item $item){\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Dropper.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Dropper as TileDropper;\nuse pocketmine\\tile\\Tile;\n\nclass Dropper extends Solid implements ElectricalAppliance{\n\n\tprotected $id = self::DROPPER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3.5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Dropper\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$dispenser = null;\n\t\tif($player instanceof Player){\n\t\t\t$pitch = $player->getPitch();\n\t\t\tif(abs($pitch) >= 45){\n\t\t\t\tif($pitch < 0) $f = 4;\n\t\t\t\telse $f = 5;\n\t\t\t} else $f = $player->getDirection();\n\t\t} else $f = 0;\n\t\t$faces = [\n\t\t\t3 => 3,\n\t\t\t0 => 4,\n\t\t\t2 => 5,\n\t\t\t1 => 2,\n\t\t\t4 => 0,\n\t\t\t5 => 1\n\t\t];\n\t\t$this->meta = $faces[$f];\n\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew ListTag(\"Items\", []),\n\t\t\tnew StringTag(\"id\", Tile::DROPPER),\n\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\tTile::createTile(Tile::DROPPER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\treturn true;\n\t}\n\n\tpublic function activate(){\n\t\t$tile = $this->getLevel()->getTile($this);\n\t\tif($tile instanceof TileDropper){\n\t\t\t$tile->activate();\n\t\t}\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$t = $this->getLevel()->getTile($this);\n\t\t\t$dropper = null;\n\t\t\tif($t instanceof TileDropper){\n\t\t\t\t$dropper = $t;\n\t\t\t}else{\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\t\tnew StringTag(\"id\", Tile::DROPPER),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\t\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\t\t$dropper = Tile::createTile(Tile::DROPPER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t$player->addWindow($dropper->getInventory());\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/ElectricalAppliance.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\ninterface ElectricalAppliance{\n\n}"
  },
  {
    "path": "src/pocketmine/block/Emerald.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Emerald extends Solid{\n\n\tprotected $id = self::EMERALD_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Emerald Block\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 4){\n\t\t\treturn [\n\t\t\t\t[Item::EMERALD_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/EmeraldOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass EmeraldOre extends Solid{\n\n\tprotected $id = self::EMERALD_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Emerald Ore\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 4){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::EMERALD_ORE, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t\t$times = [1,1,2,3,4];\n\t\t\t\t$time = $times[mt_rand(0, $fortunel + 1)];\n\t\t\t\treturn [\n\t\t\t\t\t[Item::EMERALD, 0, $time],\n\t\t\t\t];\n\t\t\t}\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/EnchantingTable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\inventory\\EnchantInventory;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\EnchantTable;\nuse pocketmine\\tile\\Tile;\n\nclass EnchantingTable extends Transparent{\n\n\tprotected $id = self::ENCHANTING_TABLE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 12;\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 0.75,\n\t\t\t$this->z + 1\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::ENCHANT_TABLE),\n\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\tTile::createTile(Tile::ENCHANT_TABLE, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\treturn true;\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 6000;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Enchanting Table\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif(!$this->getLevel()->getServer()->enchantingTableEnabled){\n\t\t\treturn true;\n\t\t}\n\t\tif($player instanceof Player){\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t$tile = $this->getLevel()->getTile($this);\n\t\t\t$enchantTable = null;\n\t\t\tif($tile instanceof EnchantTable){\n\t\t\t\t$enchantTable = $tile;\n\t\t\t}else{\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true, true);\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew StringTag(\"id\", Tile::ENCHANT_TABLE),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\n\t\t\t\tif($item->hasCustomName()){\n\t\t\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t\t\t}\n\n\t\t\t\tif($item->hasCustomBlockData()){\n\t\t\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t\t\t$nbt->{$key} = $v;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/** @var EnchantTable $enchantTable */\n\t\t\t\t$enchantTable = Tile::createTile(Tile::ENCHANT_TABLE, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\t\t\t$player->addWindow(new EnchantInventory($this));\n\t\t\t$player->craftingType = Player::CRAFTING_ENCHANT;\n\t\t}\n\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[$this->id, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/EndPortalFrame.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\math\\AxisAlignedBB;\n\nclass EndPortalFrame extends Solid implements SolidLight{\n\n\tprotected $id = self::END_PORTAL_FRAME;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 1;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"End Portal Frame\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn -1;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 18000000;\n\t}\n\n\tpublic function isBreakable(Item $item){\n\t\treturn false;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + (($this->getDamage() & 0x04) > 0 ? 1 : 0.8125),\n\t\t\t$this->z + 1\n\t\t);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/EndRod.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass EndRod extends Flowable{\n\n\tprotected $id = self::END_ROD;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 14;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"End Rod\";\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$below = $this->getSide(0);\n\t\t\t$side = $this->getDamage();\n\t\t\t$faces = [\n\t\t\t\t1 => 1,\n\t\t\t\t2 => 2,\n\t\t\t\t3 => 3,\n\t\t\t\t4 => 4,\n\t\t\t\t5 => 5,\n\t\t\t\t6 => 6,\n\t\t\t\t0 => 0,\n\t\t\t];\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$below = $this->getSide(0);\n\n\t\tif($target->isTransparent() === false and $face !== 0){\n\t\t\t$faces = [\n\t\t\t\t1 => 1,\n\t\t\t\t2 => 2,\n\t\t\t\t3 => 3,\n\t\t\t\t4 => 4,\n\t\t\t\t5 => 5,\n\t\t\t];\n\t\t\t$this->meta = $faces[$face];\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/EndStone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass EndStone extends Solid{\n\n\tprotected $id = self::END_STONE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"End Stone\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/EndStoneBricks.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____            _        _   __  __ _                  __  __ ____  \r\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \r\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\r\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \r\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author PocketMine Team\r\n * @link http://www.pocketmine.net/\r\n * \r\n *\r\n*/\r\n\r\nnamespace pocketmine\\block;\r\n\r\nuse pocketmine\\item\\Item;\r\nuse pocketmine\\item\\Tool;\r\n\r\nclass EndStoneBricks extends Solid{\r\n\r\n\tprotected $id = self::END_STONE_BRICKS;\r\n\r\n\tpublic function __construct($meta = 0){\r\n\t\t$this->meta = $meta;\r\n\t}\r\n\r\n\tpublic function getHardness() {\r\n\t\treturn 0.8;\r\n\t}\r\n\r\n\tpublic function getToolType(){\r\n\t\treturn Tool::TYPE_PICKAXE;\r\n\t}\r\n\t\r\n\tpublic function getDrops(Item $item) : array {\r\n\t\tif($item->isPickaxe() >= 1){\r\n\t\t\treturn [\r\n\t\t\t\t[Item::END_STONE_BRICKS, $this->meta & 0x03, 1],\r\n\t\t\t];\r\n\t\t}else{\r\n\t\t\treturn [];\r\n\t\t}\r\n\t}\r\n\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/block/EnderChest.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\EnderChest as TileEnderChest;\nuse pocketmine\\tile\\Tile;\n\nclass EnderChest extends Transparent{\n\n\tprotected $id = self::ENDER_CHEST;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 22.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Ender Chest\";\n\t}\n\n\tprotected function recalculateBoundingBox(){\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + 0.0625,\n\t\t\t$this->y,\n\t\t\t$this->z + 0.0625,\n\t\t\t$this->x + 0.9375,\n\t\t\t$this->y + 0.9475,\n\t\t\t$this->z + 0.9375\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t\t$faces = [\n\t\t\t\t0 => 4,\n\t\t\t\t1 => 2,\n\t\t\t\t2 => 5,\n\t\t\t\t3 => 3,\n\t\t\t];\n\t\t\t\n\t\t\t$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];\n\t\t\t\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\tnew StringTag(\"id\", Tile::ENDER_CHEST),\n\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t]);\n\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\t\tif($item->hasCustomName()){\n\t\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t\t}\n\n\t\t\t$tile = Tile::createTile(\"EnderChest\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\t\treturn true;\n\t\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$top = $this->getSide(1);\n\t\t\tif($top->isTransparent() !== true){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif(!($this->getLevel()->getTile($this) instanceof TileEnderChest)) {\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew StringTag(\"id\", Tile::ENDER_CHEST),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n \t\t\t\tTile::createTile(\"EnderChest\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$player->getEnderChestInventory()->openAt($this);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\treturn [\n\t\t\t[Item::OBSIDIAN, 0, 8],\n\t\t];\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Fallable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\Player;\n\nabstract class Fallable extends Solid{\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$down = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\tif($down->getId() === self::AIR or ($down instanceof Liquid)){\n\t\t\t\t$fall = Entity::createEntity(\"FallingSand\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new CompoundTag(\"\", [\n\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\tnew DoubleTag(\"\", $this->x + 0.5),\n\t\t\t\t\t\tnew DoubleTag(\"\", $this->y),\n\t\t\t\t\t\tnew DoubleTag(\"\", $this->z + 0.5)\n\t\t\t\t\t]),\n\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t\t]),\n\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t]),\n\t\t\t\t\t\"TileID\" => new IntTag(\"TileID\", $this->getId()),\n\t\t\t\t\t\"Data\" => new ByteTag(\"Data\", $this->getDamage()),\n\t\t\t\t]));\n\n\t\t\t\t$fall->spawnToAll();\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Farmland.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\n\nclass Farmland extends Solid{\n\n\tprotected $id = self::FARMLAND;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Farmland\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.6;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 0.9375,\n\t\t\t$this->z + 1\n\t\t);\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::DIRT, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Fence.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector3;\n\nclass Fence extends Transparent{\n\t\n\tconst FENCE_OAK = 0;  \n\tconst FENCE_SPRUCE = 1;\n\tconst FENCE_BIRCH = 2;\n\tconst FENCE_JUNGLE = 3;\n\tconst FENCE_ACACIA = 4;\n\tconst FENCE_DARKOAK = 5;\n\n\tprotected $id = self::FENCE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 20;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Oak Fence\",\n\t\t\t1 => \"Spruce Fence\",\n\t\t\t2 => \"Birch Fence\",\n\t\t\t3 => \"Jungle Fence\",\n\t\t\t4 => \"Acacia Fence\",\n\t\t\t5 => \"Dark Oak Fence\",\n\t\t\t\"\",\n\t\t\t\"\"\n\t\t];\n\t\treturn $names[$this->meta & 0x07];\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$north = $this->canConnect($this->getSide(Vector3::SIDE_NORTH));\n\t\t$south = $this->canConnect($this->getSide(Vector3::SIDE_SOUTH));\n\t\t$west = $this->canConnect($this->getSide(Vector3::SIDE_WEST));\n\t\t$east = $this->canConnect($this->getSide(Vector3::SIDE_EAST));\n\n\t\t$n = $north ? 0 : 0.375;\n\t\t$s = $south ? 1 : 0.625;\n\t\t$w = $west ? 0 : 0.375;\n\t\t$e = $east ? 1 : 0.625;\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + $w,\n\t\t\t$this->y,\n\t\t\t$this->z + $n,\n\t\t\t$this->x + $e,\n\t\t\t$this->y + 1.5,\n\t\t\t$this->z + $s\n\t\t);\n\t}\n\n\tpublic function canConnect(Block $block){\n\t\treturn ($block instanceof Fence or $block instanceof FenceGate) ? true : $block->isSolid() and !$block->isTransparent();\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/FenceGate.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\nuse pocketmine\\level\\sound\\DoorSound;\n\nclass FenceGate extends Transparent implements ElectricalAppliance{\n\n\tprotected $id = self::FENCE_GATE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Oak Fence Gate\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\n\tprotected function recalculateBoundingBox() {\n\n\t\tif(($this->getDamage() & 0x04) > 0){\n\t\t\treturn null;\n\t\t}\n\n\t\t$i = ($this->getDamage() & 0x03);\n\t\tif($i === 2 or $i === 0){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z + 0.375,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1.5,\n\t\t\t\t$this->z + 0.625\n\t\t\t);\n\t\t}else{\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x + 0.375,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 0.625,\n\t\t\t\t$this->y + 1.5,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 3,\n\t\t\t1 => 0,\n\t\t\t2 => 1,\n\t\t\t3 => 2,\n\t\t];\n\t\t$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03;\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function isOpened(){\n\t\treturn (($this->getDamage() & 0x04) > 0);\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 3,\n\t\t\t1 => 0,\n\t\t\t2 => 1,\n\t\t\t3 => 2,\n\t\t];\n\t\tif($player !== null) $this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04);\n\t\telse $this->meta ^= 0x04;\n\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t$this->level->addSound(new DoorSound($this));\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/FenceGateAcacia.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass FenceGateAcacia extends FenceGate{\n\n\tprotected $id = self::FENCE_GATE_ACACIA;\n\n\tpublic function getName(){\n\t\treturn \"Acacia Fence Gate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/FenceGateBirch.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass FenceGateBirch extends FenceGate{\n\n\tprotected $id = self::FENCE_GATE_BIRCH;\n\n\tpublic function getName(){\n\t\treturn \"Birch Fence Gate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/FenceGateDarkOak.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass FenceGateDarkOak extends FenceGate{\n\n\tprotected $id = self::FENCE_GATE_DARK_OAK;\n\n\tpublic function getName(){\n\t\treturn \"Dark Oak Fence Gate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/FenceGateJungle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass FenceGateJungle extends FenceGate{\n\n\tprotected $id = self::FENCE_GATE_JUNGLE;\n\n\tpublic function getName(){\n\t\treturn \"Jungle Fence Gate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/FenceGateSpruce.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass FenceGateSpruce extends FenceGate{\n\n\tprotected $id = self::FENCE_GATE_SPRUCE;\n\n\tpublic function getName(){\n\t\treturn \"Spruce Fence Gate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Fire.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Arrow;\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\block\\BlockBurnEvent;\nuse pocketmine\\event\\entity\\EntityCombustByBlockEvent;\nuse pocketmine\\event\\entity\\EntityDamageByBlockEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Server;\n\nclass Fire extends Flowable{\n\n\tprotected $id = self::FIRE;\n\n\t/** @var Vector3 */\n\tprivate $temporalVector = null;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t\tif($this->temporalVector === null){\n\t\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t}\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Fire Block\";\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function isBreakable(Item $item){\n\t\treturn false;\n\t}\n\n\tpublic function canBeReplaced(){\n\t\treturn true;\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\t$ProtectL = 0;\n\t\tif(!$entity->hasEffect(Effect::FIRE_RESISTANCE)){\n\t\t\t$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_FIRE, 1);\n\t\t\tif($entity->attack($ev->getFinalDamage(), $ev) === true){\n\t\t\t\t$ev->useArmors();\n\t\t\t}\n\t\t\t$ProtectL = $ev->getFireProtectL();\n\t\t}\n\n\t\t$ev = new EntityCombustByBlockEvent($this, $entity, 8, $ProtectL);\n\t\tif($entity instanceof Arrow){\n\t\t\t$ev->setCancelled();\n\t\t}\n\t\tServer::getInstance()->getPluginManager()->callEvent($ev);\n\t\tif(!$ev->isCancelled()){\n\t\t\t$entity->setOnFire($ev->getDuration());\n\t\t}\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [];\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type == Level::BLOCK_UPDATE_NORMAL or $type == Level::BLOCK_UPDATE_RANDOM or $type == Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\tif(!$this->getSide(Vector3::SIDE_DOWN)->isTopFacingSurfaceSolid() and !$this->canNeighborBurn()){\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}elseif($type == Level::BLOCK_UPDATE_NORMAL or $type == Level::BLOCK_UPDATE_RANDOM){\n\t\t\t\t$this->getLevel()->scheduleUpdate($this, $this->getTickRate() + mt_rand(0, 10));\n\t\t\t}elseif($type == Level::BLOCK_UPDATE_SCHEDULED and $this->getLevel()->getServer()->fireSpread){\n\t\t\t\t$forever = $this->getSide(Vector3::SIDE_DOWN)->getId() == Block::NETHERRACK;\n\n\t\t\t\t//TODO: END\n\n\t\t\t\tif(!$this->getSide(Vector3::SIDE_DOWN)->isTopFacingSurfaceSolid() and !$this->canNeighborBurn()){\n\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\t}\n\n\t\t\t\tif(!$forever and $this->getLevel()->getWeather()->isRainy() and\n\t\t\t\t\t($this->getLevel()->canBlockSeeSky($this) or\n\t\t\t\t\t\t$this->getLevel()->canBlockSeeSky($this->getSide(Vector3::SIDE_EAST)) or\n\t\t\t\t\t\t$this->getLevel()->canBlockSeeSky($this->getSide(Vector3::SIDE_WEST)) or\n\t\t\t\t\t\t$this->getLevel()->canBlockSeeSky($this->getSide(Vector3::SIDE_SOUTH)) or\n\t\t\t\t\t\t$this->getLevel()->canBlockSeeSky($this->getSide(Vector3::SIDE_NORTH))\n\t\t\t\t\t)\n\t\t\t\t){\n\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\t}else{\n\t\t\t\t\t$meta = $this->meta;\n\n\t\t\t\t\tif($meta < 15){\n\t\t\t\t\t\t$this->meta = $meta + mt_rand(0, 3);\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->getLevel()->scheduleUpdate($this, $this->getTickRate() + mt_rand(0, 10));\n\n\t\t\t\t\tif(!$forever and !$this->canNeighborBurn()){\n\t\t\t\t\t\tif(!$this->getSide(Vector3::SIDE_DOWN)->isTopFacingSurfaceSolid() or $meta > 3){\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}elseif(!$forever && !($this->getSide(Vector3::SIDE_DOWN)->getBurnAbility() > 0) && $meta >= 15 && mt_rand(0, 4) == 0){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$o = 0;\n\n\t\t\t\t\t\t//TODO: decrease the o if the rainfall values are high\n\n\t\t\t\t\t\t$this->tryToCatchBlockOnFire($this->getSide(Vector3::SIDE_EAST), 300 + $o, $meta);\n\t\t\t\t\t\t$this->tryToCatchBlockOnFire($this->getSide(Vector3::SIDE_WEST), 300 + $o, $meta);\n\t\t\t\t\t\t$this->tryToCatchBlockOnFire($this->getSide(Vector3::SIDE_DOWN), 250 + $o, $meta);\n\t\t\t\t\t\t$this->tryToCatchBlockOnFire($this->getSide(Vector3::SIDE_UP), 250 + $o, $meta);\n\t\t\t\t\t\t$this->tryToCatchBlockOnFire($this->getSide(Vector3::SIDE_SOUTH), 300 + $o, $meta);\n\t\t\t\t\t\t$this->tryToCatchBlockOnFire($this->getSide(Vector3::SIDE_NORTH), 300 + $o, $meta);\n\n\t\t\t\t\t\tfor($x = ($this->x - 1); $x <= ($this->x + 1); ++$x){\n\t\t\t\t\t\t\tfor($z = ($this->z - 1); $z <= ($this->z + 1); ++$z){\n\t\t\t\t\t\t\t\tfor($y = ($this->y -1); $y <= ($this->y + 4); ++$y){\n\t\t\t\t\t\t\t\t\t$k = 100;\n\n\t\t\t\t\t\t\t\t\tif($y > $this->y + 1){\n\t\t\t\t\t\t\t\t\t\t$k += ($y - ($this->y + 1)) * 100;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t$chance = $this->getChanceOfNeighborsEncouragingFire($this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $z)));\n\n\t\t\t\t\t\t\t\t\tif($chance > 0){\n\t\t\t\t\t\t\t\t\t\t$t = ($chance + 40 + $this->getLevel()->getServer()->getDifficulty() * 7);\n\n\t\t\t\t\t\t\t\t\t\t//TODO: decrease t if the rainfall values are high\n\n\t\t\t\t\t\t\t\t\t\tif($t > 0 and mt_rand(0, $k) <= $t){\n\t\t\t\t\t\t\t\t\t\t\t$damage = min(15, $meta + mt_rand(0, 5) / 4);\n\n\t\t\t\t\t\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $z), new Fire($damage), true);\n\t\t\t\t\t\t\t\t\t\t\t$this->getLevel()->scheduleUpdate($this->temporalVector, $this->getTickRate());\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic function getTickRate() : int{\n\t\treturn 30;\n\t}\n\n\t/*public function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tfor($s = 0; $s <= 5; ++$s){\n\t\t\t\t$side = $this->getSide($s);\n\t\t\t\tif($side->getId() !== self::AIR and !($side instanceof Liquid)){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\n\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif($this->getSide(0)->getId() !== self::NETHERRACK){\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}*/\n\n\tprivate function tryToCatchBlockOnFire(Block $block, int $bound, int $damage){\n\t\t$burnAbility = $block->getBurnAbility();\n\n\t\tif(mt_rand(0, $bound) < $burnAbility){\n\t\t\tif(mt_rand(0, $damage + 10) < 5){\n\t\t\t\t$meta = max(15, $damage + mt_rand(0, 4) / 4);\n\n\t\t\t\t$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new BlockBurnEvent($block));\n\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t$this->getLevel()->setBlock($block, $fire = new Fire($meta), true);\n\t\t\t\t\t$this->getLevel()->scheduleUpdate($block, $fire->getTickRate());\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t}\n\n\t\t\tif($block instanceof TNT){\n\t\t\t\t$block->prime();\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function getChanceOfNeighborsEncouragingFire(Block $block){\n\t\tif($block->getId() !== self::AIR){\n\t\t\treturn 0;\n\t\t}else{\n\t\t\t$chance = 0;\n\t\t\tfor($i = 0; $i < 5; $i++){\n\t\t\t\t$chance = max($chance, $block->getSide($i)->getBurnChance());\n\t\t\t}\n\t\t\treturn $chance;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Flowable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\n\n\nabstract class Flowable extends Transparent{\n\n\tpublic function canBeFlowedInto(){\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 0;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn null;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Flower.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\nclass Flower extends Flowable{\n\tconst TYPE_POPPY = 0;\n\tconst TYPE_BLUE_ORCHID = 1;\n\tconst TYPE_ALLIUM = 2;\n\tconst TYPE_AZURE_BLUET = 3;\n\tconst TYPE_RED_TULIP = 4;\n\tconst TYPE_ORANGE_TULIP = 5;\n\tconst TYPE_WHITE_TULIP = 6;\n\tconst TYPE_PINK_TULIP = 7;\n\tconst TYPE_OXEYE_DAISY = 8;\n\n\tprotected $id = self::RED_FLOWER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::TYPE_POPPY => \"Poppy\",\n\t\t\tself::TYPE_BLUE_ORCHID => \"Blue Orchid\",\n\t\t\tself::TYPE_ALLIUM => \"Allium\",\n\t\t\tself::TYPE_AZURE_BLUET => \"Azure Bluet\",\n\t\t\tself::TYPE_RED_TULIP => \"Red Tulip\",\n\t\t\tself::TYPE_ORANGE_TULIP => \"Orange Tulip\",\n\t\t\tself::TYPE_WHITE_TULIP => \"White Tulip\",\n\t\t\tself::TYPE_PINK_TULIP => \"Pink Tulip\",\n\t\t\tself::TYPE_OXEYE_DAISY => \"Oxeye Daisy\",\n\t\t\t9 => \"Unknown\",\n\t\t\t10 => \"Unknown\",\n\t\t\t11 => \"Unknown\",\n\t\t\t12 => \"Unknown\",\n\t\t\t13 => \"Unknown\",\n\t\t\t14 => \"Unknown\",\n\t\t\t15 => \"Unknown\"\n\t\t];\n\t\treturn $names[$this->meta];\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === Block::GRASS or $down->getId() === Block::DIRT or $down->getId() === Block::FARMLAND){\n\t\t\t$this->getLevel()->setBlock($block, $this, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/FlowerPot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\FlowerPot as TileFlowerPot;\nuse pocketmine\\tile\\Tile;\n\nclass FlowerPot extends Flowable{\n\n\tconst STATE_EMPTY = 0;\n\tconst STATE_FULL = 1;\n\n\tprotected $id = self::FLOWER_POT_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Flower Pot Block\";\n\t}\n\n\tpublic function canBeActivated(): bool{\n\t\treturn true;\n\t}\n\n\tprotected function recalculateBoundingBox(){\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + 0.3125,\n\t\t\t$this->y,\n\t\t\t$this->z + 0.3125,\n\t\t\t$this->x + 0.6875,\n\t\t\t$this->y + 0.375,\n\t\t\t$this->z + 0.6875\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($this->getSide(Vector3::SIDE_DOWN)->isTransparent()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::FLOWER_POT),\n\t\t\tnew IntTag(\"x\", $block->x),\n\t\t\tnew IntTag(\"y\", $block->y),\n\t\t\tnew IntTag(\"z\", $block->z),\n\t\t\tnew ShortTag(\"item\", 0),\n\t\t\tnew IntTag(\"mData\", 0),\n\t\t]);\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\tTile::createTile(Tile::FLOWER_POT, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\treturn true;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\t$pot = $this->getLevel()->getTile($this);\n\t\tif(!($pot instanceof TileFlowerPot)){\n\t\t\treturn false;\n\t\t}\n\t\tif(!$pot->canAddItem($item)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->setDamage(self::STATE_FULL); //specific damage value is unnecessary, it just needs to be non-zero to show an item.\n\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t$pot->setItem($item);\n\n\t\tif($player instanceof Player){\n\t\t\tif($player->isSurvival()){\n\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t$player->getInventory()->setItemInHand($item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\t$items = [[Item::FLOWER_POT, 0, 1]];\n\t\t$tile = $this->getLevel()->getTile($this);\n\t\tif($tile instanceof TileFlowerPot){\n\t\t\tif(($item = $tile->getItem())->getId() !== Item::AIR){\n\t\t\t\t$items[] = [$item->getId(), $item->getDamage(), 1];\n\t\t\t}\n\t\t}\n\t\treturn $items;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Furnace.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Furnace as FurnaceTile;\nuse pocketmine\\tile\\Tile;\n\nclass Furnace extends Solid{\n\n\tprotected $id = self::FURNACE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Furnace\";\n\t}\n\t\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3.5;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 4,\n\t\t\t1 => 2,\n\t\t\t2 => 5,\n\t\t\t3 => 3,\n\t\t];\n\t\t$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew ListTag(\"Items\", []),\n\t\t\tnew StringTag(\"id\", Tile::FURNACE),\n\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\tTile::createTile(\"Furnace\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$t = $this->getLevel()->getTile($this);\n\t\t\tif($t instanceof FurnaceTile){\n\t\t\t\t$furnace = $t;\n\t\t\t}else{\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\t\tnew StringTag(\"id\", Tile::FURNACE),\n\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\t\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\t\t$furnace = Tile::createTile(\"Furnace\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\n\t\t\tif(isset($furnace->namedtag->Lock) and $furnace->namedtag->Lock instanceof StringTag){\n\t\t\t\tif($furnace->namedtag->Lock->getValue() !== $item->getCustomName()){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$player->addWindow($furnace->getInventory());\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($item->isPickaxe() >= 1){\n\t\t\t$drops[] = [Item::FURNACE, 0, 1];\n\t\t}\n\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Glass.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Glass extends Transparent{\n\n\tprotected $id = self::GLASS;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Glass\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.3;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::GLASS, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/GlassPane.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass GlassPane extends Thin{\n\n\tprotected $id = self::GLASS_PANE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Glass Pane\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.3;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::GLASS_PANE, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/GlowingObsidian.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass GlowingObsidian extends Solid implements SolidLight{\n\n\tprotected $id = self::GLOWING_OBSIDIAN;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Glowing Obsidian\";\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 12;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/GlowingRedstoneOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\n\nclass GlowingRedstoneOre extends RedstoneOre implements SolidLight{\n\n\tprotected $id = self::GLOWING_REDSTONE_ORE;\n\n\tpublic function getName(){\n\t\treturn \"Glowing Redstone Ore\";\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 9;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_SCHEDULED or $type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\t$this->getLevel()->setBlock($this, Block::get(Item::REDSTONE_ORE, $this->meta), false, false);\n\n\t\t\treturn Level::BLOCK_UPDATE_WEAK;\n\t\t}\n\n\t\treturn false;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Glowstone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Glowstone extends Transparent implements SolidLight{\n\n\tprotected $id = self::GLOWSTONE_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Glowstone\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::GLOWSTONE_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\t$fortuneL = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortuneL = $fortuneL > 3 ? 3 : $fortuneL;\n\t\t\t$times = [1,1,2,3,4];\n\t\t\t$time = $times[mt_rand(0, $fortuneL + 1)];\n\t\t\t$num = mt_rand(2, 4) * $time;\n\t\t\t$num = $num > 4 ? 4 : $num;\n\t\t\treturn [\n\t\t\t\t[Item::GLOWSTONE_DUST, 0, $num],\n\t\t\t];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Gold.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Gold extends Solid{\n\n\tprotected $id = self::GOLD_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Gold Block\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 4){\n\t\t\treturn [\n\t\t\t\t[Item::GOLD_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/GoldOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass GoldOre extends Solid{\n\n\tprotected $id = self::GOLD_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Gold Ore\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 4){\n\t\t\treturn [\n\t\t\t\t[Item::GOLD_ORE, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Grass.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockSpreadEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\level\\generator\\normal\\object\\TallGrass as TallGrassObject;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\Random;\n\nclass Grass extends Solid{\n\n\tprotected $id = self::GRASS;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Grass\";\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 0.6;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::GRASS, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[Item::DIRT, 0, 1],\n\t\t\t];\n\t\t}\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\t$block = $this->getLevel()->getBlock(new Vector3($this->x, $this->y, $this->z));\n\t\t\tif($block->getSide(1)->getLightLevel() < 4){\n\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Dirt()));\n\t\t\t}elseif($block->getSide(1)->getLightLevel() >= 9){\n\t\t\t\tfor($l = 0; $l < 4; ++$l){\n\t\t\t\t\t$x = mt_rand($this->x - 1, $this->x + 1);\n\t\t\t\t\t$y = mt_rand($this->y - 2, $this->y + 2);\n\t\t\t\t\t$z = mt_rand($this->z - 1, $this->z + 1);\n\t\t\t\t\t$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));\n\t\t\t\t\tif($block->getId() === Block::DIRT && $block->getDamage() === 0x0F && $block->getSide(1)->getLightLevel() >= 4 && $block->z <= 2){\n\t\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Grass()));\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($block, $ev->getNewState());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($item->getId() === Item::DYE and $item->getDamage() === 0x0F){\n\t\t\t$item->count--;\n\t\t\tTallGrassObject::growGrass($this->getLevel(), $this, new Random(mt_rand()), 8, 2);\n\n\t\t\treturn true;\n\t\t}elseif($item->isHoe()){\n\t\t\t$item->useOn($this);\n\t\t\t$this->getLevel()->setBlock($this, new Farmland());\n\n\t\t\treturn true;\n\t\t}elseif($item->isShovel() and $this->getSide(1)->getId() === Block::AIR){\n\t\t\t$item->useOn($this);\n\t\t\t$this->getLevel()->setBlock($this, new GrassPath());\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/GrassPath.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\n\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\n\n\nclass GrassPath extends Transparent{\n\n\tprotected $id = self::GRASS_PATH;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Grass Path\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 0.9375,\n\t\t\t$this->z + 1\n\t\t);\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type == Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$block = $this->getSide(self::SIDE_UP);\n\t\t\tif($block->getId() != self::AIR){\n\t\t\t\t$this->getLevel()->setBlock($this, new Dirt(), true);\n\t\t\t}\n\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.6;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::GRASS_PATH, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[Item::DIRT, 0, 1],\n\t\t\t];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Gravel.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Gravel extends Fallable{\n\n\tprotected $id = self::GRAVEL;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Gravel\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.6;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){//使用精准采集附魔 不掉落燧石\n\t\t\t$drops[] = [Item::GRAVEL, 0, 1];\n\t\t\treturn $drops;\n\t\t}\n\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t$rates = [10,7,4,1];\n\t\tif(mt_rand(1, $rates[$fortunel]) === 1){//10% 14% 25% 100%\n\t\t\t$drops[] = [Item::FLINT, 0, 1];\n\t\t}\n\t\tif(mt_rand(1, 10) !== 1){//90%\n\t\t\t$drops[] = [Item::GRAVEL, 0, 1];\n\t\t}\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/HardenedClay.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass HardenedClay extends Solid{\n\n\tprotected $id = self::HARDENED_CLAY;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Hardened Clay\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1.25;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/HayBale.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass HayBale extends Solid{\n\n\tprotected $id = self::HAY_BALE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Hay Bale\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 60;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 20;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 0,\n\t\t\t1 => 0,\n\t\t\t2 => 0b1000,\n\t\t\t3 => 0b1000,\n\t\t\t4 => 0b0100,\n\t\t\t5 => 0b0100,\n\t\t];\n\n\t\t$this->meta = ($this->meta & 0x03) | $faces[$face];\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/HeavyWeightedPressurePlate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nclass HeavyWeightedPressurePlate extends PressurePlate{\n\tprotected $id = self::HEAVY_WEIGHTED_PRESSURE_PLATE;\n\n\tpublic function getName(){\n\t\treturn \"Heavy Weighted Pressure Plate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Hopper.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Hopper as TileHopper;\nuse pocketmine\\tile\\Tile;\n\nclass Hopper extends Transparent{\n\n\tprotected $id = self::HOPPER_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated(): bool{\n\t\treturn true;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Hopper\";\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 3;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$t = $this->getLevel()->getTile($this);\n\t\t\tif($t instanceof TileHopper){\n\t\t\t\tif($t->hasLock() and !$t->checkLock($item->getCustomName())){\n\t\t\t\t\t$player->getServer()->getLogger()->debug($player->getName() . \" attempted to open a locked hopper\");\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t$player->addWindow($t->getInventory());\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\t\n\tpublic function activate(){\n\t\t//TODO: Hopper content freezing (requires basic redstone system upgrade)\n\t}\n\t\n\tpublic function getTarget(){\n\t\treturn $this->target;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 0,\n\t\t\t1 => 0,\n\t\t\t2 => 3,\n\t\t\t3 => 2,\n\t\t\t4 => 5,\n\t\t\t5 => 4\n\t\t];\n\t\t$this->meta = $faces[$face];\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew ListTag(\"Items\", []),\n\t\t\tnew StringTag(\"id\", Tile::HOPPER),\n\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\t$t = Tile::createTile(Tile::HOPPER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::HOPPER, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/HopperBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass HopperBlock extends Solid{\n\n\tprotected $id = self::HOPPER_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Hopper Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Ice.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Ice extends Transparent{\n\n\tprotected $id = self::ICE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Ice\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) === 0){\n\t\t\t$this->getLevel()->setBlock($this, new Water(), true);\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::ICE, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/InactiveRedstoneLamp.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nclass InactiveRedstoneLamp extends ActiveRedstoneLamp{\n\tprotected $id = self::INACTIVE_REDSTONE_LAMP;\n\n\tpublic function getLightLevel(){\n\t\treturn 0;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Inactive Redstone Lamp\";\n\t}\n\n\tpublic function isLightedByAround(){\n\t\treturn false;\n\t}\n\n\tpublic function turnOn(){\n\t\t//if($isLightedByAround){\n\t\t$this->getLevel()->setBlock($this, new ActiveRedstoneLamp(), true, true);\n\t\t/*}else{\n\t\t\t$this->getLevel()->setBlock($this, new ActiveRedstoneLamp(), true, false);\n\t\t\t//$this->lightAround();\n\t\t}*/\n\t\treturn true;\n\t}\n\n\tpublic function turnOff(){\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/InvisibleBedrock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\n\nclass InvisibleBedrock extends Transparent{\n\n\tprotected $id = self::INVISIBLE_BEDROCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Invisible Bedrock\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn -1;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 18000000;\n\t}\n\n\tpublic function isBreakable(Item $item){\n\t\treturn false;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Iron.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Iron extends Solid{\n\n\tprotected $id = self::IRON_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Iron Block\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 3){\n\t\t\treturn [\n\t\t\t\t[Item::IRON_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/IronBars.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass IronBars extends Thin{\n\n\tprotected $id = self::IRON_BARS;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Iron Bars\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::IRON_BARS, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/block/IronDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\Player;\n\nclass IronDoor extends Door{\n\n\tprotected $id = self::IRON_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Iron Door Block\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::IRON_DOOR, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player) return true;\n\t\telse return parent::onActivate($item, $player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/IronOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass IronOre extends Solid{\n\n\tprotected $id = self::IRON_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Iron Ore\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 3){\n\t\t\treturn [\n\t\t\t\t[Item::IRON_ORE, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/IronTrapdoor.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nclass IronTrapdoor extends Trapdoor {\n\tprotected $id = self::IRON_TRAPDOOR;\n\n\tpublic function getName(){\n\t\treturn \"Iron Trapdoor\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 25;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/ItemFrame.php",
    "content": "<?php\n\n/*\n *\n *  ____\t\t\t_\t\t_   __  __ _\t\t\t\t  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___\t  |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|\t |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\nbt\\tag\\{\n\tByteTag, \n\tCompoundTag, \n\tFloatTag, \n\tIntTag, \n\tStringTag\n};\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\tile\\ItemFrame as TileItemFrame;\n\nclass ItemFrame extends Flowable{\n\tprotected $id = Block::ITEM_FRAME_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Item Frame\";\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif(!(($tile = $this->level->getTile($this)) instanceof TileItemFrame)){\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::ITEM_FRAME),\n\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\tnew IntTag(\"z\", $this->z),\n\t\t\t\tnew FloatTag(\"ItemDropChance\", 1.0),\n\t\t\t\tnew ByteTag(\"ItemRotation\", 0)\n\t\t\t]);\n\t\t\t$tile = Tile::createTile(Tile::ITEM_FRAME, $this->level->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t}\n\n\t\tif($tile->hasItem()){\n\t\t\t$tile->setItemRotation(($tile->getItemRotation() + 1) % 8);\n\t\t}else{\n\t\t\tif($item->getCount() > 0){\n\t\t\t\t$frameItem = clone $item;\n\t\t\t\t$frameItem->setCount(1);\n\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t\t$tile->setItem($frameItem);\n\t\t\t\tif($player instanceof Player and $player->isSurvival()){\n\t\t\t\t\t$player->getInventory()->setItemInHand($item->getCount() <= 0 ? Item::get(Item::AIR) : $item);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\tif(($tile = $this->level->getTile($this)) instanceof TileItemFrame){\n\t\t\t//TODO: add events\n\t\t\tif(lcg_value() <= $tile->getItemDropChance() and $tile->getItem()->getId() !== Item::AIR){\n\t\t\t\t$this->level->dropItem($tile->getBlock(), $tile->getItem());\n\t\t\t}\n\t\t}\n\t\treturn parent::onBreak($item);\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$sides = [\n\t\t\t\t0 => 4,\n\t\t\t\t1 => 5,\n\t\t\t\t2 => 2,\n\t\t\t\t3 => 3\n\t\t\t];\n\t\t\tif(!$this->getSide($sides[$this->meta])->isSolid()){\n\t\t\t\t$this->level->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($face === 0 or $face === 1){\n\t\t\treturn false;\n\t\t}\n\n\t\t$faces = [\n\t\t\t2 => 3,\n\t\t\t3 => 2,\n\t\t\t4 => 1,\n\t\t\t5 => 0\n\t\t];\n\n\t\t$this->meta = $faces[$face];\n\t\t$this->level->setBlock($block, $this, true, true);\n\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::ITEM_FRAME),\n\t\t\tnew IntTag(\"x\", $block->x),\n\t\t\tnew IntTag(\"y\", $block->y),\n\t\t\tnew IntTag(\"z\", $block->z),\n\t\t\tnew FloatTag(\"ItemDropChance\", 1.0),\n\t\t\tnew ByteTag(\"ItemRotation\", 0)\n\t\t]);\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\tTile::createTile(Tile::ITEM_FRAME, $this->level->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\treturn true;\n\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\treturn [\n\t\t\t[Item::ITEM_FRAME, 0, 1]\n\t\t];\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/ItemFrameBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass ItemFrameBlock extends Solid{\n\n\tprotected $id = self::ITEM_FRAME_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Item Frame Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/JungleDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass JungleDoor extends Door{\n\n\tprotected $id = self::JUNGLE_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Jungle Door Block\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::JUNGLE_DOOR, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/JungleDoorBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass JungleDoorBlock extends Solid{\n\n\tprotected $id = self::JUNGLE_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Jungle Door Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/JungleWoodStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass JungleWoodStairs extends WoodStairs{\n\n\tprotected $id = self::JUNGLE_WOOD_STAIRS;\n\n\tpublic function getName(){\n\t\treturn \"Jungle Wood Stairs\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Ladder.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\n\nclass Ladder extends Transparent{\n\n\tprotected $id = self::LADDER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Ladder\";\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.4;\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\t$entity->resetFallDistance();\n\t\t$entity->onGround = true;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$f = 0.1875;\n\n\t\tif($this->meta === 2){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z + 1 - $f,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}elseif($this->meta === 3){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + $f\n\t\t\t);\n\t\t}elseif($this->meta === 4){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x + 1 - $f,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}elseif($this->meta === 5){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + $f,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($target->isTransparent() === false){\n\t\t\t$faces = [\n\t\t\t\t2 => 2,\n\t\t\t\t3 => 3,\n\t\t\t\t4 => 4,\n\t\t\t\t5 => 5,\n\t\t\t];\n\t\t\tif(isset($faces[$face])){\n\t\t\t\t$this->meta = $faces[$face];\n\t\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\t$faces = [\n\t\t\t2 => 3,\n\t\t\t3 => 2,\n\t\t\t4 => 5,\n\t\t\t5 => 4,\n\t\t];\n\t\t/*if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method\n\t\t\tServer::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1));\n\t\t\t$this->getLevel()->setBlock($this, new Air(), true, true, true);\n\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}*/\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif(isset($faces[$this->meta])) {\n\t\t\t\tif ($this->getSide($faces[$this->meta])->getId() === self::AIR) {\n\t\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\t}\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Lapis.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Lapis extends Solid{\n\n\tprotected $id = self::LAPIS_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Lapis Lazuli Block\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 3){\n\t\t\treturn [\n\t\t\t\t[Item::LAPIS_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/LapisOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass LapisOre extends Solid{\n\n\tprotected $id = self::LAPIS_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Lapis Lazuli Ore\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 3){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::LAPIS_ORE, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t\t$times = [1,1,2,3,4];\n\t\t\t\t$time = $times[mt_rand(0, $fortunel + 1)];\n\t\t\t\treturn [\n\t\t\t\t\t[Item::DYE, 4, mt_rand(4, 8) * $time],\n\t\t\t\t];\n\t\t\t}\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Lava.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\entity\\EntityCombustByBlockEvent;\nuse pocketmine\\event\\entity\\EntityDamageByBlockEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass Lava extends Liquid{\n\n\tprotected $id = self::LAVA;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Lava\";\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\t$entity->fallDistance *= 0.5;\n\t\t$ProtectL = 0;\n\t\tif(!$entity->hasEffect(Effect::FIRE_RESISTANCE)){\n\t\t\t$ev = new EntityDamageByBlockEvent($this, $entity, EntityDamageEvent::CAUSE_LAVA, 4);\n\t\t\tif($entity->attack($ev->getFinalDamage(), $ev) === true){\n\t\t\t\t$ev->useArmors();\n\t\t\t}\n\t\t\t$ProtectL = $ev->getFireProtectL();\n\t\t}\n\n\t\t$ev = new EntityCombustByBlockEvent($this, $entity, 15, $ProtectL);\n\t\tServer::getInstance()->getPluginManager()->callEvent($ev);\n\t\tif(!$ev->isCancelled()){\n\t\t\t$entity->setOnFire($ev->getDuration());\n\t\t}\n\n\t\t$entity->resetFallDistance();\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$ret = $this->getLevel()->setBlock($this, $this, true, false);\n\t\t$this->getLevel()->scheduleUpdate($this, $this->tickRate());\n\n\t\treturn $ret;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Leaves.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\LeavesDecayEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\Dye;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass Leaves extends Transparent{\n\tconst OAK = 0;\n\tconst SPRUCE = 1;\n\tconst BIRCH = 2;\n\tconst JUNGLE = 3;\n\tconst ACACIA = 0;\n\tconst DARK_OAK = 1;\n\t\n\tconst WOOD_TYPE = self::WOOD;\n\n\tprotected $id = self::LEAVES;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHEARS;\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 30;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 60;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::OAK => \"Oak Leaves\",\n\t\t\tself::SPRUCE => \"Spruce Leaves\",\n\t\t\tself::BIRCH => \"Birch Leaves\",\n\t\t\tself::JUNGLE => \"Jungle Leaves\",\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n\n\tprivate function findLog(Block $pos, array $visited, $distance, &$check, $fromSide = null){\n\t\t++$check;\n\t\t$index = $pos->x . \".\" . $pos->y . \".\" . $pos->z;\n\t\tif(isset($visited[$index])){\n\t\t\treturn false;\n\t\t}\n\t\tif($pos->getId() === static::WOOD_TYPE){\n\t\t\treturn true;\n\t\t}elseif($pos->getId() === $this->id and $distance < 3){\n\t\t\t$visited[$index] = true;\n\t\t\t$down = $pos->getSide(0)->getId();\n\t\t\tif($down === static::WOOD_TYPE){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif($fromSide === null){\n\t\t\t\tfor($side = 2; $side <= 5; ++$side){\n\t\t\t\t\tif($this->findLog($pos->getSide($side), $visited, $distance + 1, $check, $side) === true){\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{ //No more loops\n\t\t\t\tswitch($fromSide){\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\tif($this->findLog($pos->getSide(2), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(4), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(5), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 3:\n\t\t\t\t\t\tif($this->findLog($pos->getSide(3), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(4), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(5), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 4:\n\t\t\t\t\t\tif($this->findLog($pos->getSide(2), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(3), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(4), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 5:\n\t\t\t\t\t\tif($this->findLog($pos->getSide(2), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(3), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($this->findLog($pos->getSide(5), $visited, $distance + 1, $check, $fromSide) === true){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif(($this->meta & 0b00001100) === 0){\n\t\t\t\t$this->meta |= 0x08;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, false, true);\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif(($this->meta & 0b00001100) === 0x08){\n\t\t\t\t$this->meta &= 0x03;\n\t\t\t\t$visited = [];\n\t\t\t\t$check = 0;\n\n\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new LeavesDecayEvent($this));\n\n\t\t\t\tif($ev->isCancelled() or $this->findLog($this, $visited, 0, $check) === true){\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, false, false);\n\t\t\t\t}else{\n\t\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$this->meta |= 0x04;\n\t\t$this->getLevel()->setBlock($this, $this, true);\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($item->isShears() or $item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t$drops[] = [$this->id, $this->meta & 0x03, 1];\n\t\t}else{\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = min(3, $fortunel);\n\t\t\t$rates = [20,16,12,10];\n\t\t\tif(mt_rand(1, $rates[$fortunel]) === 1){ //Saplings\n\t\t\t\t$drops[] = [Item::SAPLING, $this->meta & 0x03, 1];\n\t\t\t}\n\t\t\t$rates = [200,180,160,120];\n\t\t\tif(($this->meta & 0x03) === self::OAK and mt_rand(1, $rates[$fortunel]) === 1){ //Apples\n\t\t\t\t$drops[] = [Item::APPLE, 0, 1];\n\t\t\t}\n\t\t}\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Leaves2.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\LeavesDecayEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass Leaves2 extends Leaves{\n\n\tconst WOOD_TYPE = self::WOOD2;\n\n\tprotected $id = self::LEAVES2;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::ACACIA => \"Acacia Leaves\",\n\t\t\tself::DARK_OAK => \"Dark Oak Leaves\",\n\t\t];\n\t\treturn $names[$this->meta & 0x01];\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($item->isShears() or $item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t$drops[] = [$this->id, $this->meta & 0x01, 1];\n\t\t}else{\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = min(3, $fortunel);\n\t\t\t$rates = [20,16,12,10];\n\t\t\tif(mt_rand(1, $rates[$fortunel]) === 1){ //Saplings\n\t\t\t\t$drops[] = [Item::SAPLING, ($this->meta & 0x01) | 0x04, 1];\n\t\t\t}\n\t\t}\n\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Lever.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\nclass Lever extends RedstoneSource{\n\tprotected $id = self::LEVER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Lever\";\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$side = $this->getDamage();\n\t\t\tif($this->isActivated()) $side ^= 0x08;\n\t\t\t$faces = [\n\t\t\t\t5 => 0,\n\t\t\t\t6 => 0,\n\t\t\t\t3 => 2,\n\t\t\t\t1 => 4,\n\t\t\t\t4 => 3,\n\t\t\t\t2 => 5,\n\t\t\t\t0 => 1,\n\t\t\t\t7 => 1,\n\t\t\t];\n\n\t\t\t$block = $this->getSide($faces[$side]);\n\t\t\tif($block->isTransparent()){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($target->isTransparent() === false){\n\t\t\t$faces = [\n\t\t\t\t3 => 3,\n\t\t\t\t2 => 4,\n\t\t\t\t4 => 2,\n\t\t\t\t5 => 1,\n\t\t\t];\n\t\t\tif($face === 0){\n\t\t\t\t$to = $player instanceof Player ? $player->getDirection() : 0;\n\t\t\t\t$this->meta = ($to % 2 != 1 ? 0 : 7);\n\t\t\t}elseif($face === 1){\n\t\t\t\t$to = $player instanceof Player ? $player->getDirection() : 0;\n\t\t\t\t$this->meta = ($to % 2 != 1 ? 6 : 5);\n\t\t\t}else{\n\t\t\t\t$this->meta = $faces[$face];\n\t\t\t}\n\t\t\t$this->getLevel()->setBlock($block, $this, true, false);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function activate(array $ignore = []){\n\t\tparent::activate($ignore);\n\t\t$side = $this->meta;\n\t\tif($this->isActivated()) $side ^= 0x08;\n\t\t$faces = [\n\t\t\t\t5 => 0,\n\t\t\t\t6 => 0,\n\t\t\t\t3 => 2,\n\t\t\t\t1 => 4,\n\t\t\t\t4 => 3,\n\t\t\t\t2 => 5,\n\t\t\t\t0 => 1,\n\t\t\t\t7 => 1,\n\t\t];\n\n\t\t$block = $this->getSide($faces[$side])->getSide(Vector3::SIDE_UP);\n\t\tif(!$this->equals($block)){\n\t\t\t$this->activateBlock($block);\n\t\t}\n\n\t\t$this->checkTorchOn($this->getSide($faces[$side]),[$this->getOppositeSide($faces[$side])]);\n\t}\n\n\tpublic function deactivate(array $ignore = []){\n\t\tparent::deactivate($ignore);\n\t\t$side = $this->meta;\n\t\tif($this->isActivated()) $side ^= 0x08;\n\t\t$faces = [\n\t\t\t\t5 => 0,\n\t\t\t\t6 => 0,\n\t\t\t\t3 => 2,\n\t\t\t\t1 => 4,\n\t\t\t\t4 => 3,\n\t\t\t\t2 => 5,\n\t\t\t\t0 => 1,\n\t\t\t\t7 => 1,\n\t\t];\n\n\t\t$block = $this->getSide($faces[$side])->getSide(Vector3::SIDE_UP);\n\t\tif(!$this->equals($block)){\n\t\t\t$this->deactivateBlock($block);\n\t\t}\n\n\t\t$this->checkTorchOff($this->getSide($faces[$side]),[$this->getOppositeSide($faces[$side])]);\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\t$this->meta ^= 0x08;\n\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\tif($this->isActivated()) $this->activate();\n\t\telse $this->deactivate();\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\tif($this->isActivated()){\n\t\t\t$this->meta ^= 0x08;\n\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t$this->deactivate();\n\t\t}\n\t\t$this->getLevel()->setBlock($this, new Air(), true, false);\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn (($this->meta & 0x08) === 0x08);\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 2.5;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0 ,1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/LightWeightedPressurePlate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nclass LightWeightedPressurePlate extends PressurePlate{\n\tprotected $id = self::LIGHT_WEIGHTED_PRESSURE_PLATE;\n\n\tpublic function getName(){\n\t\treturn \"Light Weighted Pressure Plate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Liquid.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\particle\\SmokeParticle;\nuse pocketmine\\level\\sound\\FizzSound;\nuse pocketmine\\math\\Vector3;\n\nabstract class Liquid extends Transparent{\n\n\t/** @var Vector3 */\n\tprivate $temporalVector = null;\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function isBreakable(Item $item){\n\t\treturn false;\n\t}\n\n\tpublic function canBeReplaced(){\n\t\treturn true;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic $adjacentSources = 0;\n\tpublic $isOptimalFlowDirection = [0, 0, 0, 0];\n\tpublic $flowCost = [0, 0, 0, 0];\n\n\tpublic function getFluidHeightPercent(){\n\t\t$d = $this->meta;\n\t\tif($d >= 8){\n\t\t\t$d = 0;\n\t\t}\n\n\t\treturn ($d + 1) / 9;\n\t}\n\n\tprotected function getFlowDecay(Vector3 $pos){\n\t\tif(!($pos instanceof Block)){\n\t\t\t$pos = $this->getLevel()->getBlock($pos);\n\t\t}\n\n\t\tif($pos->getId() !== $this->getId()){\n\t\t\treturn -1;\n\t\t}else{\n\t\t\treturn $pos->getDamage();\n\t\t}\n\t}\n\n\tprotected function getEffectiveFlowDecay(Vector3 $pos){\n\t\tif(!($pos instanceof Block)){\n\t\t\t$pos = $this->getLevel()->getBlock($pos);\n\t\t}\n\n\t\tif($pos->getId() !== $this->getId()){\n\t\t\treturn -1;\n\t\t}\n\n\t\t$decay = $pos->getDamage();\n\n\t\tif($decay >= 8){\n\t\t\t$decay = 0;\n\t\t}\n\n\t\treturn $decay;\n\t}\n\n\tpublic function getFlowVector(){\n\t\t$vector = new Vector3(0, 0, 0);\n\n\t\tif($this->temporalVector === null){\n\t\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t}\n\n\t\t$decay = $this->getEffectiveFlowDecay($this);\n\n\t\tfor($j = 0; $j < 4; ++$j){\n\n\t\t\t$x = $this->x;\n\t\t\t$y = $this->y;\n\t\t\t$z = $this->z;\n\n\t\t\tif($j === 0){\n\t\t\t\t--$x;\n\t\t\t}elseif($j === 1){\n\t\t\t\t++$x;\n\t\t\t}elseif($j === 2){\n\t\t\t\t--$z;\n\t\t\t}elseif($j === 3){\n\t\t\t\t++$z;\n\t\t\t}\n\t\t\t$sideBlock = $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\t\t\t$blockDecay = $this->getEffectiveFlowDecay($sideBlock);\n\n\t\t\tif($blockDecay < 0){\n\t\t\t\tif(!$sideBlock->canBeFlowedInto()){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$blockDecay = $this->getEffectiveFlowDecay($this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y - 1, $z)));\n\n\t\t\t\tif($blockDecay >= 0){\n\t\t\t\t\t$realDecay = $blockDecay - ($decay - 8);\n\t\t\t\t\t$vector->x += ($sideBlock->x - $this->x) * $realDecay;\n\t\t\t\t\t$vector->y += ($sideBlock->y - $this->y) * $realDecay;\n\t\t\t\t\t$vector->z += ($sideBlock->z - $this->z) * $realDecay;\n\t\t\t\t}\n\n\t\t\t\tcontinue;\n\t\t\t}else{\n\t\t\t\t$realDecay = $blockDecay - $decay;\n\t\t\t\t$vector->x += ($sideBlock->x - $this->x) * $realDecay;\n\t\t\t\t$vector->y += ($sideBlock->y - $this->y) * $realDecay;\n\t\t\t\t$vector->z += ($sideBlock->z - $this->z) * $realDecay;\n\t\t\t}\n\t\t}\n\n\t\tif($this->getDamage() >= 8){\n\t\t\t$falling = false;\n\n\t\t\tif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x, $this->y, $this->z - 1))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}elseif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x, $this->y, $this->z + 1))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}elseif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x - 1, $this->y, $this->z))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}elseif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x + 1, $this->y, $this->z))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}elseif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x, $this->y + 1, $this->z - 1))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}elseif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x, $this->y + 1, $this->z + 1))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}elseif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x - 1, $this->y + 1, $this->z))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}elseif(!$this->getLevel()->getBlock($this->temporalVector->setComponents($this->x + 1, $this->y + 1, $this->z))->canBeFlowedInto()){\n\t\t\t\t$falling = true;\n\t\t\t}\n\n\t\t\tif($falling){\n\t\t\t\t$vector = $vector->normalize()->add(0, -6, 0);\n\t\t\t}\n\t\t}\n\n\t\treturn $vector->normalize();\n\t}\n\n\tpublic function addVelocityToEntity(Entity $entity, Vector3 $vector){\n\t\t$flow = $this->getFlowVector();\n\t\t$vector->x += $flow->x;\n\t\t$vector->y += $flow->y;\n\t\t$vector->z += $flow->z;\n\t}\n\n\tpublic function tickRate() : int{\n\t\tif($this instanceof Water){\n\t\t\treturn 5;\n\t\t}elseif($this instanceof Lava){\n\t\t\treturn 30;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$this->checkForHarden();\n\t\t\t$this->getLevel()->scheduleUpdate($this, $this->tickRate());\n\t\t}elseif($type === Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\tif($this->temporalVector === null){\n\t\t\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t\t}\n\n\t\t\t$decay = $this->getFlowDecay($this);\n\t\t\t$multiplier = $this instanceof Lava ? 2 : 1;\n\n\t\t\t$flag = true;\n\n\t\t\tif($decay > 0){\n\t\t\t\t$smallestFlowDecay = -100;\n\t\t\t\t$this->adjacentSources = 0;\n\t\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($this->level->getBlock($this->temporalVector->setComponents($this->x, $this->y, $this->z - 1)), $smallestFlowDecay);\n\t\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($this->level->getBlock($this->temporalVector->setComponents($this->x, $this->y, $this->z + 1)), $smallestFlowDecay);\n\t\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($this->level->getBlock($this->temporalVector->setComponents($this->x - 1, $this->y, $this->z)), $smallestFlowDecay);\n\t\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($this->level->getBlock($this->temporalVector->setComponents($this->x + 1, $this->y, $this->z)), $smallestFlowDecay);\n\n\t\t\t\t$k = $smallestFlowDecay + $multiplier;\n\n\t\t\t\tif($k >= 8 or $smallestFlowDecay < 0){\n\t\t\t\t\t$k = -1;\n\t\t\t\t}\n\n\t\t\t\tif(($topFlowDecay = $this->getFlowDecay($this->level->getBlock($this->level->getBlock($this->temporalVector->setComponents($this->x, $this->y + 1, $this->z))))) >= 0){\n\t\t\t\t\tif($topFlowDecay >= 8){\n\t\t\t\t\t\t$k = $topFlowDecay;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$k = $topFlowDecay | 0x08;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif($this->adjacentSources >= 2 and $this instanceof Water){\n\t\t\t\t\t$bottomBlock = $this->level->getBlock($this->level->getBlock($this->temporalVector->setComponents($this->x, $this->y - 1, $this->z)));\n\t\t\t\t\tif($bottomBlock->isSolid()){\n\t\t\t\t\t\t$k = 0;\n\t\t\t\t\t}elseif($bottomBlock instanceof Water and $bottomBlock->getDamage() === 0){\n\t\t\t\t\t\t$k = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif($this instanceof Lava and $decay < 8 and $k < 8 and $k > 1 and mt_rand(0, 4) !== 0){\n\t\t\t\t\t$k = $decay;\n\t\t\t\t\t$flag = false;\n\t\t\t\t}\n\n\t\t\t\tif($k !== $decay){\n\t\t\t\t\t$decay = $k;\n\t\t\t\t\tif($decay < 0){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, Block::get($this->id, $decay), true);\n\t\t\t\t\t\t$this->getLevel()->scheduleUpdate($this, $this->tickRate());\n\t\t\t\t\t}\n\t\t\t\t}elseif($flag){\n\t\t\t\t\t//$this->getLevel()->scheduleUpdate($this, $this->tickRate());\n\t\t\t\t\t//$this->updateFlow();\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t//$this->updateFlow();\n\t\t\t}\n\n\t\t\t$bottomBlock = $this->level->getBlock($this->temporalVector->setComponents($this->x, $this->y - 1, $this->z));\n\n\t\t\tif($bottomBlock->canBeFlowedInto() or $bottomBlock instanceof Liquid){\n\t\t\t\tif($this instanceof Lava and $bottomBlock instanceof Water){\n\t\t\t\t\t$this->getLevel()->setBlock($bottomBlock, Block::get(Item::STONE), true);\n\t\t\t\t\t$this->triggerLavaMixEffects($bottomBlock);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif($decay >= 8){\n\t\t\t\t\t//$this->getLevel()->setBlock($bottomBlock, Block::get($this->id, $decay), true);\n\t\t\t\t\t//$this->getLevel()->scheduleUpdate($bottomBlock, $this->tickRate());\n\t\t\t\t\t$this->flowIntoBlock($bottomBlock, $decay);\n\t\t\t\t}else{\n\t\t\t\t\t//$this->getLevel()->setBlock($bottomBlock, Block::get($this->id, $decay + 8), true);\n\t\t\t\t\t//$this->getLevel()->scheduleUpdate($bottomBlock, $this->tickRate());\n\t\t\t\t\t$this->flowIntoBlock($bottomBlock, $decay | 0x08);\n\t\t\t\t}\n\t\t\t}elseif($decay >= 0 and ($decay === 0 or !$bottomBlock->canBeFlowedInto())){\n\t\t\t\t$flags = $this->getOptimalFlowDirections();\n\n\t\t\t\t$l = $decay + $multiplier;\n\n\t\t\t\tif($decay >= 8){\n\t\t\t\t\t$l = 1;\n\t\t\t\t}\n\n\t\t\t\tif($l >= 8){\n\t\t\t\t\t$this->checkForHarden();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif($flags[0]){\n\t\t\t\t\t$this->flowIntoBlock($this->level->getBlock($this->temporalVector->setComponents($this->x - 1, $this->y, $this->z)), $l);\n\t\t\t\t}\n\n\t\t\t\tif($flags[1]){\n\t\t\t\t\t$this->flowIntoBlock($this->level->getBlock($this->temporalVector->setComponents($this->x + 1, $this->y, $this->z)), $l);\n\t\t\t\t}\n\n\t\t\t\tif($flags[2]){\n\t\t\t\t\t$this->flowIntoBlock($this->level->getBlock($this->temporalVector->setComponents($this->x, $this->y, $this->z - 1)), $l);\n\t\t\t\t}\n\n\t\t\t\tif($flags[3]){\n\t\t\t\t\t$this->flowIntoBlock($this->level->getBlock($this->temporalVector->setComponents($this->x, $this->y, $this->z + 1)), $l);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->checkForHarden();\n\n\t\t}\n\t}\n\n\tprivate function flowIntoBlock(Block $block, $newFlowDecay){\n\t\tif($block->canBeFlowedInto()){\n\t\t\tif($block instanceof Lava){\n\t\t\t\t$this->triggerLavaMixEffects($block);\n\t\t\t}elseif($block->getId() > 0){\n\t\t\t\t$this->getLevel()->useBreakOn($block);\n\t\t\t}\n\n\t\t\t$this->getLevel()->setBlock($block, Block::get($this->getId(), $newFlowDecay), true);\n\t\t\t$this->getLevel()->scheduleUpdate($block, $this->tickRate());\n\t\t}\n\t}\n\n\tprivate function calculateFlowCost(Block $block, $accumulatedCost, $previousDirection){\n\t\t$cost = 1000;\n\n\t\tfor($j = 0; $j < 4; ++$j){\n\t\t\tif(\n\t\t\t\t($j === 0 and $previousDirection === 1) or\n\t\t\t\t($j === 1 and $previousDirection === 0) or\n\t\t\t\t($j === 2 and $previousDirection === 3) or\n\t\t\t\t($j === 3 and $previousDirection === 2)\n\t\t\t){\n\t\t\t\t$x = $block->x;\n\t\t\t\t$y = $block->y;\n\t\t\t\t$z = $block->z;\n\n\t\t\t\tif($j === 0){\n\t\t\t\t\t--$x;\n\t\t\t\t}elseif($j === 1){\n\t\t\t\t\t++$x;\n\t\t\t\t}elseif($j === 2){\n\t\t\t\t\t--$z;\n\t\t\t\t}elseif($j === 3){\n\t\t\t\t\t++$z;\n\t\t\t\t}\n\t\t\t\t$blockSide = $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\n\t\t\t\tif(!$blockSide->canBeFlowedInto() and !($blockSide instanceof Liquid)){\n\t\t\t\t\tcontinue;\n\t\t\t\t}elseif($blockSide instanceof Liquid and $blockSide->getDamage() === 0){\n\t\t\t\t\tcontinue;\n\t\t\t\t}elseif($this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y - 1, $z))->canBeFlowedInto()){\n\t\t\t\t\treturn $accumulatedCost;\n\t\t\t\t}\n\n\t\t\t\tif($accumulatedCost >= 4){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$realCost = $this->calculateFlowCost($blockSide, $accumulatedCost + 1, $j);\n\n\t\t\t\tif($realCost < $cost){\n\t\t\t\t\t$cost = $realCost;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $cost;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 100;\n\t}\n\n\tprivate function getOptimalFlowDirections(){\n\t\tif($this->temporalVector === null){\n\t\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t}\n\n\t\tfor($j = 0; $j < 4; ++$j){\n\t\t\t$this->flowCost[$j] = 1000;\n\n\t\t\t$x = $this->x;\n\t\t\t$y = $this->y;\n\t\t\t$z = $this->z;\n\n\t\t\tif($j === 0){\n\t\t\t\t--$x;\n\t\t\t}elseif($j === 1){\n\t\t\t\t++$x;\n\t\t\t}elseif($j === 2){\n\t\t\t\t--$z;\n\t\t\t}elseif($j === 3){\n\t\t\t\t++$z;\n\t\t\t}\n\t\t\t$block = $this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\n\t\t\tif(!$block->canBeFlowedInto() and !($block instanceof Liquid)){\n\t\t\t\tcontinue;\n\t\t\t}elseif($block instanceof Liquid and $block->getDamage() === 0){\n\t\t\t\tcontinue;\n\t\t\t}elseif($this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y - 1, $z))->canBeFlowedInto()){\n\t\t\t\t$this->flowCost[$j] = 0;\n\t\t\t}else{\n\t\t\t\t$this->flowCost[$j] = $this->calculateFlowCost($block, 1, $j);\n\t\t\t}\n\t\t}\n\n\t\t$minCost = $this->flowCost[0];\n\n\t\tfor($i = 1; $i < 4; ++$i){\n\t\t\tif($this->flowCost[$i] < $minCost){\n\t\t\t\t$minCost = $this->flowCost[$i];\n\t\t\t}\n\t\t}\n\n\t\tfor($i = 0; $i < 4; ++$i){\n\t\t\t$this->isOptimalFlowDirection[$i] = ($this->flowCost[$i] === $minCost);\n\t\t}\n\n\t\treturn $this->isOptimalFlowDirection;\n\t}\n\n\tprivate function getSmallestFlowDecay(Vector3 $pos, $decay){\n\t\t$blockDecay = $this->getFlowDecay($pos);\n\n\t\tif($blockDecay < 0){\n\t\t\treturn $decay;\n\t\t}elseif($blockDecay === 0){\n\t\t\t++$this->adjacentSources;\n\t\t}elseif($blockDecay >= 8){\n\t\t\t$blockDecay = 0;\n\t\t}\n\n\t\treturn ($decay >= 0 && $blockDecay >= $decay) ? $decay : $blockDecay;\n\t}\n\n\tprivate function checkForHarden(){\n\t\tif($this instanceof Lava){\n\t\t\t$colliding = false;\n\t\t\tfor($side = 0; $side <= 5 and !$colliding; ++$side){\n\t\t\t\t$colliding = $this->getSide($side) instanceof Water;\n\t\t\t}\n\n\t\t\tif($colliding){\n\t\t\t\tif($this->getDamage() === 0){\n\t\t\t\t\t$this->getLevel()->setBlock($this, Block::get(Item::OBSIDIAN), true);\n\t\t\t\t}elseif($this->getDamage() <= 4){\n\t\t\t\t\t$this->getLevel()->setBlock($this, Block::get(Item::COBBLESTONE), true);\n\t\t\t\t}\n\t\t\t\t$this->triggerLavaMixEffects($this);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn null;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [];\n\t}\n\n\t/**\n\t * Creates fizzing sound and smoke. Used when lava flows over block or mixes with water.\n\t *\n\t * @param Vector3 $pos\n\t */\n\tprotected function triggerLavaMixEffects(Vector3 $pos){\n\t\t$this->getLevel()->addSound(new FizzSound($pos->add(0.5, 0.5, 0.5), 2.5 + mt_rand(0, 1000) / 1000 * 0.8));\n\n\t\tfor($i = 0; $i < 8; ++$i){\n\t\t\t$this->getLevel()->addParticle(new SmokeParticle($pos->add(mt_rand(0, 80) / 100, 0.5, mt_rand(0, 80) / 100)));\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/LitPumpkin.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\Player;\nuse pocketmine\\entity\\IronGolem;\nuse pocketmine\\entity\\SnowGolem;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\ListTag;\n\nclass LitPumpkin extends Solid implements SolidLight{\n\n\tprotected $id = self::LIT_PUMPKIN;\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Jack o'Lantern\";\n\t}\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$this->meta = ((int) $player->getDirection() + 5) % 4;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\tif($player != null) {\n\t\t\t$level = $this->getLevel();\n\t\t\tif($player->getServer()->allowSnowGolem) {\n\t\t\t\t$block0 = $level->getBlock($block->add(0,-1,0));\n\t\t\t\t$block1 = $level->getBlock($block->add(0,-2,0));\n\t\t\t\tif($block0->getId() == Item::SNOW_BLOCK and $block1->getId() == Item::SNOW_BLOCK) {\n\t\t\t\t\t$level->setBlock($block, new Air());\n\t\t\t\t\t$level->setBlock($block0, new Air());\n\t\t\t\t\t$level->setBlock($block1, new Air());\n\t\t\t\t\t$golem = new SnowGolem($player->getLevel()->getChunk($this->getX() >> 4, $this->getZ() >> 4), new CompoundTag(\"\", [\n\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t]));\n\t\t\t\t\t$golem->spawnToAll();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($player->getServer()->allowIronGolem) {\n\t\t\t\t$block0 = $level->getBlock($block->add(0,-1,0));\n\t\t\t\t$block1 = $level->getBlock($block->add(0,-2,0));\n\t\t\t\t$block2 = $level->getBlock($block->add(-1,-1,0));\n\t\t\t\t$block3 = $level->getBlock($block->add(1,-1,0));\n\t\t\t\t$block4 = $level->getBlock($block->add(0,-1,-1));\n\t\t\t\t$block5 = $level->getBlock($block->add(0,-1,1));\n\t\t\t\tif($block0->getId() == Item::IRON_BLOCK and $block1->getId() == Item::IRON_BLOCK) {\n\t\t\t\t\tif($block2->getId() == Item::IRON_BLOCK and $block3->getId() == Item::IRON_BLOCK and $block4->getId() == Item::AIR and $block5->getId() == Item::AIR) {\n\t\t\t\t\t\t$level->setBlock($block2, new Air());\n\t\t\t\t\t\t$level->setBlock($block3, new Air());\n\t\t\t\t\t}elseif($block4->getId() == Item::IRON_BLOCK and $block5->getId() == Item::IRON_BLOCK and $block2->getId() == Item::AIR and $block3->getId() == Item::AIR){\n\t\t\t\t\t\t$level->setBlock($block4, new Air());\n\t\t\t\t\t\t$level->setBlock($block5, new Air());\n\t\t\t\t\t}else return true;\n\t\t\t\t\t$level->setBlock($block, new Air());\n\t\t\t\t\t$level->setBlock($block0, new Air());\n\t\t\t\t\t$level->setBlock($block1, new Air());\n\t\t\t\t\t$golem = new IronGolem($player->getLevel()->getChunk($this->getX() >> 4, $this->getZ() >> 4), new CompoundTag(\"\", [\n\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t]));\n\t\t\t\t\t$golem->spawnToAll();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/LitRedstoneLamp.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass LitRedstoneLamp extends Solid{\n\n\tprotected $id = self::LIT_REDSTONE_LAMP;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Lit Redstone Lamp\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/LitRedstoneTorch.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass LitRedstoneTorch extends Solid{\n\n\tprotected $id = self::REDSTONE_TORCH;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Lit Redstone Torch\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Melon.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Melon extends Transparent{\n\n\tprotected $id = self::MELON_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Melon Block\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::MELON_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = $fortunel > 2 ? 2 : $fortunel; //Note: for Melon level 2 is the same 3 So highest is 2\n\t\t\treturn [\n\t\t\t\t[Item::MELON_SLICE, 0, mt_rand(3, 7 + $fortunel)],\n\t\t\t];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/MelonStem.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Server;\n\nclass MelonStem extends Crops{\n\n\tprotected $id = self::MELON_STEM;\n\n\tpublic function getName(){\n\t\treturn \"Melon Stem\";\n\t}\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif(mt_rand(0, 2) == 1){\n\t\t\t\tif($this->meta < 0x07){\n\t\t\t\t\t$block = clone $this;\n\t\t\t\t\t++$block->meta;\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, $ev->getNewState(), true);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t}else{\n\t\t\t\t\tfor($side = 2; $side <= 5; ++$side){\n\t\t\t\t\t\t$b = $this->getSide($side);\n\t\t\t\t\t\tif($b->getId() === self::MELON_BLOCK){\n\t\t\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$side = $this->getSide(mt_rand(2, 5));\n\t\t\t\t\t$d = $side->getSide(0);\n\t\t\t\t\tif($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){\n\t\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Melon()));\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($side, $ev->getNewState(), true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::MELON_SEEDS, 0, mt_rand(0, 2)],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/MobHead.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Skull as SkullTile;\nuse pocketmine\\tile\\Spawnable;\nuse pocketmine\\tile\\Tile;\n\nclass MobHead extends Flowable{\n\n\tprotected $id = self::MOB_HEAD_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 1;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Mob Head\";\n\t}\n\n\tprotected function recalculateBoundingBox(){\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + 0.25,\n\t\t\t$this->y,\n\t\t\t$this->z + 0.25,\n\t\t\t$this->x + 0.75,\n\t\t\t$this->y + 0.5,\n\t\t\t$this->z + 0.75\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($face !== 0){\n\t\t\t$this->meta = $face;\n\t\t\tif($face === 1){\n\t\t\t\t$rot = floor(($player->yaw * 16 / 360) + 0.5) & 0x0F;\n\t\t\t}else{\n\t\t\t\t$rot = $face;\n\t\t\t}\n\t\t\t$this->getLevel()->setBlock($block, $this, true);\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::SKULL),\n\t\t\t\tnew ByteTag(\"SkullType\", $item->getDamage()),\n\t\t\t\tnew ByteTag(\"Rot\", $rot),\n\t\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t\t]);\n\t\t\tif($item->hasCustomName()){\n\t\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t\t}\n\t\t\t/** @var Spawnable $tile */\n\t\t\tTile::createTile(\"Skull\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\t$faces = [\n\t\t\t1 => 0,\n\t\t\t2 => 3,\n\t\t\t3 => 2,\n\t\t\t4 => 5,\n\t\t\t5 => 4,\n\t\t];\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide($faces[$this->meta])->getId() === self::AIR){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn parent::onUpdate($type);\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif(($tile = $this->level->getTile($this)) instanceof SkullTile){\n\t\t\treturn [\n\t\t\t\t[Item::MOB_HEAD, $tile->getType(), 1]\n\t\t\t];\n\t\t}\n\n\t\treturn [];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/MonsterEggBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass MonsterEggBlock extends Solid{\n\n\tprotected $id = self::MONSTER_EGG_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Monster Egg Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/MonsterSpawner.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____ \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\tile\\MobSpawner;\nuse pocketmine\\Player;\n\nclass MonsterSpawner extends Solid{\n\n\tprotected $id = self::MONSTER_SPAWNER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Monster Spawner\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($this->getDamage() == 0){\n\t\t\tif($item->getId() == Item::SPAWN_EGG){\n\t\t\t\t$tile = $this->getLevel()->getTile($this);\n\t\t\t\tif($tile instanceof MobSpawner){\n\t\t\t\t\t$this->meta = $item->getDamage();\n\t\t\t\t\t//$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t\t\t$tile->setEntityId($this->meta);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::MOB_SPAWNER),\n\t\t\tnew IntTag(\"x\", $block->x),\n\t\t\tnew IntTag(\"y\", $block->y),\n\t\t\tnew IntTag(\"z\", $block->z),\n\t\t\tnew IntTag(\"EntityId\", 0),\n\t\t]);\n\t\t\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\t\t\n\t\tTile::createTile(Tile::MOB_SPAWNER, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/MossStone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass MossStone extends Solid{\n\n\tprotected $id = self::MOSS_STONE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Moss Stone\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::MOSS_STONE, $this->meta, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Mycelium.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockSpreadEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Server;\n\n\nclass Mycelium extends Solid{\n\n\tprotected $id = self::MYCELIUM;\n\n\tpublic function __construct(){}\n\n\tpublic function getName(){\n\t\treturn \"Mycelium\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.6;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::MYCELIUM, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[Item::DIRT, 0, 1],\n\t\t\t];\n\t\t}\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\t//TODO: light levels\n\t\t\t$x = mt_rand($this->x - 1, $this->x + 1);\n\t\t\t$y = mt_rand($this->y - 2, $this->y + 2);\n\t\t\t$z = mt_rand($this->z - 1, $this->z + 1);\n\t\t\t$block = $this->getLevel()->getBlock(new Vector3($x, $y, $z));\n\t\t\tif($block->getId() === Block::DIRT){\n\t\t\t\tif($block->getSide(1) instanceof Transparent){\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockSpreadEvent($block, $this, new Mycelium()));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->getLevel()->setBlock($block, $ev->getNewState());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/NetherBrick.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass NetherBrick extends Solid{\n\n\tprotected $id = self::NETHER_BRICKS;\n\n\tpublic function __construct(){}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Nether Bricks\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::NETHER_BRICKS, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/NetherBrickFence.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass NetherBrickFence extends Transparent{\n\n\tprotected $id = self::NETHER_BRICK_FENCE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Nether Brick Fence\";\n\t}\n\n\tpublic function canConnect(Block $block){\n\t\treturn ($block instanceof NetherBrickFence) or ($block->isSolid() and !$block->isTransparent());\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\treturn [\n\t\t\t\t[$this->id, $this->meta, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/NetherBrickStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass NetherBrickStairs extends Stair{\n\n\tprotected $id = self::NETHER_BRICKS_STAIRS;\n\n\tpublic function getName(){\n\t\treturn \"Nether Bricks Stairs\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/NetherQuartzOre.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass NetherQuartzOre extends Solid{\n\tprotected $id = self::NETHER_QUARTZ_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Nether Quartz Ore\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 15;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::NETHER_QUARTZ_ORE, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t\t$times = [1,1,2,3,4];\n\t\t\t\t$time = $times[mt_rand(0, $fortunel + 1)];\n\t\t\t\treturn [\n\t\t\t\t\t[Item::NETHER_QUARTZ, 0, $time],\n\t\t\t\t];\n\t\t\t}\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/NetherReactor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass NetherReactor extends Solid{\n\n\tprotected $id = self::NETHER_REACTOR;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Nether Reactor\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/NetherWart.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass NetherWart extends Flowable{\n\t\n\tprotected $id = self::NETHER_WART_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Nether Wart Block\";\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === self::SOUL_SAND){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif(mt_rand(0, 12) == 1){//only have 0-3 So maybe slowly\n\t\t\t\tif($this->meta < 0x03){//0x03\n\t\t\t\t\t$block = clone $this;\n\t\t\t\t\t++$block->meta;\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($this->meta >= 0x03){\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t$drops[] = [Item::NETHER_WART, 0, mt_rand(2, 4 + $fortunel)];\n\t\t}else{\n\t\t\t$drops[] = [Item::NETHER_WART, 0, 1];\n\t\t}\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/NetherWartBlock.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass NetherWartBlock extends Flowable{\n\t\n\tprotected $id = self::NETHER_WART_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Nether Wart Block\";\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === self::SOUL_SAND){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif(mt_rand(0, 12) == 1){//only have 0-3 So maybe slowly\n\t\t\t\tif($this->meta < 0x03){//0x03\n\t\t\t\t\t$block = clone $this;\n\t\t\t\t\t++$block->meta;\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, $ev->getNewState(), true, true);\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($this->meta >= 0x03){\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t$drops[] = [Item::NETHER_WART, 0, mt_rand(2, 4 + $fortunel)];\n\t\t}else{\n\t\t\t$drops[] = [Item::NETHER_WART, 0, 1];\n\t\t}\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Netherrack.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Netherrack extends Solid{\n\n\tprotected $id = self::NETHERRACK;\n\n\tpublic function __construct(){}\n\n\tpublic function getName(){\n\t\treturn \"Netherrack\";\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 0.4;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\treturn [\n\t\t\t\t[Item::NETHERRACK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Noteblock.php",
    "content": "<?php\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\sound\\NoteblockSound;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\tile\\Music;\nuse pocketmine\\network\\protocol\\BlockEventPacket;\n\nclass Noteblock extends Solid implements ElectricalAppliance{\n\tprotected $id = self::NOTEBLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 0.8;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 4;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getStrength(){\n\t\tif($this->meta < 24) $this->meta++;\n\t\telse $this->meta = 0;\n\t\t$this->getLevel()->setBlock($this, $this);\n\t\treturn $this->meta * 1;\n\t}\n\n\tpublic function getInstrument(){\n\t\t$below = $this->getSide(Vector3::SIDE_DOWN);\n\t\tswitch($below->getId()){\n\t\t\tcase Block::WOOD:\n\t\t\tcase Block::WOOD2:\n\t\t\tcase Block::WOODEN_PLANK:\n\t\t\tcase Block::WOODEN_SLABS:\n\t\t\tcase Block::DOUBLE_WOOD_SLABS:\n\t\t\tcase Block::OAK_WOODEN_STAIRS:\n\t\t\tcase Block::SPRUCE_WOODEN_STAIRS:\n\t\t\tcase Block::BIRCH_WOODEN_STAIRS:\n\t\t\tcase Block::JUNGLE_WOODEN_STAIRS:\n\t\t\tcase Block::ACACIA_WOODEN_STAIRS:\n\t\t\tcase Block::DARK_OAK_WOODEN_STAIRS:\n\t\t\tcase Block::FENCE:\n\t\t\tcase Block::FENCE_GATE:\n\t\t\tcase Block::FENCE_GATE_SPRUCE:\n\t\t\tcase Block::FENCE_GATE_BIRCH:\n\t\t\tcase Block::FENCE_GATE_JUNGLE:\n\t\t\tcase Block::FENCE_GATE_DARK_OAK:\n\t\t\tcase Block::FENCE_GATE_ACACIA:\n\t\t\tcase Block::SPRUCE_WOOD_STAIRS:\n\t\t\tcase Block::BOOKSHELF:\n\t\t\tcase Block::CHEST:\n\t\t\tcase Block::CRAFTING_TABLE:\n\t\t\tcase Block::SIGN_POST:\n\t\t\tcase Block::WALL_SIGN:\n\t\t\tcase Block::DOOR_BLOCK:\n\t\t\tcase Block::NOTEBLOCK:\n\t\t\t\treturn NoteblockSound::INSTRUMENT_BASS;\n\t\t\tcase Block::SAND:\n\t\t\tcase Block::SOUL_SAND:\n\t\t\t\treturn NoteblockSound::INSTRUMENT_TABOUR;\n\t\t\tcase Block::GLASS:\n\t\t\tcase Block::GLASS_PANE:\n\t\t\t\treturn NoteblockSound::INSTRUMENT_CLICK;\n\t\t\tcase Block::STONE:\n\t\t\tcase Block::COBBLESTONE:\n\t\t\tcase Block::SANDSTONE:\n\t\t\tcase Block::MOSS_STONE:\n\t\t\tcase Block::BRICKS:\n\t\t\tcase Block::STONE_BRICK:\n\t\t\tcase Block::NETHER_BRICKS:\n\t\t\tcase Block::QUARTZ_BLOCK:\n\t\t\tcase Block::SLAB:\n\t\t\tcase Block::COBBLESTONE_STAIRS:\n\t\t\tcase Block::BRICK_STAIRS:\n\t\t\tcase Block::STONE_BRICK_STAIRS:\n\t\t\tcase Block::NETHER_BRICKS_STAIRS:\n\t\t\tcase Block::SANDSTONE_STAIRS:\n\t\t\tcase Block::QUARTZ_STAIRS:\n\t\t\tcase Block::COBBLESTONE_WALL:\n\t\t\tcase Block::NETHER_BRICK_FENCE:\n\t\t\tcase Block::BEDROCK:\n\t\t\tcase Block::GOLD_ORE:\n\t\t\tcase Block::IRON_ORE:\n\t\t\tcase Block::COAL_ORE:\n\t\t\tcase Block::LAPIS_ORE:\n\t\t\tcase Block::DIAMOND_ORE:\n\t\t\tcase Block::REDSTONE_ORE:\n\t\t\tcase Block::GLOWING_REDSTONE_ORE:\n\t\t\tcase Block::EMERALD_ORE:\n\t\t\tcase Block::FURNACE:\n\t\t\tcase Block::BURNING_FURNACE:\n\t\t\tcase Block::OBSIDIAN:\n\t\t\tcase Block::MONSTER_SPAWNER:\n\t\t\tcase Block::NETHERRACK:\n\t\t\tcase Block::ENCHANTING_TABLE:\n\t\t\tcase Block::END_STONE:\n\t\t\tcase Block::STAINED_CLAY:\n\t\t\tcase Block::COAL_BLOCK:\n\t\t\t\treturn NoteblockSound::INSTRUMENT_BASS_DRUM;\n\t\t}\n\t\treturn NoteblockSound::INSTRUMENT_PIANO;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$this->getLevel()->setBlock($this, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::NOTEBLOCK),\n\t\t\t\tnew IntTag(\"x\", $block->x),\n\t\t\t\tnew IntTag(\"y\", $block->y),\n\t\t\t\tnew IntTag(\"z\", $block->z),\n\t\t\t\tnew ByteTag(\"note\", 0)\n\t\t]);\n\t\tTile::createTile(Tile::NOTEBLOCK, $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\t$tile = $this->getLevel()->getTile($this);\n\t\tif($tile instanceof Music){\n\t\t\t$instrument = $this->getInstrument();\n\t\t\t$pitch = $tile->getNote() + 1;\n\t\t\tif($pitch < 0 or $pitch > 24){\n\t\t\t\t$pitch = 0;\n\t\t\t}\n\t\t\t$tile->setNote($pitch);\n\t\t\t$this->getLevel()->addSound(new NoteblockSound($this, $instrument, $pitch));\n\t\t\t$pk = new BlockEventPacket();\n\t\t\t$pk->x = $this->x;\n\t\t\t$pk->y = $this->y;\n\t\t\t$pk->z = $this->z;\n\t\t\t$pk->case1 = $instrument;\n\t\t\t$pk->case2 = $pitch;\n\t\t\t$player->dataPacket($pk);\n\t\t\t$this->getLevel()->addChunkPacket($tile->chunk->getX(), $tile->chunk->getZ(), $pk);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Noteblock\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Obsidian.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\Vector3;\n\nclass Obsidian extends Solid{\n\n\tprotected $id = self::OBSIDIAN;\n\t\n\t/** @var Vector3  */\n\tprivate $temporalVector = null;\n\n\tpublic function __construct(){\n\t\tif($this->temporalVector === null){\n\t\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t}\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Obsidian\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 35;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 5){\n\t\t\treturn [\n\t\t\t\t[Item::OBSIDIAN, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\t\n\tpublic function onBreak(Item $item) {\n\t\tparent::onBreak($item);\n\t\t\n\t\tif($this->getLevel()->getServer()->netherEnabled){\n\t\t\tfor($i = 0;$i <= 6;$i++){\n\t\t\t\tif($this->getSide($i)->getId() == self::PORTAL){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif($i == 6){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$block = $this->getSide($i);\n\t\t\tif($this->getLevel()->getBlock($this->temporalVector->setComponents($block->x - 1, $block->y, $block->z))->getId() == Block::PORTAL or\n\t\t\t\t$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x + 1, $block->y, $block->z))->getId() == Block::PORTAL){\n\t\t\t\tfor($x = $block->x;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL;$x++){\n\t\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t\t}\n\t\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor($x = $block->x - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL;$x--){\n\t\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t\t}\n\t\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tfor($z = $block->z;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL;$z++){\n\t\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t\t}\n\t\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tfor($z = $block->z - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL;$z--){\n\t\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t\t}\n\t\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/PackedIce.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass PackedIce extends Solid {\n\n\tprotected $id = self::PACKED_ICE;\n\n\tpublic function __construct() {\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Packed Ice\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getToolType() {\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::PACKED_ICE, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n} \n"
  },
  {
    "path": "src/pocketmine/block/Piston.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass Piston extends Solid{\n\n\tprotected $id = self::PISTON;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Piston\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/PistonHead.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass PistonHead extends Solid{\n\n\tprotected $id = self::PISTON_HEAD;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Piston Head\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Planks.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass Planks extends Solid{\n\tconst OAK = 0;\n\tconst SPRUCE = 1;\n\tconst BIRCH = 2;\n\tconst JUNGLE = 3;\n\tconst ACACIA = 4;\n\tconst DARK_OAK = 5;\n\n\tprotected $id = self::WOODEN_PLANKS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 20;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::OAK => \"Oak Wood Planks\",\n\t\t\tself::SPRUCE => \"Spruce Wood Planks\",\n\t\t\tself::BIRCH => \"Birch Wood Planks\",\n\t\t\tself::JUNGLE => \"Jungle Wood Planks\",\n\t\t\tself::ACACIA => \"Acacia Wood Planks\",\n\t\t\tself::DARK_OAK => \"Dark Oak Wood Planks\",\n\t\t\t6 => \"Unknown Planks\",\n\t\t\t7 => \"Unknown Planks\"\n\t\t];\n\t\treturn $names[$this->meta & 0x07];\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Podzol.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Podzol extends Solid{\n\n\tprotected $id = self::PODZOL;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Podzol\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 2.5;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::PODZOL, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[Item::DIRT, 0, 1],\n\t\t\t];\n\t\t}\n\t\t\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Portal.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\Player;\nuse pocketmine\\math\\Vector3;\n\nclass Portal extends Transparent{\n\n\tprotected $id = self::PORTAL;\n\n\t/** @var  Vector3 */\n\tprivate $temporalVector = null;\n\t\n\tpublic function __construct(){\n\t\tif($this->temporalVector === null){\n\t\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t}\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Portal\";\n\t}\n\t\n\tpublic function getHardness() {\n\t\treturn -1;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 0;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn true;\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$block = $this;\n\t\tif($this->getLevel()->getBlock($this->temporalVector->setComponents($block->x - 1, $block->y, $block->z))->getId() == Block::PORTAL or\n\t\t\t$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x + 1, $block->y, $block->z))->getId() == Block::PORTAL){//x方向\n\t\t\tfor($x = $block->x;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL;$x++){\n\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t}\n\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor($x = $block->x - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $block->y, $block->z))->getId() == Block::PORTAL;$x--){\n\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t}\n\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($x, $y, $block->z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($x, $y, $block->z), new Air());\n\t\t\t\t}\n\t\t\t}\n\t\t}else{//z方向\n\t\t\tfor($z = $block->z;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL;$z++){\n\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t}\n\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t}\n\t\t\t}\n\t\t\tfor($z = $block->z - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $block->y, $z))->getId() == Block::PORTAL;$z--){\n\t\t\t\tfor($y = $block->y;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y++){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t}\n\t\t\t\tfor($y = $block->y - 1;$this->getLevel()->getBlock($this->temporalVector->setComponents($block->x, $y, $z))->getId() == Block::PORTAL;$y--){\n\t\t\t\t\t$this->getLevel()->setBlock($this->temporalVector->setComponents($block->x, $y, $z), new Air());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tparent::onBreak($item);\n\t}\n\t\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$this->meta = $player->getDirection() & 0x01;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n\t\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/PortalBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass PortalBlock extends Solid{\n\n\tprotected $id = self::PORTAL_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Portal Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Potato.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Potato extends Crops{\n\n\tprotected $id = self::POTATO_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Potato Block\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($this->meta >= 0x07){\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t$drops[] = [Item::POTATO, 0, mt_rand(1, 4 + $fortunel)];\n\t\t}else{\n\t\t\t$drops[] = [Item::POTATO, 0, 1];\n\t\t}\n\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/PoweredComparatorBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass PoweredComparatorBlock extends Solid{\n\n\tprotected $id = self::POWERED_COMPARATOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Powered Comparator Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/PoweredRail.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\Player;\nuse pocketmine\\item\\Item;\nuse pocketmine\\math\\Vector3;\n\nclass PoweredRail extends Rail{\n\n\tprotected $id = self::POWERED_RAIL;\n\t/** @var Vector3 [] */\n\tprotected $connected = [];\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;//0,1,2,3,4,5\n\t}\n\n\tpublic function getName(){\n\t\treturn \"PoweredRail\";\n\t}\n\n\tprotected function update(){\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param Rail $block\n\t * @return bool\n\t */\n\tpublic function canConnect(Rail $block){\n\t\tif($this->distanceSquared($block) > 2){\n\t\t\treturn false;\n\t\t}\n\t\t/** @var Vector3 [] $blocks */\n\t\tif(count($blocks = self::check($this)) == 2){\n\t\t\treturn false;\n\t\t}\n\t\tif(isset($blocks[0])){\n\t\t\t$v3 = $blocks[0]->subtract($this);\n\t\t\t$v33 = $block->subtract($this);\n\t\t\tif(abs($v3->x) == abs($v33->z) and abs($v3->z) == abs($v33->x)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn $blocks;\n\t}\n\n\tpublic function isBlock(Block $block){\n\t\tif($block instanceof AIR){\n\t\t\treturn false;\n\t\t}\n\t\treturn $block;\n\t}\n\n\tpublic function connect(Rail $rail, $force = false){\n\n\t\tif(!$force){\n\t\t\t$connected = $this->canConnect($rail);\n\t\t\tif(!is_array($connected)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t/** @var Vector3 [] $connected */\n\t\t\t$connected[] = $rail;\n\t\t\tswitch(count($connected)){\n\t\t\t\tcase  1:\n\t\t\t\t\t$v3 = $connected[0]->subtract($this);\n\t\t\t\t\t$this->meta = (($v3->y != 1) ? ($v3->x == 0 ? 0 : 1) : ($v3->z == 0 ? ($v3->x / -2) + 2.5 : ($v3->z / 2) + 4.5));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\t$subtract = [];\n\t\t\t\t\tforeach($connected as $key => $value){\n\t\t\t\t\t\t$subtract[$key] = $value->subtract($this);\n\t\t\t\t\t}\n\t\t\t\t\tif(abs($subtract[0]->x) == abs($subtract[1]->z) and abs($subtract[1]->x) == abs($subtract[0]->z)){\n\t\t\t\t\t\t$v3 = $connected[0]->subtract($this)->add($connected[1]->subtract($this));\n\t\t\t\t\t\t$this->meta = $v3->x == 1 ? ($v3->z == 1 ? 6 : 9) : ($v3->z == 1 ? 7 : 8);\n\t\t\t\t\t}elseif($subtract[0]->y == 1 or $subtract[1]->y == 1){\n\t\t\t\t\t\t$v3 = $subtract[0]->y == 1 ? $subtract[0] : $subtract[1];\n\t\t\t\t\t\t$this->meta = $v3->x == 0 ? ($v3->x == -1 ? 4 : 5) : ($v3->x == 1 ? 2 : 3);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->meta = $subtract[0]->x == 0 ? 0 : 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t$this->level->setBlock($this, Block::get($this->id, $this->meta), true, true);\n\t\treturn true;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$downBlock = $this->getSide(Vector3::SIDE_DOWN);\n\n\t\tif($downBlock instanceof Rail or !$this->isBlock($downBlock)){//判断是否可以放置\n\t\t\treturn false;\n\t\t}\n\n\t\t$arrayXZ = [[1, 0], [0, 1], [-1, 0], [0, -1]];\n\t\t$arrayY = [0, 1, -1];\n\n\t\t/** @var Vector3 [] $connected */\n\t\t$connected = [];\n\t\tforeach($arrayXZ as $key => $xz){\n\t\t\tforeach($arrayY as $y){\n\t\t\t\t$v3 = (new Vector3($xz[0], $y, $xz[1]))->add($this);\n\t\t\t\t$block = $this->level->getBlock($v3);\n\t\t\t\tif($block instanceof Rail){\n\t\t\t\t\tif($block->connect($this)){\n\t\t\t\t\t\t$connected[] = $v3;\n\t\t\t\t\t\t//感觉这里怪怪的\n\t\t\t\t\t\tif($key <= 1){\n\t\t\t\t\t\t\t$xz = $arrayXZ[$key + 1];\n\t\t\t\t\t\t\tforeach($arrayY as $yy){\n\t\t\t\t\t\t\t\t$v3 = (new Vector3($xz[0], $yy, $xz[1]))->add($this);\n\t\t\t\t\t\t\t\t$block = $this->level->getBlock($v3);\n\t\t\t\t\t\t\t\tif($block instanceof Rail){\n\t\t\t\t\t\t\t\t\tif($block->connect($this)){\n\t\t\t\t\t\t\t\t\t\t$connected[] = $v3;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(count($connected) >= 1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tswitch(count($connected)){\n\t\t\tcase  1:\n\t\t\t\t$v3 = $connected[0]->subtract($this);\n\t\t\t\t$this->meta = (($v3->y != 1) ? ($v3->x == 0 ? 0 : 1) : ($v3->z == 0 ? ($v3->x / -2) + 2.5 : ($v3->z / 2) + 4.5));\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$subtract = [];\n\t\t\t\tforeach($connected as $key => $value){\n\t\t\t\t\t$subtract[$key] = $value->subtract($this);\n\t\t\t\t}\n\t\t\t\tif(abs($subtract[0]->x) == abs($subtract[1]->z) and abs($subtract[1]->x) == abs($subtract[0]->z)){\n\t\t\t\t\t$v3 = $connected[0]->subtract($this)->add($connected[1]->subtract($this));\n\t\t\t\t\t$this->meta = $v3->x == 1 ? ($v3->z == 1 ? 6 : 9) : ($v3->z == 1 ? 7 : 8);\n\t\t\t\t}elseif($subtract[0]->y == 1 or $subtract[1]->y == 1){\n\t\t\t\t\t$v3 = $subtract[0]->y == 1 ? $subtract[0] : $subtract[1];\n\t\t\t\t\t$this->meta = $v3->x == 0 ? ($v3->x == -1 ? 4 : 5) : ($v3->x == 1 ? 2 : 3);\n\t\t\t\t}else{\n\t\t\t\t\t$this->meta = $subtract[0]->x == 0 ? 0 : 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$this->level->setBlock($this, Block::get($this->id, $this->meta), true, true);\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.7;\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/PoweredRepeater.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\nclass PoweredRepeater extends RedstoneSource{\n\tprotected $id = self::POWERED_REPEATER_BLOCK;\n\n\tconst ACTION_ACTIVATE = \"Repeater Activate\";\n\tconst ACTION_DEACTIVATE = \"Repeater Deactivate\";\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Powered Repeater\";\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getStrength(){\n\t\treturn 15;\n\t}\n\n\tpublic function getDirection() : int{\n\t\t$direction = 0;\n\t\tswitch($this->meta % 4){\n\t\t\tcase 0:\n\t\t\t\t$direction = 3;\n\t\t\t\tbreak;\n\t\t\tcase 1:\n\t\t\t\t$direction = 4;\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$direction = 2;\n\t\t\t\tbreak;\n\t\t\tcase 3:\n\t\t\t\t$direction = 5;\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $direction;\n\t}\n\t\n\tpublic function getOppositeDirection() : int{\n\t\treturn $this->getOppositeSide($this->getDirection());\n\t}\n\n\tpublic function getDelayLevel() : int{\n\t\treturn round(($this->meta - ($this->meta % 4)) / 4) + 1;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\tif(!$from instanceof Block){\n\t\t\treturn false;\n\t\t}else{\n\t\t\tif($this->y != $from->y){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif($from->equals($this->getSide($this->getOppositeDirection()))){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic function activate(array $ignore = []){\n\t\tif($this->canCalc()){\n\t\t\tif($this->id != self::POWERED_REPEATER_BLOCK){\n\t\t\t\t$this->id = self::POWERED_REPEATER_BLOCK;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t}\n\t\t\t$this->getLevel()->setBlockTempData($this, self::ACTION_ACTIVATE);\n\t\t\t$this->getLevel()->scheduleUpdate($this, $this->getDelayLevel() * 2);\n\t\t}\n\t}\n\n\tpublic function deactivate(array $ignore = []){\n\t\tif($this->canCalc()){\n\t\t\tif($this->id != self::UNPOWERED_REPEATER_BLOCK){\n\t\t\t\t$this->id = self::UNPOWERED_REPEATER_BLOCK;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t}\n\t\t\t$this->getLevel()->setBlockTempData($this, self::ACTION_DEACTIVATE);\n\t\t\t$this->getLevel()->scheduleUpdate($this, $this->getDelayLevel() * 2);\n\t\t}\n\t}\n\n\tpublic function deactivateImmediately(){\n\t\t$this->deactivateBlock($this->getSide($this->getOppositeDirection()));\n\t\t$this->deactivateBlock($this->getSide(Vector3::SIDE_DOWN, 2));//TODO: improve\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type == Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\tif($this->getLevel()->getBlockTempData($this) == self::ACTION_ACTIVATE){\n\t\t\t\t$this->activateBlock($this->getSide($this->getOppositeDirection()));\n\t\t\t\t$this->activateBlock($this->getSide(Vector3::SIDE_DOWN, 2));\n\t\t\t}elseif($this->getLevel()->getBlockTempData($this) == self::ACTION_DEACTIVATE){\n\t\t\t\t$this->deactivateImmediately();\n\t\t\t}\n\t\t\t$this->getLevel()->setBlockTempData($this);\n\t\t}\n\t\treturn $type;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\t$meta = $this->meta + 4;\n\t\tif($meta > 15) $this->meta = $this->meta % 4;\n\t\telse $this->meta = $meta;\n\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\treturn true;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$this->meta = ((int) $player->getDirection() + 5) % 4;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, false);\n\t\tif($this->checkPower($this)){\n\t\t\t$this->activate();\n\t\t}\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->deactivateImmediately();\n\t\t$this->getLevel()->setBlock($this, new Air(), true, false);\n\t\t$this->getLevel()->setBlockTempData($this);\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\treturn [\n\t\t\t[Item::REPEATER, 0, 1]\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/PoweredRepeaterBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass PoweredRepeaterBlock extends Solid{\n\n\tprotected $id = self::POWERED_REPEATER_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Powered Repeater Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/PressurePlate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\math\\Math;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\sound\\GenericSound;\nuse pocketmine\\Player;\n\nclass PressurePlate extends RedstoneSource{\n\tprotected $activateTime = 0;\n\tprotected $canActivate = true;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\tif($this->getLevel()->getServer()->redstoneEnabled and $this->canActivate){\n\t\t\tif(!$this->isActivated()){\n\t\t\t\t$this->meta = 1;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t\t$this->getLevel()->addSound(new GenericSound($this, 1000));\n\t\t\t}\n\t\t\tif(!$this->isActivated() or ($this->isActivated() and ($this->getLevel()->getServer()->getTick() % 30) == 0)){\n\t\t\t\t$this->activate();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn ($this->meta == 0) ? false : true;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$below = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\tif($below instanceof Transparent){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\t/*if($type == Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\tif($this->isActivated()){\n\t\t\t\tif(!$this->isCollided()){\n\t\t\t\t\t$this->meta = 0;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t\t\t$this->deactivate();\n\t\t\t\t\treturn Level::BLOCK_UPDATE_SCHEDULED;\n\t\t\t\t}\n\t\t\t}\n\t\t}*/\n\t\treturn true;\n\t}\n\n\tpublic function checkActivation(){\n\t\tif($this->isActivated()){\n\t\t\tif((($this->getLevel()->getServer()->getTick() - $this->activateTime)) >= 3){\n\t\t\t\t$this->meta = 0;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t\t$this->deactivate();\n\t\t\t}\n\t\t}\n\t}\n\n\t/*public function isCollided(){\n\t\tforeach($this->getLevel()->getEntities() as $p){\n\t\t\t$blocks = $p->getBlocksAround();\n\t\t\tif(isset($blocks[Level::blockHash($this->x, $this->y, $this->z)])) return true;\n\t\t}\n\t\treturn false;\n\t}*/\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$below = $this->getSide(Vector3::SIDE_DOWN);\n\t\tif($below instanceof Transparent) return;\n\t\telse $this->getLevel()->setBlock($block, $this, true, false);\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\tif($this->isActivated()){\n\t\t\t$this->meta = 0;\n\t\t\t$this->deactivate();\n\t\t}\n\t\t$this->canActivate = false;\n\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 2.5;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Prismarine.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Pocketmine Team\n * @link http://www.pocketmine.net\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Prismarine extends Solid{\n\n\tconst NORMAL = 0;\n\tconst DARK = 1;\n\tconst BRICKS = 2;\n\n\tprotected $id = self::PRISMARINE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 1.5;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::NORMAL => \"Prismarine\",\n\t\t\tself::DARK => \"Dark Prismarine\",\n\t\t\tself::BRICKS => \"Prismarine Bricks\",\n\t\t];\n\t\treturn $names[$this->meta & 0x0f];\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\treturn [\n\t\t\t\t[$this->id, $this->meta & 0x0f, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Pumpkin.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\Player;\nuse pocketmine\\entity\\IronGolem;\nuse pocketmine\\entity\\SnowGolem;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\ListTag;\n\nclass Pumpkin extends Solid{\n\n\tprotected $id = self::PUMPKIN;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1;\n\t}\n\t\n\tpublic function isHelmet(){\n\t\treturn true;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Pumpkin\";\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$this->meta = ((int) $player->getDirection() + 5) % 4;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\tif($player != null) {\n\t\t\t$level = $this->getLevel();\n\t\t\tif($player->getServer()->allowSnowGolem) {\n\t\t\t\t$block0 = $level->getBlock($block->add(0,-1,0));\n\t\t\t\t$block1 = $level->getBlock($block->add(0,-2,0));\n\t\t\t\tif($block0->getId() == Item::SNOW_BLOCK and $block1->getId() == Item::SNOW_BLOCK) {\n\t\t\t\t\t$level->setBlock($block, new Air());\n\t\t\t\t\t$level->setBlock($block0, new Air());\n\t\t\t\t\t$level->setBlock($block1, new Air());\n\t\t\t\t\t$golem = new SnowGolem($player->getLevel()->getChunk($this->getX() >> 4, $this->getZ() >> 4), new CompoundTag(\"\", [\n\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t]));\n\t\t\t\t\t$golem->spawnToAll();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($player->getServer()->allowIronGolem) {\n\t\t\t\t$block0 = $level->getBlock($block->add(0,-1,0));\n\t\t\t\t$block1 = $level->getBlock($block->add(0,-2,0));\n\t\t\t\t$block2 = $level->getBlock($block->add(-1,-1,0));\n\t\t\t\t$block3 = $level->getBlock($block->add(1,-1,0));\n\t\t\t\t$block4 = $level->getBlock($block->add(0,-1,-1));\n\t\t\t\t$block5 = $level->getBlock($block->add(0,-1,1));\n\t\t\t\tif($block0->getId() == Item::IRON_BLOCK and $block1->getId() == Item::IRON_BLOCK) {\n\t\t\t\t\tif($block2->getId() == Item::IRON_BLOCK and $block3->getId() == Item::IRON_BLOCK and $block4->getId() == Item::AIR and $block5->getId() == Item::AIR) {\n\t\t\t\t\t\t$level->setBlock($block2, new Air());\n\t\t\t\t\t\t$level->setBlock($block3, new Air());\n\t\t\t\t\t}elseif($block4->getId() == Item::IRON_BLOCK and $block5->getId() == Item::IRON_BLOCK and $block2->getId() == Item::AIR and $block3->getId() == Item::AIR){\n\t\t\t\t\t\t$level->setBlock($block4, new Air());\n\t\t\t\t\t\t$level->setBlock($block5, new Air());\n\t\t\t\t\t}else return true;\n\t\t\t\t\t$level->setBlock($block, new Air());\n\t\t\t\t\t$level->setBlock($block0, new Air());\n\t\t\t\t\t$level->setBlock($block1, new Air());\n\t\t\t\t\t$golem = new IronGolem($player->getLevel()->getChunk($this->getX() >> 4, $this->getZ() >> 4), new CompoundTag(\"\", [\n\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t\t\t]));\n\t\t\t\t\t$golem->spawnToAll();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/PumpkinStem.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Server;\n\nclass PumpkinStem extends Crops{\n\n\tprotected $id = self::PUMPKIN_STEM;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Pumpkin Stem\";\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent()){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif(mt_rand(0, 2) == 1){\n\t\t\t\tif($this->meta < 0x07){\n\t\t\t\t\t$block = clone $this;\n\t\t\t\t\t++$block->meta;\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($this, $block));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->getLevel()->setBlock($this, $ev->getNewState(), true);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t}else{\n\t\t\t\t\tfor($side = 2; $side <= 5; ++$side){\n\t\t\t\t\t\t$b = $this->getSide($side);\n\t\t\t\t\t\tif($b->getId() === self::PUMPKIN){\n\t\t\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$side = $this->getSide(mt_rand(2, 5));\n\t\t\t\t\t$d = $side->getSide(0);\n\t\t\t\t\tif($side->getId() === self::AIR and ($d->getId() === self::FARMLAND or $d->getId() === self::GRASS or $d->getId() === self::DIRT)){\n\t\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($side, new Pumpkin()));\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($side, $ev->getNewState(), true);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::PUMPKIN_SEEDS, 0, mt_rand(0, 2)],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/PurpurBlock.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____          \r\n * |  __|_              _\r\n * | |__| |      _    _(_)_ __   ___\r\n * |  __| |_   _| |  | | | '_ \\ / _ \\\r\n * | |__| | | | | |/\\| | | | | | (_) |\r\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\r\n *         _|  /                 __| |\r\n *        |___/                 |____/\r\n * \r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author FunnyBuddys\r\n * @link http://www.github.net/H4PM\r\n * \r\n *\r\n*/\r\n\r\nnamespace pocketmine\\block;\r\n\r\nuse pocketmine\\item\\Item;\r\nuse pocketmine\\item\\Tool;\r\nuse pocketmine\\Player;\r\n\r\nclass PurpurBlock extends Solid{\r\n\r\n\tprotected $id = self::PURPUR_BLOCK;\r\n\r\n\tpublic function __construct($meta = 0){\r\n\t\t$this->meta = $meta;\r\n\t}\r\n\r\n\tpublic function getName(){\r\n\t\tstatic $names = [\r\n\t\t\t0 => \"Purpur Block\",\r\n\t\t\t2 => \"Purpur Pillar\",\r\n\t\t];\r\n\t\treturn $names[$this->meta & 0x0f]??\"Purpur Block\";\r\n\t}\r\n\r\n\tpublic function getHardness(){\r\n\t\treturn 1.5;\r\n\t}\r\n\t\r\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\r\n\t\tif($this->meta === 2){\r\n\t\t\t//Quartz pillar block and chiselled quartz have different orientations\r\n\t\t\t$faces = [\r\n\t\t\t\t0 => 0,\r\n\t\t\t\t1 => 0,\r\n\t\t\t\t2 => 0b1000,\r\n\t\t\t\t3 => 0b1000,\r\n\t\t\t\t4 => 0b0100,\r\n\t\t\t\t5 => 0b0100,\r\n\t\t\t];\r\n\t\t\t$this->meta = ($this->meta & 0x03) | $faces[$face];\r\n\t\t}\r\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\r\n\t\treturn true;\r\n\t}\r\n\r\n\tpublic function getToolType(){\r\n\t\treturn Tool::TYPE_PICKAXE;\r\n\t}\r\n\r\n\tpublic function getDrops(Item $item) : array {\r\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\r\n\t\t\treturn [\r\n\t\t\t\t[$this->id, $this->meta & 0x0f, 1],\r\n\t\t\t];\r\n\t\t}else{\r\n\t\t\treturn [];\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/block/PurpurStairs.php",
    "content": "<?php\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author erkam2002\n * @link http://www.github.net/H4PM\n * \n *\n*/\nnamespace pocketmine\\block;\nuse pocketmine\\item\\Tool;\nclass PurpurStairs extends Stair{\n\tprotected $id = self::PURPUR_STAIRS;\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\tpublic function getHardness() {\n\t\treturn 0.8;\n\t}\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\tpublic function getName(){\n\t\treturn \"Purpur Stairs\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Quartz.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\Player;\n\nclass Quartz extends Solid{\n\t\n\tconst QUARTZ_NORMAL = 0;\n\tconst QUARTZ_CHISELED = 1;\n\tconst QUARTZ_PILLAR = 2;\n\tconst QUARTZ_PILLAR2 = 3;\n\n\n\tprotected $id = self::QUARTZ_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.8;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Quartz Block\",\n\t\t\t1 => \"Chiseled Quartz Block\",\n\t\t\t2 => \"Quartz Pillar\",\n\t\t\t3 => \"Quartz Block\",\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n\t\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($this->meta === 1 or $this->meta === 2){\n\t\t\t//Quartz pillar block and chiselled quartz have different orientations\n\t\t\t$faces = [\n\t\t\t\t0 => 0,\n\t\t\t\t1 => 0,\n\t\t\t\t2 => 0b1000,\n\t\t\t\t3 => 0b1000,\n\t\t\t\t4 => 0b0100,\n\t\t\t\t5 => 0b0100,\n\t\t\t];\n\t\t\t$this->meta = ($this->meta & 0x03) | $faces[$face];\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\treturn true;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::QUARTZ_BLOCK, $this->meta & 0x03, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/QuartzStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass QuartzStairs extends Stair{\n\n\tprotected $id = self::QUARTZ_STAIRS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.8;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Quartz Stairs\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Rail.php",
    "content": "<?php\n\n/**\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\nclass Rail extends Flowable{\n\n\tconst STRAIGHT_EAST_WEST = 0;\n\tconst STRAIGHT_NORTH_SOUTH = 1;\n\tconst SLOPED_ASCENDING_NORTH = 2;\n\tconst SLOPED_ASCENDING_SOUTH = 3;\n\tconst SLOPED_ASCENDING_EAST = 4;\n\tconst SLOPED_ASCENDING_WEST = 5;\n\tconst CURVED_NORTH_WEST = 7;\n\tconst CURVED_SOUTH_WEST = 6;\n\tconst CURVED_SOUTH_EAST = 9;\n\tconst CURVED_NORTH_EAST = 8;\n\n\n\tprotected $id = self::RAIL;\n\t/** @var Vector3 [] */\n\tprotected $connected = [];\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Rail\";\n\t}\n\n\tprotected function update(){\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param Rail $block\n\t * @return bool\n\t */\n\tpublic function canConnect(Rail $block){\n\t\tif($this->distanceSquared($block) > 2){\n\t\t\treturn false;\n\t\t}\n\t\t/** @var Vector3 [] $blocks */\n\t\tif(count($blocks = self::check($this)) == 2){\n\t\t\treturn false;\n\t\t}\n\t\treturn $blocks;\n\t}\n\n\tpublic function isBlock(Block $block){\n\t\tif($block instanceof AIR){\n\t\t\treturn false;\n\t\t}\n\t\treturn $block;\n\t}\n\n\tpublic function connect(Rail $rail, $force = false){\n\n\t\tif(!$force){\n\t\t\t$connected = $this->canConnect($rail);\n\t\t\tif(!is_array($connected)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t/** @var Vector3 [] $connected */\n\t\t\t$connected[] = $rail;\n\t\t\tswitch(count($connected)){\n\t\t\t\tcase  1:\n\t\t\t\t\t$v3 = $connected[0]->subtract($this);\n\t\t\t\t\t$this->meta = (($v3->y != 1) ? ($v3->x == 0 ? 0 : 1) : ($v3->z == 0 ? ($v3->x / -2) + 2.5 : ($v3->z / 2) + 4.5));\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\t\t$subtract = [];\n\t\t\t\t\tforeach($connected as $key => $value){\n\t\t\t\t\t\t$subtract[$key] = $value->subtract($this);\n\t\t\t\t\t}\n\t\t\t\t\tif(abs($subtract[0]->x) == abs($subtract[1]->z) and abs($subtract[1]->x) == abs($subtract[0]->z)){\n\t\t\t\t\t\t$v3 = $connected[0]->subtract($this)->add($connected[1]->subtract($this));\n\t\t\t\t\t\t$this->meta = $v3->x == 1 ? ($v3->z == 1 ? 6 : 9) : ($v3->z == 1 ? 7 : 8);\n\t\t\t\t\t}elseif($subtract[0]->y == 1 or $subtract[1]->y == 1){\n\t\t\t\t\t\t$v3 = $subtract[0]->y == 1 ? $subtract[0] : $subtract[1];\n\t\t\t\t\t\t$this->meta = $v3->x == 0 ? ($v3->z == -1 ? 4 : 5) : ($v3->x == 1 ? 2 : 3);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->meta = $subtract[0]->x == 0 ? 0 : 1;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t$this->level->setBlock($this, Block::get($this->id, $this->meta), true, true);\n\t\treturn true;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$downBlock = $this->getSide(Vector3::SIDE_DOWN);\n\n\t\tif($downBlock instanceof Rail or !$this->isBlock($downBlock)){//判断是否可以放置\n\t\t\treturn false;\n\t\t}\n\n\t\t$arrayXZ = [[1, 0], [0, 1], [-1, 0], [0, -1]];\n\t\t$arrayY = [0, 1, -1];\n\n\t\t/** @var Vector3 [] $connected */\n\t\t$connected = [];\n\t\tforeach($arrayXZ as $xz){\n\t\t\t$x = $xz[0];\n\t\t\t$z = $xz[1];\n\t\t\tforeach($arrayY as $y){\n\t\t\t\t$v3 = (new Vector3($x, $y, $z))->add($this);\n\t\t\t\t$block = $this->level->getBlock($v3);\n\t\t\t\tif($block instanceof Rail){\n\t\t\t\t\tif($block->connect($this)){\n\t\t\t\t\t\t$connected[] = $v3;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(count($connected) == 2){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tswitch(count($connected)){\n\t\t\tcase  1:\n\t\t\t\t$v3 = $connected[0]->subtract($this);\n\t\t\t\t$this->meta = (($v3->y != 1) ? ($v3->x == 0 ? 0 : 1) : ($v3->z == 0 ? ($v3->x / -2) + 2.5 : ($v3->z / 2) + 4.5));\n\t\t\t\tbreak;\n\t\t\tcase 2:\n\t\t\t\t$subtract = [];\n\t\t\t\tforeach($connected as $key => $value){\n\t\t\t\t\t$subtract[$key] = $value->subtract($this);\n\t\t\t\t}\n\t\t\t\tif(abs($subtract[0]->x) == abs($subtract[1]->z) and abs($subtract[1]->x) == abs($subtract[0]->z)){\n\t\t\t\t\t$v3 = $connected[0]->subtract($this)->add($connected[1]->subtract($this));\n\t\t\t\t\t$this->meta = $v3->x == 1 ? ($v3->z == 1 ? 6 : 9) : ($v3->z == 1 ? 7 : 8);\n\t\t\t\t}elseif($subtract[0]->y == 1 or $subtract[1]->y == 1){\n\t\t\t\t\t$v3 = $subtract[0]->y == 1 ? $subtract[0] : $subtract[1];\n\t\t\t\t\t$this->meta = $v3->x == 0 ? ($v3->z == -1 ? 4 : 5) : ($v3->x == 1 ? 2 : 3);\n\t\t\t\t}else{\n\t\t\t\t\t$this->meta = $subtract[0]->x == 0 ? 0 : 1;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\tbreak;\n\t\t}\n\t\t$this->level->setBlock($this, Block::get($this->id, $this->meta), true, true);\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param Rail $rail\n\t * @return array\n\t */\n\tpublic static function check(Rail $rail){\n\t\t$array = [\n\t\t\t[[0, 1], [0, -1]],\n\t\t\t[[1, 0], [-1, 0]],\n\t\t\t[[1, 0], [-1, 0]],\n\t\t\t[[1, 0], [-1, 0]],\n\t\t\t[[0, 1], [0, -1]],\n\t\t\t[[0, 1], [0, -1]],\n\t\t\t[[1, 0], [0, 1]],\n\t\t\t[[0, 1], [-1, 0]],\n\t\t\t[[-1, 0], [0, -1]],\n\t\t\t[[0, -1], [1, 0]]\n\t\t];\n\t\t$arrayY = [0, 1, -1];\n\t\t$blocks = $array[$rail->getDamage()];\n\t\t$connected = [];\n\t\tforeach($arrayY as $y){\n\t\t\t$v3 = new Vector3($rail->x + $blocks[0][0], $rail->y + $y, $rail->z + $blocks[0][1]);\n\t\t\t$id = $rail->getLevel()->getBlockIdAt($v3->x, $v3->y, $v3->z);\n\t\t\t$meta = $rail->getLevel()->getBlockDataAt($v3->x, $v3->y, $v3->z);\n\t\t\tif(in_array($id, [self::RAIL, self::ACTIVATOR_RAIL, self::DETECTOR_RAIL, self::POWERED_RAIL]) and in_array([$rail->x - $v3->x, $rail->z - $v3->z], $array[$meta])){\n\t\t\t\t$connected[] = $v3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tforeach($arrayY as $y){\n\t\t\t$v3 = new Vector3($rail->x + $blocks[1][0], $rail->y + $y, $rail->z + $blocks[1][1]);\n\t\t\t$id = $rail->getLevel()->getBlockIdAt($v3->x, $v3->y, $v3->z);\n\t\t\t$meta = $rail->getLevel()->getBlockDataAt($v3->x, $v3->y, $v3->z);\n\t\t\tif(in_array($id, [self::RAIL, self::ACTIVATOR_RAIL, self::DETECTOR_RAIL, self::POWERED_RAIL]) and in_array([$rail->x - $v3->x, $rail->z - $v3->z], $array[$meta])){\n\t\t\t\t$connected[] = $v3;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $connected;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.7;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 3.5;\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/RedMushroom.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass RedMushroom extends Flowable{\n\n\tprotected $id = self::RED_MUSHROOM;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Red Mushroom\";\n\t}\n\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->isTransparent() === false){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/RedMushroomBlock.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass RedMushroomBlock extends Solid{\n\n\tconst RED = 14;\n\tconst STEM = 10;\n\n\tprotected $id = self::RED_MUSHROOM_BLOCK;\n\n\tpublic function __construct($meta = 14){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Red Mushroom Block\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.2;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 1;\n\t}\n\t\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\treturn [\n\t\t\t\t[Item::RED_MUSHROOM_BLOCK, SELF::RED, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [\n\t\t\t\t[Item::RED_MUSHROOM, 0, mt_rand(0, 2)],\n\t\t\t];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/RedSandstone.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\block;\n\nclass RedSandstone extends Sandstone{\n\tprotected $id = Block::RED_SANDSTONE;\n\t\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Red Sandstone\",\n\t\t\t1 => \"Chiseled Red Sandstone\",\n\t\t\t2 => \"Smooth Red Sandstone\",\n\t\t\t3 => \"\",\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/RedSandstoneSlab.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass RedSandstoneSlab extends Slab{\n\n\tprotected $id = Block::RED_SANDSTONE_SLAB;\n\n\tpublic function getName() : string{\n\t\treturn \"Red Sandstone Slab\";\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($face === 0){\n\t\t\tif($target->getId() === self::RED_SANDSTONE_SLAB and ($target->getDamage() & 0x08) === 0x08){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::RED_SANDSTONE_SLAB){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$this->meta |= 0x08;\n\t\t\t}\n\t\t}elseif($face === 1){\n\t\t\tif($target->getId() === self::RED_SANDSTONE_SLAB and ($target->getDamage() & 0x08) === 0){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::RED_SANDSTONE_SLAB){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t//TODO: check for collision\n\t\t}else{\n\t\t\tif($block->getId() === self::RED_SANDSTONE_SLAB){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_RED_SANDSTONE_SLAB, $this->meta), true);\n\t\t\t}else{\n\t\t\t\tif($fy > 0.5){\n\t\t\t\t\t$this->meta |= 0x08;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif($block->getId() === self::RED_SANDSTONE_SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){\n\t\t\treturn false;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/RedSandstoneStairs.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\block;\n\nclass RedSandstoneStairs extends SandstoneStairs{\n\n\tprotected $id = Block::RED_SANDSTONE_STAIRS;\n\n\tpublic function getName(){\n\t\treturn \"Red Sandstone Stairs\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Redstone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Redstone extends RedstoneSource{\n\n\tprotected $id = self::REDSTONE_BLOCK;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getBoundingBox() {\n\t\treturn Block::getBoundingBox();\n\t}\n\n\tpublic function canBeFlowedInto(){\n\t\treturn false;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn true;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Block of Redstone\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::REDSTONE_BLOCK, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/RedstoneLamp.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass RedstoneLamp extends Solid{\n\n\tprotected $id = self::REDSTONE_LAMP;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Redstone Lamp\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/RedstoneOre.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\level\\Level;\n\nclass RedstoneOre extends Solid{\n\n\tprotected $id = self::REDSTONE_ORE;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Redstone Ore\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL or $type === Level::BLOCK_UPDATE_TOUCH){\n\t\t\t$this->getLevel()->setBlock($this, Block::get(Item::GLOWING_REDSTONE_ORE, $this->meta));\n\n\t\t\treturn Level::BLOCK_UPDATE_WEAK;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= Tool::TIER_IRON){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::REDSTONE_ORE, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\t$fortuneL = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t\t$fortuneL = $fortuneL > 3 ? 3 : $fortuneL;\n\t\t\t\treturn [\n\t\t\t\t\t[Item::REDSTONE_DUST, 0, mt_rand(4, 5 + $fortuneL)],\n\t\t\t\t];\n\t\t\t}\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/RedstoneSource.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\n/*\n * This class is the power of all redstone blocks!\n */\n\nclass RedstoneSource extends Flowable{\n\tprotected $maxStrength = 15;\n\tprotected $activated = false;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getMaxStrength(){\n\t\treturn $this->maxStrength;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn $this->activated;\n\t}\n\n\tpublic function canCalc(){\n\t\treturn $this->getLevel()->getServer()->redstoneEnabled;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\tif($this->isActivated()){\n\t\t\t$this->activate();\n\t\t}\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\tif($this->isActivated()){\n\t\t\t$this->deactivate();\n\t\t}\n\t}\n\n\tpublic function activateBlockWithoutWire(Block $block){\n\n\t\tif(($block instanceof Door) or ($block instanceof Trapdoor) or ($block instanceof FenceGate)){\n\t\t\tif(!$block->isOpened()) $block->onActivate(new Item(0));\n\t\t}\n\t\tif($block->getId() == Block::TNT) $block->onActivate(new Item(Item::FLINT_AND_STEEL));\n\t\t/** @var InactiveRedstoneLamp $block */\n\t\tif($block->getId() == Block::INACTIVE_REDSTONE_LAMP) $block->turnOn();\n\t\t/** @var Dropper|Dispenser $block */\n\t\tif($block->getId() == Block::DROPPER or $block->getId() == Block::DISPENSER) $block->activate();\n\n\t\t/** @var PoweredRepeater $block */\n\t\tif($block->getId() == Block::UNPOWERED_REPEATER_BLOCK){\n\t\t\tif($this->equals($block->getSide($block->getDirection()))) $block->activate();\n\t\t}\n\t}\n\n\tpublic function activateBlock(Block $block){\n\t\t$this->activateBlockWithoutWire($block);\n\t\tif($block->getId() == Block::REDSTONE_WIRE){\n\t\t\t/** @var RedstoneWire $wire */\n\t\t\t$wire = $block;\n\t\t\t$wire->calcSignal($this->maxStrength, RedstoneWire::ON);\n\t\t}\n\t}\n\n\tpublic function deactivateBlock(Block $block){\n\t\t$this->deactivateBlockWithoutWire($block);\n\t\tif($block->getId() == Block::REDSTONE_WIRE){\n\t\t\t/** @var RedstoneWire $wire */\n\t\t\t$wire = $block;\n\t\t\t$wire->calcSignal(0, RedstoneWire::OFF);\n\t\t}\n\t}\n\n\tpublic function deactivateBlockWithoutWire(Block $block){\n\t\t/** @var Door $block */\n\t\tif(!$this->checkPower($block)){\n\t\t\tif(($block instanceof Door) or ($block instanceof Trapdoor) or ($block instanceof FenceGate)){\n\t\t\t\tif($block->isOpened()) $block->onActivate(new Item(0));\n\t\t\t}\n\t\t\t/** @var ActiveRedstoneLamp $block */\n\t\t\tif($block->getId() == Block::ACTIVE_REDSTONE_LAMP) $block->turnOff();\n\t\t}\n\t\t/** @var PoweredRepeater $block */\n\t\tif($block->getId() == Block::POWERED_REPEATER_BLOCK){\n\t\t\tif($this->equals($block->getSide($block->getDirection()))) $block->deactivate();\n\t\t}\n\t}\n\n\tpublic function activate(array $ignore = []){\n\t\tif($this->canCalc()){\n\t\t\t$this->activated = true;\n\t\t\t/** @var Door $block */\n\n\t\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_DOWN];\n\n\t\t\tforeach($sides as $side){\n\t\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t\t$block = $this->getSide($side);\n\t\t\t\t\t$this->activateBlock($block);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function deactivate(array $ignore = []){\n\t\tif($this->canCalc()){\n\t\t\t$this->activated = false;\n\t\t\t/** @var Door $block */\n\n\t\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH];\n\n\t\t\tforeach($sides as $side){\n\t\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t\t$block = $this->getSide($side);\n\t\t\t\t\t$this->deactivateBlock($block);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!in_array(Vector3::SIDE_DOWN, $ignore)){\n\t\t\t\t$block = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\t\tif(!$this->checkPower($block)){\n\t\t\t\t\t/** @var $block ActiveRedstoneLamp */\n\t\t\t\t\tif($block->getId() == Block::ACTIVE_REDSTONE_LAMP) $block->turnOff();\n\t\t\t\t}\n\n\t\t\t\t$block = $this->getSide(Vector3::SIDE_DOWN, 2);\n\t\t\t\t$this->deactivateBlock($block);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function checkPower(Block $block, array $ignore = [], $ignoreWire = false){\n\t\tif($block instanceof PoweredRepeater){\n\t\t\tif($block->getSide($block->getDirection())->isActivated($block)){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\t$sides = [\n\t\t\tVector3::SIDE_EAST,\n\t\t\tVector3::SIDE_WEST,\n\t\t\tVector3::SIDE_SOUTH,\n\t\t\tVector3::SIDE_NORTH\n\t\t];\n\t\tforeach($sides as $side){\n\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t$pos = $block->getSide($side);\n\t\t\t\tif($pos instanceof RedstoneSource){\n\t\t\t\t\tif($pos->isActivated($this)){\n\t\t\t\t\t\tif(($ignoreWire and $pos->getId() != self::REDSTONE_WIRE) or (!$ignoreWire and $pos->getId() != self::REDSTONE_WIRE)) return true;\n\t\t\t\t\t\tif(!$ignoreWire and $pos->getId() == self::REDSTONE_WIRE){\n\t\t\t\t\t\t\t/** @var RedstoneWire $pos */\n\t\t\t\t\t\t\t$cb = $pos->getUnconnectedSide();\n\t\t\t\t\t\t\tif(!$cb[0]) return false;\n\t\t\t\t\t\t\tif($this->equals($pos->getSide($cb[0]))) return true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($block->getId() == Block::ACTIVE_REDSTONE_LAMP and !in_array(Vector3::SIDE_UP, $ignore)){\n\t\t\t$pos = $block->getSide(Vector3::SIDE_UP);\n\t\t\tif($pos instanceof RedstoneSource and $pos->getId() != self::REDSTONE_TORCH){\n\t\t\t\tif($pos->isActivated($this)) return true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\n\tpublic function checkTorchOn(Block $pos, array $ignore = []){\n\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP];\n\t\tforeach($sides as $side){\n\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t/** @var RedstoneTorch $block */\n\t\t\t\t$block = $pos->getSide($side);\n\t\t\t\tif($block->getId() == self::REDSTONE_TORCH){\n\t\t\t\t\t$faces = [\n\t\t\t\t\t\t1 => 4,\n\t\t\t\t\t\t2 => 5,\n\t\t\t\t\t\t3 => 2,\n\t\t\t\t\t\t4 => 3,\n\t\t\t\t\t\t5 => 0,\n\t\t\t\t\t\t6 => 0,\n\t\t\t\t\t\t0 => 0,\n\t\t\t\t\t];\n\t\t\t\t\tif($block->getSide($faces[$block->meta])->equals($pos)){\n\t\t\t\t\t\t$ignoreBlock = $this->getSide($this->getOppositeSide($faces[$block->meta]));\n\t\t\t\t\t\t$block->turnOff(Level::blockHash($ignoreBlock->x, $ignoreBlock->y, $ignoreBlock->z));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function checkTorchOff(Block $pos, array $ignore = []){\n\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP];\n\t\tforeach($sides as $side){\n\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t/** @var RedstoneTorch $block */\n\t\t\t\t$block = $pos->getSide($side);\n\t\t\t\tif($block->getId() == self::UNLIT_REDSTONE_TORCH){\n\t\t\t\t\t$faces = [\n\t\t\t\t\t\t1 => 4,\n\t\t\t\t\t\t2 => 5,\n\t\t\t\t\t\t3 => 2,\n\t\t\t\t\t\t4 => 3,\n\t\t\t\t\t\t5 => 0,\n\t\t\t\t\t\t6 => 0,\n\t\t\t\t\t\t0 => 0,\n\t\t\t\t\t];\n\t\t\t\t\tif($block->getSide($faces[$block->meta])->equals($pos)){\n\t\t\t\t\t\t$ignoreBlock = $this->getSide($this->getOppositeSide($faces[$block->meta]));\n\t\t\t\t\t\t$block->turnOn(Level::blockHash($ignoreBlock->x, $ignoreBlock->y, $ignoreBlock->z));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getStrength(){\n\t\tif($this->isActivated()) return $this->maxStrength;\n\t\treturn 0;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/RedstoneTorch.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\math\\Vector3;\n\nclass RedstoneTorch extends RedstoneSource{\n\n\tprotected $id = self::REDSTONE_TORCH;\n\tprotected $ignore = \"\";\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 7;\n\t}\n\n\tpublic function getLastUpdateTime(){\n\t\treturn $this->getLevel()->getBlockTempData($this);\n\t}\n\n\tpublic function setLastUpdateTimeNow(){\n\t\t$this->getLevel()->setBlockTempData($this, $this->getLevel()->getServer()->getTick());\n\t}\n\n\tpublic function canCalcTurn(){\n\t\tif(!parent::canCalc()) return false;\n\t\tif($this->getLevel()->getServer()->getTick() != $this->getLastUpdateTime()) return true;\n\t\treturn ($this->canScheduleUpdate() ? Level::BLOCK_UPDATE_SCHEDULED : false);\n\t}\n\n\tpublic function canScheduleUpdate(){\n\t\treturn $this->getLevel()->getServer()->allowFrequencyPulse;\n\t}\n\n\tpublic function getFrequency(){\n\t\treturn $this->getLevel()->getServer()->pulseFrequency;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Redstone Torch\";\n\t}\n\n\tpublic function turnOn($ignore = \"\"){\n\t\t$result = $this->canCalcTurn();\n\t\t$this->setLastUpdateTimeNow();\n\t\tif($result === true){\n\t\t\t$faces = [\n\t\t\t\t1 => 4,\n\t\t\t\t2 => 5,\n\t\t\t\t3 => 2,\n\t\t\t\t4 => 3,\n\t\t\t\t5 => 0,\n\t\t\t\t6 => 0,\n\t\t\t\t0 => 0,\n\t\t\t];\n\t\t\t$this->id = self::REDSTONE_TORCH;\n\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t$this->activateTorch([$faces[$this->meta]], [$ignore]);\n\t\t\treturn true;\n\t\t}elseif($result === Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\t$this->ignore = $ignore;\n\t\t\t$this->getLevel()->scheduleUpdate($this, 20 * $this->getFrequency());\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function turnOff($ignore = \"\"){\n\t\t$result = $this->canCalcTurn();\n\t\t$this->setLastUpdateTimeNow();\n\t\tif($result === true){\n\t\t\t$faces = [\n\t\t\t\t1 => 4,\n\t\t\t\t2 => 5,\n\t\t\t\t3 => 2,\n\t\t\t\t4 => 3,\n\t\t\t\t5 => 0,\n\t\t\t\t6 => 0,\n\t\t\t\t0 => 0,\n\t\t\t];\n\t\t\t$this->id = self::UNLIT_REDSTONE_TORCH;\n\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t$this->deactivateTorch([$faces[$this->meta]], [$ignore]);\n\t\t\treturn true;\n\t\t}elseif($result === Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\t$this->ignore = $ignore;\n\t\t\t$this->getLevel()->scheduleUpdate($this, 20 * $this->getFrequency());\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function activateTorch(array $ignore = [], $notCheck = []){\n\t\tif($this->canCalc()){\n\t\t\t$this->activated = true;\n\t\t\t/** @var Door $block */\n\n\t\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP, Vector3::SIDE_DOWN];\n\n\t\t\tforeach($sides as $side){\n\t\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t\t$block = $this->getSide($side);\n\t\t\t\t\tif(!in_array($hash = Level::blockHash($block->x, $block->y, $block->z), $notCheck)){\n\t\t\t\t\t\t$this->activateBlock($block);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//$this->lastUpdateTime = $this->getLevel()->getServer()->getTick();\n\t\t}\n\t}\n\n\tpublic function activate(array $ignore = []){\n\t\t$this->activateTorch($ignore);\n\t}\n\n\tpublic function deactivate(array $ignore = []){\n\t\t$this->deactivateTorch($ignore);\n\t}\n\n\tpublic function deactivateTorch(array $ignore = [], array $notCheck = []){\n\t\tif($this->canCalc()){\n\t\t\t$this->activated = false;\n\t\t\t/** @var Door $block */\n\n\t\t\t$sides = [Vector3::SIDE_EAST, Vector3::SIDE_WEST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH];\n\n\t\t\tforeach($sides as $side){\n\t\t\t\tif(!in_array($side, $ignore)){\n\t\t\t\t\t$block = $this->getSide($side);\n\t\t\t\t\tif(!in_array($hash = Level::blockHash($block->x, $block->y, $block->z), $notCheck)){\n\t\t\t\t\t\t$this->deactivateBlock($block);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!in_array(Vector3::SIDE_DOWN, $ignore)){\n\t\t\t\t$block = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\t\tif(!in_array($hash = Level::blockHash($block->x, $block->y, $block->z), $notCheck)){\n\t\t\t\t\tif(!$this->checkPower($block)){\n\t\t\t\t\t\t/** @var $block ActiveRedstoneLamp */\n\t\t\t\t\t\tif($block->getId() == Block::ACTIVE_REDSTONE_LAMP) $block->turnOff();\n\t\t\t\t\t}\n\n\t\t\t\t\t$block = $this->getSide(Vector3::SIDE_DOWN, 2);\n\t\t\t\t\t$this->deactivateBlock($block);\n\t\t\t\t}\n\t\t\t}\n\t\t\t//$this->lastUpdateTime = $this->getLevel()->getServer()->getTick();\n\t\t}\n\t}\n\n\tpublic function onUpdate($type){\n\t\t$faces = [\n\t\t\t1 => 4,\n\t\t\t2 => 5,\n\t\t\t3 => 2,\n\t\t\t4 => 3,\n\t\t\t5 => 0,\n\t\t\t6 => 0,\n\t\t\t0 => 0,\n\t\t];\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$below = $this->getSide(0);\n\t\t\t$side = $this->getDamage();\n\n\t\t\tif($this->getSide($faces[$side])->isTransparent() === true and\n\t\t\t\t!($side === 0 and ($below->getId() === self::FENCE or\n\t\t\t\t\t\t$below->getId() === self::COBBLE_WALL\n\t\t\t\t\t))\n\t\t\t){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t\t$this->activate([$faces[$side]]);\n\t\t}\n\n\t\tif($type == Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\tif($this->id == self::UNLIT_REDSTONE_TORCH) $this->turnOn($this->ignore);\n\t\t\telse $this->turnOff($this->ignore);\n\t\t\treturn Level::BLOCK_UPDATE_SCHEDULED;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true, false);\n\t\t$faces = [\n\t\t\t1 => 4,\n\t\t\t2 => 5,\n\t\t\t3 => 2,\n\t\t\t4 => 3,\n\t\t\t5 => 0,\n\t\t\t6 => 0,\n\t\t\t0 => 0,\n\t\t];\n\t\t$this->deactivate([$faces[$this->meta]]);\n\t\t$this->getLevel()->setBlockTempData($this);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$below = $this->getSide(0);\n\n\t\tif($target->isTransparent() === false and $face !== 0){\n\t\t\t$faces = [\n\t\t\t\t1 => 5,\n\t\t\t\t2 => 4,\n\t\t\t\t3 => 3,\n\t\t\t\t4 => 2,\n\t\t\t\t5 => 1,\n\t\t\t];\n\t\t\t$this->meta = $faces[$face];\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}elseif(\n\t\t\t$below->isTransparent() === false or $below->getId() === self::FENCE or\n\t\t\t$below->getId() === self::COBBLE_WALL or\n\t\t\t$below->getId() == Block::INACTIVE_REDSTONE_LAMP or\n\t\t\t$below->getId() == Block::ACTIVE_REDSTONE_LAMP\n\t\t){\n\t\t\t$this->meta = 0;\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\treturn [\n\t\t\t[Item::LIT_REDSTONE_TORCH, 0, 1],\n\t\t];\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/RedstoneWire.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\nclass RedstoneWire extends RedstoneSource{\n\n\tconst ON = 1;\n\tconst OFF = 2;\n\tconst PLACE = 3;\n\tconst DESTROY = 4;\n\n\tprotected $id = self::REDSTONE_WIRE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Redstone Wire\";\n\t}\n\n\tpublic function getStrength(){\n\t\treturn $this->meta;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn ($this->meta > 0);\n\t}\n\n\tpublic function getHighestStrengthAround(){\n\t\t$strength = 0;\n\t\t$hasChecked = [\n\t\t\tVector3::SIDE_WEST => false,\n\t\t\tVector3::SIDE_EAST => false,\n\t\t\tVector3::SIDE_NORTH => false,\n\t\t\tVector3::SIDE_SOUTH => false\n\t\t];\n\t\t//check blocks around\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\t/** @var RedstoneSource $block */\n\t\t\t$block = $this->getSide($side);\n\t\t\tif($block instanceof RedstoneSource){\n\t\t\t\tif(($block->getStrength() > $strength) and $block->isActivated($this)) $strength = $block->getStrength();\n\t\t\t\t$hasChecked[$side] = true;\n\t\t\t}\n\t\t}\n\n\t\t//check blocks above\n\t\t$baseBlock = $this->add(0, 1, 0);\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\tif(!$bool){\n\t\t\t\t$block = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\tif($block->getStrength() > $strength) $strength = $block->getStrength();\n\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//check blocks below\n\t\t$baseBlock = $this->add(0, -1, 0);\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\tif(!$bool){\n\t\t\t\t$block = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\tif($block->getStrength() > $strength) $strength = $block->getStrength();\n\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tunset($block);\n\t\tunset($hasChecked);\n\n\t\treturn $strength;\n\t}\n\n\tpublic function getConnectedWires(){\n\t\t$hasChecked = [\n\t\t\tVector3::SIDE_WEST => false,\n\t\t\tVector3::SIDE_EAST => false,\n\t\t\tVector3::SIDE_NORTH => false,\n\t\t\tVector3::SIDE_SOUTH => false\n\t\t];\n\t\t//check blocks around\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\t$block = $this->getSide($side);\n\t\t\tif($block instanceof RedstoneSource and !$block instanceof PoweredRepeater){\n\t\t\t\t$hasChecked[$side] = true;\n\t\t\t}\n\t\t\tif($block instanceof PoweredRepeater){\n\t\t\t\tif($this->equals($block->getSide($block->getOppositeDirection()))){\n\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//check blocks above\n\t\t$baseBlock = $this->add(0, 1, 0);\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\tif(!$bool){\n\t\t\t\t$block = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//check blocks below\n\t\t$baseBlock = $this->add(0, -1, 0);\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\tif(!$bool){\n\t\t\t\t$block = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tunset($block);\n\n\t\treturn $hasChecked;\n\t}\n\n\tpublic function getUnconnectedSide(){\n\t\t$connected = [];\n\t\t$notConnected = [];\n\n\t\tforeach($this->getConnectedWires() as $key => $bool){\n\t\t\tif($bool){\n\t\t\t\t$connected[] = $key;\n\t\t\t}else $notConnected[] = $key;\n\t\t}\n\n\t\tif(count($connected) == 1){\n\t\t\treturn [$this->getOppositeSide($connected[0]), $connected];\n\t\t}elseif(count($connected) == 3){\n\t\t\treturn [$notConnected[0], $connected];\n\t\t}else return [false, $connected];\n\t}\n\n\tpublic function activate(array $ignore = []){\n\t\tif($this->canCalc()){\n\t\t\t$block = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\t/** @var ActiveRedstoneLamp $block */\n\t\t\tif($block->getId() == Block::INACTIVE_REDSTONE_LAMP or $block->getId() == Block::ACTIVE_REDSTONE_LAMP) $block->turnOn();\n\n\t\t\t$side = $this->getUnconnectedSide();\n\n\t\t\t$sides = [Vector3::SIDE_WEST, Vector3::SIDE_EAST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH];\n\t\t\tforeach($sides as $s){\n\t\t\t\tif(!in_array($s, $side[1])) {\n\t\t\t\t\t$block = $this->getSide(Vector3::SIDE_DOWN)->getSide($s);\n\t\t\t\t\t$this->activateBlock($block);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($side[0] == false) return;\n\t\t\t$block = $this->getSide($side[0]);\n\t\t\t$this->activateBlock($block);\n\n\t\t\tif(!$block->isTransparent()){\n\t\t\t\t$sides = [Vector3::SIDE_WEST, Vector3::SIDE_EAST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP, Vector3::SIDE_DOWN];\n\t\t\t\tforeach($sides as $s){\n\t\t\t\t\tif($s != $this->getOppositeSide($side[0])){\n\t\t\t\t\t\t$this->activateBlockWithoutWire($block->getSide($s));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->checkTorchOn($block, [$this->getOppositeSide($side)]);\n\n\t\t\tunset($connected, $notConnected);\n\t\t}\n\t}\n\n\tpublic function deactivate(array $ignore = []){\n\t\tif($this->canCalc()){\n\t\t\t$block = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\tif($block->getId() == Block::ACTIVE_REDSTONE_LAMP) {\n\t\t\t\t/** @var ActiveRedstoneLamp $block */\n\t\t\t\tif(!$this->checkPower($block, [Vector3::SIDE_UP], true)) $block->turnOff();\n\t\t\t}\n\n\t\t\t$side = $this->getUnconnectedSide();\n\n\t\t\t$sides = [Vector3::SIDE_WEST, Vector3::SIDE_EAST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH];\n\t\t\tforeach($sides as $s){\n\t\t\t\tif(!in_array($s, $side[1])) {\n\t\t\t\t\t$this->deactivateBlock($this->getSide(Vector3::SIDE_DOWN)->getSide($s));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($side[0] == false) return;\n\t\t\t$block = $this->getSide($side[0]);\n\t\t\t$this->deactivateBlockWithoutWire($block);\n\n\t\t\tif(!$block->isTransparent()){\n\t\t\t\t$sides = [Vector3::SIDE_WEST, Vector3::SIDE_EAST, Vector3::SIDE_SOUTH, Vector3::SIDE_NORTH, Vector3::SIDE_UP, Vector3::SIDE_DOWN];\n\t\t\t\tforeach($sides as $s){\n\t\t\t\t\tif($s != $this->getOppositeSide($side[0])){\n\t\t\t\t\t\t$this->deactivateBlockWithoutWire($block->getSide($s));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->checkTorchOff($block, [$this->getOppositeSide($side)]);\n\n\t\t\tunset($connected, $notConnected);\n\t\t}\n\t}\n\n\tpublic function getPowerSources(RedstoneWire $wire, array $powers = [], array $hasUpdated = [], $isStart = false){\n\t\tif(!$isStart){\n\t\t\t$wire->meta = 0;\n\t\t\t$wire->getLevel()->setBlock($wire, $wire, true, false);\n\t\t\t$wire->deactivate();\n\t\t}\n\t\t$hasChecked = [\n\t\t\tVector3::SIDE_WEST => false,\n\t\t\tVector3::SIDE_EAST => false,\n\t\t\tVector3::SIDE_NORTH => false,\n\t\t\tVector3::SIDE_SOUTH => false\n\t\t];\n\t\t$hash = Level::blockHash($wire->x, $wire->y, $wire->z);\n\t\tif(!isset($hasUpdated[$hash])) $hasUpdated[$hash] = true;\n\t\telse return [$powers, $hasUpdated];\n\n\t\t//check blocks around\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\t/** @var RedstoneWire $block */\n\t\t\t$block = $wire->getSide($side);\n\t\t\tif($block instanceof RedstoneSource){\n\t\t\t\tif($block->isActivated($wire)){\n\t\t\t\t\tif($block->getId() != $this->id){\n\t\t\t\t\t\t$powers[] = $block;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$result = $this->getPowerSources($block, $powers, $hasUpdated);\n\t\t\t\t\t\t$powers = $result[0];\n\t\t\t\t\t\t$hasUpdated = $result[1];\n\t\t\t\t\t}\n\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//check blocks above\n\t\t$baseBlock = $wire->add(0, 1, 0);\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\tif(!$bool){\n\t\t\t\t$block = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\tif($block instanceof RedstoneSource){\n\t\t\t\t\tif($block->isActivated($wire)){\n\t\t\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\t\t\t$result = $this->getPowerSources($block, $powers, $hasUpdated);\n\t\t\t\t\t\t\t$powers = $result[0];\n\t\t\t\t\t\t\t$hasUpdated = $result[1];\n\t\t\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//check blocks below\n\t\t$baseBlock = $wire->add(0, -1, 0);\n\t\tforeach($hasChecked as $side => $bool){\n\t\t\tif(!$bool){\n\t\t\t\t$block = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\tif($block instanceof RedstoneSource){\n\t\t\t\t\tif($block->isActivated($wire)){\n\t\t\t\t\t\tif($block->getId() == $this->id){\n\t\t\t\t\t\t\t$result = $this->getPowerSources($block, $powers, $hasUpdated);\n\t\t\t\t\t\t\t$powers = $result[0];\n\t\t\t\t\t\t\t$hasUpdated = $result[1];\n\t\t\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn [$powers, $hasUpdated];\n\t}\n\n\tpublic function calcSignal($strength = 15, $type = self::ON, array $hasUpdated = []){\n\t\t//This algorithm is provided by Stary and written by PeratX\n\t\t$hash = Level::blockHash($this->x, $this->y, $this->z);\n\t\tif(!in_array($hash, $hasUpdated)){\n\t\t\t$hasUpdated[] = $hash;\n\t\t\tif($type == self::DESTROY or $type == self::OFF){\n\t\t\t\t$this->meta = $strength;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t\tif($type == self::DESTROY) $this->getLevel()->setBlock($this, new Air(), true, false);\n\t\t\t\tif($strength <= 0) $this->deactivate();\n\t\t\t\t$powers = $this->getPowerSources($this, [], [], true);\n\t\t\t\t/** @var RedstoneSource $power */\n\t\t\t\tforeach($powers[0] as $power){\n\t\t\t\t\t$power->activate();\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif($strength <= 0) return $hasUpdated;\n\t\t\t\tif($type == self::PLACE) $strength = $this->getHighestStrengthAround() - 1;\n\t\t\t\tif($type == self::ON) $type = self::PLACE;\n\t\t\t\tif($this->getStrength() < $strength){\n\t\t\t\t\t$this->meta = $strength;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t\t\t$this->activate();\n\n\t\t\t\t\t$hasChecked = [\n\t\t\t\t\t\tVector3::SIDE_WEST => false,\n\t\t\t\t\t\tVector3::SIDE_EAST => false,\n\t\t\t\t\t\tVector3::SIDE_NORTH => false,\n\t\t\t\t\t\tVector3::SIDE_SOUTH => false\n\t\t\t\t\t];\n\n\t\t\t\t\tforeach($hasChecked as $side => $bool){\n\t\t\t\t\t\t$needUpdate = $this->getSide($side);\n\t\t\t\t\t\tif(!in_array(Level::blockHash($needUpdate->x, $needUpdate->y, $needUpdate->z), $hasUpdated)){\n\t\t\t\t\t\t\t$result = $this->updateNormalWire($needUpdate, $strength - 1, $type, $hasUpdated);\n\t\t\t\t\t\t\tif(count($result) != count($hasUpdated)){\n\t\t\t\t\t\t\t\t$hasUpdated = $result;\n\t\t\t\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$baseBlock = $this->add(0, 1, 0);\n\t\t\t\t\tforeach($hasChecked as $side => $bool){\n\t\t\t\t\t\tif(!$bool){\n\t\t\t\t\t\t\t$needUpdate = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\t\t\t\tif(!in_array(Level::blockHash($needUpdate->x, $needUpdate->y, $needUpdate->z), $hasUpdated)){\n\t\t\t\t\t\t\t\t$result = $this->updateNormalWire($needUpdate, $strength - 1, $type, $hasUpdated);\n\t\t\t\t\t\t\t\tif(count($result) != count($hasUpdated)){\n\t\t\t\t\t\t\t\t\t$hasUpdated = $result;\n\t\t\t\t\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t$baseBlock = $this->add(0, -1, 0);\n\t\t\t\t\tforeach($hasChecked as $side => $bool){\n\t\t\t\t\t\tif(!$bool){\n\t\t\t\t\t\t\t$needUpdate = $this->getLevel()->getBlock($baseBlock->getSide($side));\n\t\t\t\t\t\t\tif(!in_array(Level::blockHash($needUpdate->x, $needUpdate->y, $needUpdate->z), $hasUpdated)){\n\t\t\t\t\t\t\t\t$result = $this->updateNormalWire($needUpdate, $strength - 1, $type, $hasUpdated);\n\t\t\t\t\t\t\t\tif(count($result) != count($hasUpdated)){\n\t\t\t\t\t\t\t\t\t$hasUpdated = $result;\n\t\t\t\t\t\t\t\t\t$hasChecked[$side] = true;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\treturn $hasUpdated;\n\t}\n\n\tpublic function updateNormalWire(Block $block, $strength, $type, array $hasUpdated){\n\t\t/** @var RedstoneWire $block */\n\t\tif($block->getId() == Block::REDSTONE_WIRE){\n\t\t\tif($block->getStrength() < $strength){\n\t\t\t\treturn $block->calcSignal($strength, $type, $hasUpdated);\n\t\t\t}\n\t\t}\n\t\treturn $hasUpdated;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$down = $this->getSide(Vector3::SIDE_DOWN);\n\t\t\tif($down instanceof Transparent and $down->getId() != Block::INACTIVE_REDSTONE_LAMP and $down->getId() != Block::ACTIVE_REDSTONE_LAMP){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(Vector3::SIDE_DOWN);\n\t\tif($down instanceof Transparent and $down->getId() != Block::INACTIVE_REDSTONE_LAMP and $down->getId() != Block::ACTIVE_REDSTONE_LAMP) return;\n\t\telse{\n\t\t\t$this->getLevel()->setBlock($block, $this, true, false);\n\t\t\t$this->calcSignal(15, self::PLACE);\n\t\t}\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\tif($this->canCalc()) $this->calcSignal(0, self::DESTROY);\n\t\telse $this->getLevel()->setBlock($this, new Air());\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::REDSTONE, 0, 1]\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/RepeaterBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass RepeaterBlock extends Solid{\n\n\tprotected $id = self::REPEATER_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Repeater Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Sand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass Sand extends Fallable{\n\t\n\tconst NORMAL = 0;\n\tconst RED = 1;\n\t\n\tprotected $id = self::SAND;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tpublic function getName(){\n\t\tif($this->meta === 0x01){\n\t\t\treturn \"Red Sand\";\n\t\t}\n\n\t\treturn \"Sand\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Sandstone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass Sandstone extends Solid{\n\t\n\tconst NORMAL = 0;\n\tconst CHISELED = 1;\n\tconst SMOOTH = 2;\n\n\tprotected $id = self::SANDSTONE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.8;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Sandstone\",\n\t\t\t1 => \"Chiseled Sandstone\",\n\t\t\t2 => \"Smooth Sandstone\",\n\t\t\t3 => \"\",\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[$this->id, $this->meta & 0x03, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/SandstoneStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass SandstoneStairs extends Stair{\n\n\tprotected $id = self::SANDSTONE_STAIRS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.8;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Sandstone Stairs\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Sapling.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\generator\\normal\\object\\Tree;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\Random;\n\nclass Sapling extends Flowable{\n\tconst OAK = 0;\n\tconst SPRUCE = 1;\n\tconst BIRCH = 2;\n\tconst JUNGLE = 3;\n\tconst ACACIA = 4;\n\tconst DARK_OAK = 5;\n\n\tprotected $id = self::SAPLING;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Oak Sapling\",\n\t\t\t1 => \"Spruce Sapling\",\n\t\t\t2 => \"Birch Sapling\",\n\t\t\t3 => \"Jungle Sapling\",\n\t\t\t4 => \"Acacia Sapling\",\n\t\t\t5 => \"Dark Oak Sapling\",\n\t\t\t6 => \"\",\n\t\t\t7 => \"\",\n\t\t];\n\t\treturn $names[$this->meta & 0x07];\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::FARMLAND or $down->getId() === self::PODZOL){\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal\n\t\t\t//TODO: change log type\n\t\t\tTree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07);\n\t\t\tif(($player->gamemode & 0x01) === 0){\n\t\t\t\t$item->count--;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){ //Growth\n\t\t\tif(mt_rand(1, 7) === 1){\n\t\t\t\tif(($this->meta & 0x08) === 0x08){\n\t\t\t\t\tTree::growTree($this->getLevel(), $this->x, $this->y, $this->z, new Random(mt_rand()), $this->meta & 0x07);\n\t\t\t\t}else{\n\t\t\t\t\t$this->meta |= 0x08;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\n\t\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, $this->meta & 0x07, 1],\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/SeaLantern.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Pocketmine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\n\nclass SeaLantern extends Transparent implements SolidLight{\n\n\tprotected $id = self::SEA_LANTERN;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Sea Lantern\";\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 0.3;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\treturn [\n\t\t\t[Item::PRISMARINE_CRYSTALS, 0, 3],\n\t\t];\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/SignPost.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\math\\Vector3;\n\nclass SignPost extends Transparent{\n\n\tprotected $id = self::SIGN_POST;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 1;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Sign Post\";\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn null;\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($face !== 0){\n\t\t\t$faces = [\n\t\t\t\t2 => 2,\n\t\t\t\t3 => 3,\n\t\t\t\t4 => 4,\n\t\t\t\t5 => 5,\n\t\t\t];\n\t\t\tif(!isset($faces[$face])){\n\t\t\t\t$this->meta = floor((($player->yaw + 180) * 16 / 360) + 0.5) & 0x0F;\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::SIGN_POST, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$this->meta = $faces[$face];\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::WALL_SIGN, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(Vector3::SIDE_DOWN)->getId() === Block::AIR){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\t\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array{\n\t\treturn [\n\t\t\t[Item::SIGN, 0, 1],\n\t\t];\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/SkullBlock.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\n/*\n * THIS IS COPIED FROM THE PLUGIN FlowerPot MADE BY @beito123!!\n * https://github.com/beito123/PocketMine-MP-Plugins/blob/master/test%2FFlowerPot%2Fsrc%2Fbeito%2FFlowerPot%2Fomake%2FSkull.php\n *\n */\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\tile\\Skull;\n\nclass SkullBlock extends Transparent{\n\t\n\tconst SKELETON = 0;\n\tconst WITHER_SKELETON = 1;\n\tconst ZOMBIE_HEAD = 2;\n\tconst STEVE_HEAD = 3;\n\tconst CREEPER_HEAD = 4;\n\n\tprotected $id = self::SKULL_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1;\n\t}\n\t\n\tpublic function isHelmet(){\n\t\treturn true;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x - 0.75,\n\t\t\t$this->y - 0.5,\n\t\t\t$this->z - 0.75,\n\t\t\t$this->x + 0.75,\n\t\t\t$this->y + 0.5,\n\t\t\t$this->z + 0.75\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($face !== 0 && $fy > 0.5 && $target->getId() !== self::SKULL_BLOCK && !$down instanceof SkullBlock){\n\t\t\t$this->getLevel()->setBlock($block, Block::get(Block::SKULL_BLOCK, 0), true, true);\n\t\t\tif($face === 1){\n\t\t\t\t$rot = new ByteTag(\"Rot\", floor(($player->yaw * 16 / 360) + 0.5) & 0x0F);\n\t\t\t}else{\n\t\t\t\t$rot = new ByteTag(\"Rot\", 0);\n\t\t\t}\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::SKULL),\n\t\t\t\tnew IntTag(\"x\", $block->x),\n\t\t\t\tnew IntTag(\"y\", $block->y),\n\t\t\t\tnew IntTag(\"z\", $block->z),\n\t\t\t\tnew ByteTag(\"SkullType\", $item->getDamage()),\n\t\t\t\t$rot\n\t\t\t]);\n\t\t\t\n\t\t\tif($item->hasCustomBlockData()){\n\t\t\t    foreach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t    $nbt->{$key} = $v;\n\t\t\t    }\n\t\t\t}\n\n\t\t\t$chunk = $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4);\n\t\t\t$pot = Tile::createTile(Tile::SKULL, $chunk, $nbt);\n\t\t\t$this->getLevel()->setBlock($block, Block::get(Block::SKULL_BLOCK, $face), true, true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 5;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Skeleton Skull\",\n\t\t\t1 => \"Wither Skeleton Skull\",\n\t\t\t2 => \"Zombie Head\",\n\t\t\t3 => \"Head\",\n\t\t\t4 => \"Creeper Head\"\n\t\t];\n\t\treturn $names[$this->meta & 0x04];\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true, true);\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t/** @var Skull $tile */\n\t\tif($this->getLevel()!=null && (($tile = $this->getLevel()->getTile($this)) instanceof Skull)){\n\t\t\treturn [[Item::SKULL, $tile->getSkullType(), 1]];\n\t\t}else\n\t\t\treturn [[Item::SKULL, 0, 1]];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Slab.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\n\nclass Slab extends Transparent{\n\t\n\tconst STONE = 0;\n\tconst SANDSTONE = 1;\n\tconst WOODEN = 2;\n\tconst COBBLESTONE = 3;\n\tconst BRICK = 4;\n\tconst STONE_BRICK = 5;\n\tconst QUARTZ = 6;\n\tconst NETHER_BRICK = 7;\n\n\tprotected $id = self::SLAB;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::STONE => \"Stone\",\n\t\t\tself::SANDSTONE => \"Sandstone\",\n\t\t\tself::WOODEN => \"Wooden\",\n\t\t\tself::COBBLESTONE => \"Cobblestone\",\n\t\t\tself::BRICK => \"Brick\",\n\t\t\tself::STONE_BRICK => \"Stone Brick\",\n\t\t\tself::QUARTZ => \"Quartz\",\n\t\t\tself::NETHER_BRICK => \"Nether Brick\",\n\t\t];\n\t\treturn (($this->meta & 0x08) > 0 ? \"Upper \" : \"\") . $names[$this->meta & 0x07] . \" Slab\";\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\t$type = $this->meta & 0x07;\n\t\tif($type == self::WOODEN){\n\t\t\treturn 5;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\t$type = $this->meta & 0x07;\n\t\tif($type == self::WOODEN){\n\t\t\treturn 5;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\tif(($this->meta & 0x08) > 0){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y + 0.5,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}else{\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 0.5,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$this->meta &= 0x07;\n\t\tif($face === 0){\n\t\t\tif($target->getId() === self::SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$this->meta |= 0x08;\n\t\t\t}\n\t\t}elseif($face === 1){\n\t\t\tif($target->getId() === self::SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t//TODO: check for collision\n\t\t}else{\n\t\t\tif($block->getId() === self::SLAB){\n\t\t\t\tif(($block->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB, $this->meta), true);\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\tif($fy > 0.5){\n\t\t\t\t\t$this->meta |= 0x08;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($block->getId() === self::SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){\n\t\t\treturn false;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[$this->id, $this->meta & 0x07, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Slab2.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass Slab2 extends Slab{\n\n\tconst RED_SANDSTONE = 0;\n\tconst PURPUR_BLOCK = 1;\n\n\tprotected $id = Block::SLAB2;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t\tself::RED_SANDSTONE => \"Red Sandstone\",\n\t\t\t\tself::PURPUR_BLOCK => \"Purpur Block\",\n\t\t];\n\t\treturn (($this->meta & 0x08) > 0 ? \"Upper \" : \"\") . $names[$this->meta & 0x07] . \" Slab\";\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($face === 0){\n\t\t\tif($target->getId() === self::SLAB2 and ($target->getDamage() & 0x08) === 0x08){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB2, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::SLAB2){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB2, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$this->meta |= 0x08;\n\t\t\t}\n\t\t}elseif($face === 1){\n\t\t\tif($target->getId() === self::SLAB2 and ($target->getDamage() & 0x08) === 0){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_SLAB2, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::SLAB2){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB2, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t//TODO: check for collision\n\t\t}else{\n\t\t\tif($block->getId() === self::SLAB2){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_SLAB2, $this->meta), true);\n\t\t\t}else{\n\t\t\t\tif($fy > 0.5){\n\t\t\t\t\t$this->meta |= 0x08;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\tif($block->getId() === self::SLAB2 and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){\n\t\t\treturn false;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/SlimeBlock.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass SlimeBlock extends Solid{\n\n\tprotected $id = self::SLIME_BLOCK;\n\n\tpublic function __construct($meta = 15){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Slime Block\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Snow.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Snow extends Solid{\n\n\tprotected $id = self::SNOW_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.2;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Snow Block\";\n\t}\n\t\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isShovel() !== false){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::SNOW_BLOCK, 0, 1],\n\t\t\t\t];\n\t\t\t}else{\n\t\t\t\treturn [\n\t\t\t\t\t[Item::SNOWBALL, 0, 4],\n\t\t\t\t];\n\t\t\t}\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/SnowLayer.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass SnowLayer extends Flowable{\n\n\tprotected $id = self::SNOW_LAYER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Snow Layer\";\n\t}\n\n\tpublic function canBeReplaced(){\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.1;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->isSolid()){\n\t\t\t$this->getLevel()->setBlock($block, $this, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->getId() === self::AIR){ //Replace with common break method\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isShovel() !== false){\n\t\t\treturn [\n\t\t\t\t[Item::SNOWBALL, 0, 1],\n\t\t\t];\n\t\t}\n\n\t\treturn [];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Solid.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nabstract class Solid extends Block{\n\n\tpublic function isSolid(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/SolidLight.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\ninterface SolidLight{\n    \n}"
  },
  {
    "path": "src/pocketmine/block/SoulSand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\n\nclass SoulSand extends Solid{\n\n\tprotected $id = self::SOUL_SAND;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Soul Sand\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHOVEL;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + 1 - 0.125,\n\t\t\t$this->z + 1\n\t\t);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Sponge.php",
    "content": "<?php\n\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author H4PM Team\n * @link http://www.github.net/H4PM  \n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\item\\Item;\n\nclass Sponge extends Solid{\n\n\tprotected $id = self::SPONGE;\n\tprotected $absorbRange = 6;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.6;\n\t}\n\n\tpublic function absorbWater($block = null){\n\t\tif ($block == null) $block = $this;\n\t\t$range = $this->absorbRange / 2;\n\t\tfor ($xx = -$range; $xx <= $range; $xx++){\n\t\t\tfor ($yy = -$range; $yy <= $range; $yy++){\n\t\t\t\tfor ($zz = -$range; $zz <= $range; $zz++){\n\t\t\t\t\t$block = $this->getLevel()->getBlock(new Vector3($this->x + $xx, $this->y + $yy, $this->z + $zz));\n\t\t\t\t\tif ($block->getId() === Block::WATER) $this->getLevel()->setBlock($block, Block::get(Block::AIR), true, true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif ($this->meta == 0) {\n\t\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t\t$blockAbove = $this->getSide(Vector3::SIDE_UP)->getId();\n\t\t\t\t$blockBeneath = $this->getSide(Vector3::SIDE_DOWN)->getId();\n\t\t\t\t$blockNorth = $this->getSide(Vector3::SIDE_NORTH)->getId();\n\t\t\t\t$blockSouth = $this->getSide(Vector3::SIDE_SOUTH)->getId();\n\t\t\t\t$blockEast = $this->getSide(Vector3::SIDE_EAST)->getId();\n\t\t\t\t$blockWest = $this->getSide(Vector3::SIDE_WEST)->getId();\n\n\t\t\t\tif($blockAbove === Block::WATER ||\n\t\t\t\t\t$blockBeneath === Block::WATER ||\n\t\t\t\t\t$blockNorth === Block::WATER ||\n\t\t\t\t\t$blockSouth === Block::WATER ||\n\t\t\t\t\t$blockEast === Block::WATER ||\n\t\t\t\t\t$blockWest === Block::WATER){\n\t\t\t\t\t$this->absorbWater($this);\n\t\t\t\t\t$this->getLevel()->setBlock($this, Block::get(Block::SPONGE, 1), true, true);\n\t\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n        return false;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Sponge\",\n\t\t\t1 => \"Wet Sponge\",\n\t\t];\n\t\treturn $names[$this->meta & 0x0f];\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, $this->meta & 0x0f, 1],\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/SpruceDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass SpruceDoor extends Door{\n\n\tprotected $id = self::SPRUCE_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Spruce Door Block\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::SPRUCE_DOOR, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/SpruceDoorBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass SpruceDoorBlock extends Solid{\n\n\tprotected $id = self::SPRUCE_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n        return \"Spruce Door Block\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/SpruceWoodStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nclass SpruceWoodStairs extends WoodStairs{\n\n\tprotected $id = self::SPRUCE_WOOD_STAIRS;\n\n\tpublic function getName(){\n\t\treturn \"Spruce Wood Stairs\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/StainedClay.php",
    "content": "<?php\n\n\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass StainedClay extends Solid{\n\n\tprotected $id = self::STAINED_CLAY;\n\t\n\tconst CLAY_WHITE = 0;\n\tconst CLAY_ORANGE = 1;\n\tconst CLAY_MAGENTA = 2;\n\tconst CLAY_LIGHT_BLUE = 3;\n\tconst CLAY_YELLOW = 4;\n\tconst CLAY_LIME = 5;\n\tconst CLAY_PINK = 6;\n\tconst CLAY_GRAY = 7;\n\tconst CLAY_LIGHT_GRAY = 8;\n\tconst CLAY_CYAN = 9;\n\tconst CLAY_PURPLE = 10;\n\tconst CLAY_BLUE = 11;\n\tconst CLAY_BROWN = 12;\n\tconst CLAY_GREEN = 13;\n\tconst CLAY_RED = 14;\n\tconst CLAY_BLACK = 15;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1.25;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName() : string{\n\t\tstatic $names = [\n\t\t\t0 => \"White Stained Clay\",\n\t\t\t1 => \"Orange Stained Clay\",\n\t\t\t2 => \"Magenta Stained Clay\",\n\t\t\t3 => \"Light Blue Stained Clay\",\n\t\t\t4 => \"Yellow Stained Clay\",\n\t\t\t5 => \"Lime Stained Clay\",\n\t\t\t6 => \"Pink Stained Clay\",\n\t\t\t7 => \"Gray Stained Clay\",\n\t\t\t8 => \"Light Gray Stained Clay\",\n\t\t\t9 => \"Cyan Stained Clay\",\n\t\t\t10 => \"Purple Stained Clay\",\n\t\t\t11 => \"Blue Stained Clay\",\n\t\t\t12 => \"Brown Stained Clay\",\n\t\t\t13 => \"Green Stained Clay\",\n\t\t\t14 => \"Red Stained Clay\",\n\t\t\t15 => \"Black Stained Clay\",\n\t\t];\n\t\treturn $names[$this->meta & 0x0f];\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Stair.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\n\nabstract class Stair extends Transparent{\n\n\t/*\n\tpublic function collidesWithBB(AxisAlignedBB $bb, &$list = []){\n\t\t$damage = $this->getDamage();\n\t\t$j = $damage & 0x03;\n\n\t\t$f = 0;\n\t\t$f1 = 0.5;\n\t\t$f2 = 0.5;\n\t\t$f3 = 1;\n\n\t\tif(($damage & 0x04) > 0){\n\t\t\t$f = 0.5;\n\t\t\t$f1 = 1;\n\t\t\t$f2 = 0;\n\t\t\t$f3 = 0.5;\n\t\t}\n\n\t\tif($bb->intersectsWith($bb2 = AxisAlignedBB::getBoundingBoxFromPool(\n\t\t\t$this->x,\n\t\t\t$this->y + $f,\n\t\t\t$this->z,\n\t\t\t$this->x + 1,\n\t\t\t$this->y + $f1,\n\t\t\t$this->z + 1\n\t\t))){\n\t\t\t$list[] = $bb2;\n\t\t}\n\n\t\tif($j === 0){\n\t\t\tif($bb->intersectsWith($bb2 = AxisAlignedBB::getBoundingBoxFromPool(\n\t\t\t\t$this->x + 0.5,\n\t\t\t\t$this->y + $f2,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + $f3,\n\t\t\t\t$this->z + 1\n\t\t\t))){\n\t\t\t\t$list[] = $bb2;\n\t\t\t}\n\t\t}elseif($j === 1){\n\t\t\tif($bb->intersectsWith($bb2 = AxisAlignedBB::getBoundingBoxFromPool(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y + $f2,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 0.5,\n\t\t\t\t$this->y + $f3,\n\t\t\t\t$this->z + 1\n\t\t\t))){\n\t\t\t\t$list[] = $bb2;\n\t\t\t}\n\t\t}elseif($j === 2){\n\t\t\tif($bb->intersectsWith($bb2 = AxisAlignedBB::getBoundingBoxFromPool(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y + $f2,\n\t\t\t\t$this->z + 0.5,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + $f3,\n\t\t\t\t$this->z + 1\n\t\t\t))){\n\t\t\t\t$list[] = $bb2;\n\t\t\t}\n\t\t}elseif($j === 3){\n\t\t\tif($bb->intersectsWith($bb2 = AxisAlignedBB::getBoundingBoxFromPool(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y + $f2,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + $f3,\n\t\t\t\t$this->z + 0.5\n\t\t\t))){\n\t\t\t\t$list[] = $bb2;\n\t\t\t}\n\t\t}\n\t}\n\t*/\n\n\tprotected function recalculateBoundingBox() {\n\n\t\tif(($this->getDamage() & 0x04) > 0){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y + 0.5,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}else{\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 0.5,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 0,\n\t\t\t1 => 2,\n\t\t\t2 => 1,\n\t\t\t3 => 3,\n\t\t];\n\t\t$this->meta = $faces[$player->getDirection()] & 0x03;\n\t\tif(($fy > 0.5 and $face !== 1) or $face === 0){\n\t\t\t$this->meta |= 0x04; //Upside-down stairs\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 15;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\treturn [\n\t\t\t\t[$this->getId(), 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/StickyPiston.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass StickyPiston extends Solid{\n\n\tprotected $id = self::STICKY_PISTON;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Sticky Piston\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/StillLava.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\level\\Level;\n\nclass StillLava extends Lava{\n\n\tprotected $id = self::STILL_LAVA;\n\n\tpublic function onUpdate($type){\n\t\tif($type == Level::BLOCK_UPDATE_NORMAL){\n\t\t\tparent::onUpdate($type);\n\t\t}\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Still Lava\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/StillWater.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\level\\Level;\n\nclass StillWater extends Water{\n\n\tprotected $id = self::STILL_WATER;\n\n\tpublic function onUpdate($type){\n\t\tif($type == Level::BLOCK_UPDATE_NORMAL){\n\t\t\tparent::onUpdate($type);\n\t\t}\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Still Water\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Stone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Stone extends Solid{\n\tconst NORMAL = 0;\n\tconst GRANITE = 1;\n\tconst POLISHED_GRANITE = 2;\n\tconst DIORITE = 3;\n\tconst POLISHED_DIORITE = 4;\n\tconst ANDESITE = 5;\n\tconst POLISHED_ANDESITE = 6;\n\n\tprotected $id = self::STONE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::NORMAL => \"Stone\",\n\t\t\tself::GRANITE => \"Granite\",\n\t\t\tself::POLISHED_GRANITE => \"Polished Granite\",\n\t\t\tself::DIORITE => \"Diorite\",\n\t\t\tself::POLISHED_DIORITE => \"Polished Diorite\",\n\t\t\tself::ANDESITE => \"Andesite\",\n\t\t\tself::POLISHED_ANDESITE => \"Polished Andesite\",\n\t\t\t7 => \"Unknown Stone\",\n\t\t];\n\t\treturn $names[$this->meta & 0x07];\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= Tool::TIER_WOODEN){\n\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) > 0 and $this->getDamage() === 0){\n\t\t\t\treturn [\n\t\t\t\t\t[Item::STONE, 0, 1],\n\t\t\t\t];\n\t\t\t}\n\t\t\treturn [\n\t\t\t\t[$this->getDamage() === 0 ? Item::COBBLESTONE : Item::STONE, $this->getDamage(), 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/StoneBrickStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass StoneBrickStairs extends Stair{\n\n\tprotected $id = self::STONE_BRICK_STAIRS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1.5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Stone Brick Stairs\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/StoneBricks.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass StoneBricks extends Solid{\n\t\n\tconst NORMAL = 0;\n\tconst MOSSY = 1;\n\tconst CRACKED = 2;\n\tconst CHISELED = 3;\n\n\tprotected $id = self::STONE_BRICKS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 1.5;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Stone Bricks\",\n\t\t\t1 => \"Mossy Stone Bricks\",\n\t\t\t2 => \"Cracked Stone Bricks\",\n\t\t\t3 => \"Chiseled Stone Bricks\",\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n\t\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::STONE_BRICKS, $this->meta & 0x03, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/StoneButton.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\nuse pocketmine\\level\\sound\\ButtonClickSound;\n\nclass StoneButton extends WoodenButton{\n\tprotected $id = self::STONE_BUTTON;\n\n\tpublic function getName(){\n\t\treturn \"Stone Button\";\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif(!$this->isActivated()){\n\t\t\t$this->meta ^= 0x08;\n\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t$this->getLevel()->addSound(new ButtonClickSound($this));\n\t\t\t$this->activate();\n\t\t\t$this->getLevel()->scheduleUpdate($this, 40);\n\t\t}\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/StonePressurePlate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nclass StonePressurePlate extends PressurePlate{\n\tprotected $id = self::STONE_PRESSURE_PLATE;\n\n\tpublic function getName(){\n\t\treturn \"Stone Pressure Plate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/StoneWall.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector3;\n\nclass StoneWall extends Transparent{\n\t\n\tconst NONE_MOSSY_WALL = 0;\n\tconst MOSSY_WALL = 1;\n\n\tprotected $id = self::STONE_WALL;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getName(){\n\t\tif($this->meta === 0x01){\n\t\t\treturn \"Mossy Cobblestone Wall\";\n\t\t}\n\n\t\treturn \"Cobblestone Wall\";\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$north = $this->canConnect($this->getSide(Vector3::SIDE_NORTH));\n\t\t$south = $this->canConnect($this->getSide(Vector3::SIDE_SOUTH));\n\t\t$west = $this->canConnect($this->getSide(Vector3::SIDE_WEST));\n\t\t$east = $this->canConnect($this->getSide(Vector3::SIDE_EAST));\n\n\t\t$n = $north ? 0 : 0.25;\n\t\t$s = $south ? 1 : 0.75;\n\t\t$w = $west ? 0 : 0.25;\n\t\t$e = $east ? 1 : 0.75;\n\n\t\tif($north and $south and !$west and !$east){\n\t\t\t$w = 0.3125;\n\t\t\t$e = 0.6875;\n\t\t}elseif(!$north and !$south and $west and $east){\n\t\t\t$n = 0.3125;\n\t\t\t$s = 0.6875;\n\t\t}\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + $w,\n\t\t\t$this->y,\n\t\t\t$this->z + $n,\n\t\t\t$this->x + $e,\n\t\t\t$this->y + 1.5,\n\t\t\t$this->z + $s\n\t\t);\n\t}\n\n\tpublic function canConnect(Block $block){\n\t\treturn ($block->getId() !== self::COBBLE_WALL and $block->getId() !== self::FENCE_GATE) ? $block->isSolid() and !$block->isTransparent() : true;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Stonecutter.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\Player;\n\n//TODO: check orientation\nclass Stonecutter extends Solid{\n\n\tprotected $id = self::STONECUTTER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Stonecutter\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_PICKAXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isPickaxe() >= 1){\n\t\t\treturn [\n\t\t\t\t[Item::STONECUTTER, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Sugarcane.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\event\\block\\BlockGrowEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3 as Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass Sugarcane extends Flowable{\n\n\tprotected $id = self::SUGARCANE_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Sugarcane\";\n\t}\n\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::SUGARCANE, 0, 1],\n\t\t];\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($item->getId() === Item::DYE and $item->getDamage() === 0x0F){ //Bonemeal\n\t\t\tif($this->getSide(0)->getId() !== self::SUGARCANE_BLOCK){\n\t\t\t\tfor($y = 1; $y < 3; ++$y){\n\t\t\t\t\t$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));\n\t\t\t\t\tif($b->getId() === self::AIR){\n\t\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new BlockGrowEvent($b, new Sugarcane()));\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($b, $ev->getNewState(), true);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$this->meta = 0;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t}\n\t\t\tif(($player->gamemode & 0x01) === 0){\n\t\t\t\t$item->count--;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$down = $this->getSide(0);\n\t\t\tif($down->isTransparent() === true and $down->getId() !== self::SUGARCANE_BLOCK){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}elseif($type === Level::BLOCK_UPDATE_RANDOM){\n\t\t\tif($this->getSide(0)->getId() !== self::SUGARCANE_BLOCK){\n\t\t\t\tif($this->meta === 0x0F){\n\t\t\t\t\tfor($y = 1; $y < 3; ++$y){\n\t\t\t\t\t\t$b = $this->getLevel()->getBlock(new Vector3($this->x, $this->y + $y, $this->z));\n\t\t\t\t\t\tif($b->getId() === self::AIR){\n\t\t\t\t\t\t\t$this->getLevel()->setBlock($b, new Sugarcane(), true);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$this->meta = 0;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t}else{\n\t\t\t\t\t++$this->meta;\n\t\t\t\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t\t\t}\n\n\t\t\t\treturn Level::BLOCK_UPDATE_RANDOM;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === self::SUGARCANE_BLOCK){\n\t\t\t$this->getLevel()->setBlock($block, new Sugarcane(), true);\n\n\t\t\treturn true;\n\t\t}elseif($down->getId() === self::GRASS or $down->getId() === self::DIRT or $down->getId() === self::SAND){\n\t\t\t$block0 = $down->getSide(2);\n\t\t\t$block1 = $down->getSide(3);\n\t\t\t$block2 = $down->getSide(4);\n\t\t\t$block3 = $down->getSide(5);\n\t\t\tif(($block0 instanceof Water) or ($block1 instanceof Water) or ($block2 instanceof Water) or ($block3 instanceof Water)){\n\t\t\t\t$this->getLevel()->setBlock($block, new Sugarcane(), true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/TNT.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\sound\\TNTPrimeSound;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\Random;\n\nclass TNT extends Solid implements ElectricalAppliance{\n\n\tprotected $id = self::TNT;\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function getName(){\n\t\treturn \"TNT\";\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 0;\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 15;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 100;\n\t}\n\n\tpublic function prime(Player $player = null){\n\t\t$this->meta = 1;\n\t\tif($player != null and $player->isCreative()){\n\t\t\t$dropItem = false;\n\t\t}else{\n\t\t\t$dropItem = true;\n\t\t}\n\t\t$mot = (new Random())->nextSignedFloat() * M_PI * 2;\n\t\t$tnt = Entity::createEntity(\"PrimedTNT\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), new CompoundTag(\"\", [\n\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\tnew DoubleTag(\"\", $this->x + 0.5),\n\t\t\t\tnew DoubleTag(\"\", $this->y),\n\t\t\t\tnew DoubleTag(\"\", $this->z + 0.5)\n\t\t\t]),\n\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\tnew DoubleTag(\"\", -sin($mot) * 0.02),\n\t\t\t\tnew DoubleTag(\"\", 0.2),\n\t\t\t\tnew DoubleTag(\"\", -cos($mot) * 0.02)\n\t\t\t]),\n\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t]),\n\t\t\t\"Fuse\" => new ByteTag(\"Fuse\", 80)\n\t\t]), $dropItem);\n\n\t\t$tnt->spawnToAll();\n\t\t$this->level->addSound(new TNTPrimeSound($this));\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type == Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\t$sides = [0, 1, 2, 3, 4, 5];\n\t\t\tforeach($sides as $side){\n\t\t\t\t$block = $this->getSide($side);\n\t\t\t\tif($block instanceof RedstoneSource and $block->isActivated($this)){\n\t\t\t\t\t$this->prime();\n\t\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn Level::BLOCK_UPDATE_SCHEDULED;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\n\t\t$this->getLevel()->scheduleUpdate($this, 40);\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($item->getId() === Item::FLINT_STEEL){\n\t\t\t$this->prime($player);\n\t\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t\t\t$item->useOn($this);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/TallGrass.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass TallGrass extends Flowable{\n\t\n\tconst NORMAL = 1;\n\tconst FERN = 2;\n\n\tprotected $id = self::TALL_GRASS;\n\n\tpublic function __construct($meta = 1){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeReplaced(){\n\t\treturn true;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Dead Shrub\",\n\t\t\t1 => \"Tall Grass\",\n\t\t\t2 => \"Fern\",\n\t\t\t3 => \"\"\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 60;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 100;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$down = $this->getSide(0);\n\t\tif($down->getId() === self::GRASS){\n\t\t\t$this->getLevel()->setBlock($block, $this, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif($this->getSide(0)->isTransparent() === true){ //Replace with common break method\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), false, false);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getToolType()\n\t{\n\t\treturn Tool::TYPE_SHEARS;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif(mt_rand(0, 15) === 0){\n\t\t\treturn [\n\t\t\t\t[Item::WHEAT_SEEDS, 0, 1]\n\t\t\t];\n\t\t}\n\n\t\treturn [];\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/Thin.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\math\\AxisAlignedBB;\n\nabstract class Thin extends Transparent{\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$f = 0.4375;\n\t\t$f1 = 0.5625;\n\t\t$f2 = 0.4375;\n\t\t$f3 = 0.5625;\n\n\t\t$flag = $this->canConnect($this->getSide(2));\n\t\t$flag1 = $this->canConnect($this->getSide(3));\n\t\t$flag2 = $this->canConnect($this->getSide(4));\n\t\t$flag3 = $this->canConnect($this->getSide(5));\n\n\t\tif((!$flag2 or !$flag3) and ($flag2 or $flag3 or $flag or $flag1)){\n\t\t\tif($flag2 and !$flag3){\n\t\t\t\t$f = 0;\n\t\t\t}elseif(!$flag2 and $flag3){\n\t\t\t\t$f1 = 1;\n\t\t\t}\n\t\t}else{\n\t\t\t$f = 0;\n\t\t\t$f1 = 1;\n\t\t}\n\n\t\tif((!$flag or !$flag1) and ($flag2 or $flag3 or $flag or $flag1)){\n\t\t\tif($flag and !$flag1){\n\t\t\t\t$f2 = 0;\n\t\t\t}elseif(!$flag and $flag1){\n\t\t\t\t$f3 = 1;\n\t\t\t}\n\t\t}else{\n\t\t\t$f2 = 0;\n\t\t\t$f3 = 1;\n\t\t}\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + $f,\n\t\t\t$this->y,\n\t\t\t$this->z + $f2,\n\t\t\t$this->x + $f1,\n\t\t\t$this->y + 1,\n\t\t\t$this->z + $f3\n\t\t);\n\t}\n\n\n\tpublic function canConnect(Block $block){\n\t\treturn $block->isSolid() or $block->getId() === $this->getId() or $block->getId() === self::GLASS_PANE or $block->getId() === self::GLASS;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Torch.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass Torch extends Flowable{\n\n\tprotected $id = self::TORCH;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getLightLevel(){\n\t\treturn 15;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Torch\";\n\t}\n\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$below = $this->getSide(0);\n\t\t\t$side = $this->getDamage();\n\t\t\t$faces = [\n\t\t\t\t1 => 4,\n\t\t\t\t2 => 5,\n\t\t\t\t3 => 2,\n\t\t\t\t4 => 3,\n\t\t\t\t5 => 0,\n\t\t\t\t6 => 0,\n\t\t\t\t0 => 0,\n\t\t\t];\n\n\t\t\tif($this->getSide($faces[$side])->isTransparent() === true and\n\t\t\t\t\t!($side === 0 and ($below->getId() === self::FENCE or\n\t\t\t\t\t\t\t\t\t$below->getId() === self::COBBLE_WALL or\n\t\t\t\t\t\t\t\t\t$below->getId() == Block::INACTIVE_REDSTONE_LAMP or\n\t\t\t\t\t\t\t\t\t$below->getId() == Block::ACTIVE_REDSTONE_LAMP)\n\t\t\t\t\t)\n\t\t\t){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$below = $this->getSide(0);\n\n\t\tif($target->isTransparent() === false and $face !== 0){\n\t\t\t$faces = [\n\t\t\t\t1 => 5,\n\t\t\t\t2 => 4,\n\t\t\t\t3 => 3,\n\t\t\t\t4 => 2,\n\t\t\t\t5 => 1,\n\t\t\t];\n\t\t\t$this->meta = $faces[$face];\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}elseif(\n\t\t\t\t$below->isTransparent() === false or $below->getId() === self::FENCE or\n\t\t\t\t$below->getId() === self::COBBLE_WALL or\n\t\t\t\t$below->getId() == Block::INACTIVE_REDSTONE_LAMP or\n\t\t\t\t$below->getId() == Block::ACTIVE_REDSTONE_LAMP\n\t\t){\n\t\t\t$this->meta = 0;\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Transparent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nabstract class Transparent extends Block{\n\n\tpublic function isTransparent(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Trapdoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\nuse pocketmine\\level\\sound\\DoorSound;\n\nclass Trapdoor extends Transparent{\n\n\tprotected $id = self::TRAPDOOR;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Wooden Trapdoor\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 15;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$damage = $this->getDamage();\n\n\t\t$f = 0.1875;\n\n\t\tif(($damage & 0x08) > 0){\n\t\t\t$bb = new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y + 1 - $f,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}else{\n\t\t\t$bb = new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + $f,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}\n\n\t\tif(($damage & 0x04) > 0){\n\t\t\tif(($damage & 0x03) === 0){\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z + 1 - $f,\n\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + 1\n\t\t\t\t);\n\t\t\t}elseif(($damage & 0x03) === 1){\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z,\n\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + $f\n\t\t\t\t);\n\t\t\t}\n\t\t\tif(($damage & 0x03) === 2){\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x + 1 - $f,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z,\n\t\t\t\t\t$this->x + 1,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + 1\n\t\t\t\t);\n\t\t\t}\n\t\t\tif(($damage & 0x03) === 3){\n\t\t\t\t$bb->setBounds(\n\t\t\t\t\t$this->x,\n\t\t\t\t\t$this->y,\n\t\t\t\t\t$this->z,\n\t\t\t\t\t$this->x + $f,\n\t\t\t\t\t$this->y + 1,\n\t\t\t\t\t$this->z + 1\n\t\t\t\t);\n\t\t\t}\n\t\t}\n\n\t\treturn $bb;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif(($target->isTransparent() === false or $target->getId() === self::SLAB) and $face !== 0 and $face !== 1){\n\t\t\tswitch($face){\n\t\t\t\tcase 2:\n\t\t\t\t\t$this->meta |= 0b00000011;\n\t\t\t\tbreak;\n\t\t\t\tcase 3:\n\t\t\t\t\t$this->meta |= 0b00000010;\n\t\t\t\tbreak;\n\t\t\t\tcase 4:\n\t\t\t\t\t$this->meta |= 0b00000001;\n\t\t\t\tbreak;\n\t\t\t\tcase 5:\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif($fy > 0.5){\n\t\t\t\t$this->meta |= 0b00000100;\n\t\t\t}\n\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n\n\tpublic function isOpened(){\n\t\treturn (($this->meta & 0b00001000) === 0);\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = \\null){\n\t\t$this->meta ^= 0b00001000;\n\t\t$this->getLevel()->setBlock($this, $this, true);\n\t\t$this->level->addSound(new DoorSound($this));\n\t\treturn true;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/TrappedChest.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Chest as TileChest;\nuse pocketmine\\tile\\Tile;\n\nclass TrappedChest extends RedstoneSource{\n\tprotected $id = self::TRAPPED_CHEST;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getBoundingBox(){\n\t\tif($this->boundingBox === null){\n\t\t\t$this->boundingBox = $this->recalculateBoundingBox();\n\t\t}\n\t\treturn $this->boundingBox;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn true;\n\t}\n\n\tpublic function canBeFlowedInto(){\n\t\treturn false;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2.5;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn $this->getHardness() * 5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Trapped Chest\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x + 0.0625,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z + 0.0625,\n\t\t\t\t$this->x + 0.9375,\n\t\t\t\t$this->y + 0.9475,\n\t\t\t\t$this->z + 0.9375\n\t\t);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t\t0 => 4,\n\t\t\t\t1 => 2,\n\t\t\t\t2 => 5,\n\t\t\t\t3 => 3,\n\t\t];\n\n\t\t$chest = null;\n\t\t$this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0];\n\n\t\tfor($side = 2; $side <= 5; ++$side){\n\t\t\tif(($this->meta === 4 or $this->meta === 5) and ($side === 4 or $side === 5)){\n\t\t\t\tcontinue;\n\t\t\t}elseif(($this->meta === 3 or $this->meta === 2) and ($side === 2 or $side === 3)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$c = $this->getSide($side);\n\t\t\tif($c instanceof Chest and $c->getDamage() === $this->meta){\n\t\t\t\t$tile = $this->getLevel()->getTile($c);\n\t\t\t\tif($tile instanceof TileChest and !$tile->isPaired()){\n\t\t\t\t\t$chest = $tile;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\tnew StringTag(\"id\", Tile::CHEST),\n\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t]);\n\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\n\t\tif($item->hasCustomName()){\n\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $item->getCustomName());\n\t\t}\n\n\t\tif($item->hasCustomBlockData()){\n\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t$nbt->{$key} = $v;\n\t\t\t}\n\t\t}\n\n\t\t$tile = Tile::createTile(\"Chest\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\n\t\tif($chest instanceof TileChest and $tile instanceof TileChest){\n\t\t\t$chest->pairWith($tile);\n\t\t\t$tile->pairWith($chest);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$t = $this->getLevel()->getTile($this);\n\t\tif($t instanceof TileChest){\n\t\t\t$t->unpair();\n\t\t}\n\t\t$this->getLevel()->setBlock($this, new Air(), true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\t$top = $this->getSide(1);\n\t\t\tif($top->isTransparent() !== true){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$t = $this->getLevel()->getTile($this);\n\t\t\t$chest = null;\n\t\t\tif($t instanceof TileChest){\n\t\t\t\t$chest = $t;\n\t\t\t}else{\n\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\tnew ListTag(\"Items\", []),\n\t\t\t\t\t\tnew StringTag(\"id\", Tile::CHEST),\n\t\t\t\t\t\tnew IntTag(\"x\", $this->x),\n\t\t\t\t\t\tnew IntTag(\"y\", $this->y),\n\t\t\t\t\t\tnew IntTag(\"z\", $this->z)\n\t\t\t\t]);\n\t\t\t\t$nbt->Items->setTagType(NBT::TAG_Compound);\n\t\t\t\t$chest = Tile::createTile(\"Chest\", $this->getLevel()->getChunk($this->x >> 4, $this->z >> 4), $nbt);\n\t\t\t}\n\n\t\t\tif(isset($chest->namedtag->Lock) and $chest->namedtag->Lock instanceof StringTag){\n\t\t\t\tif($chest->namedtag->Lock->getValue() !== $item->getCustomName()){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($player->isCreative() and $player->getServer()->limitedCreative){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t$player->addWindow($chest->getInventory());\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Tripwire.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Tool;\n\nclass Tripwire extends Transparent{\n\n\tprotected $id = self::TRIPWIRE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Tripwire\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHEARS;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 0;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 0;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/block/TripwireHook.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass TripwireHook extends Solid {\n\n    protected $id = self::TRIPWIRE_HOOK;\n\n    public function __construct($meta = 0){\n        $this->meta = $meta;\n    }\n\n    public function getName() :string {\n        return \"Tripwire Hook\";\n    }\n\n    public function getHardness() {\n        return 0;\n    }\n\n    public function getResistance(){\n        return 0;\n    }\n    \n}\n"
  },
  {
    "path": "src/pocketmine/block/UnlitRedstoneTorch.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nclass UnlitRedstoneTorch extends RedstoneTorch{\n\tprotected $id = self::UNLIT_REDSTONE_TORCH;\n\n\tpublic function getLightLevel(){\n\t\treturn 0;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/UnpoweredRepeater.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\n\nclass UnpoweredRepeater extends PoweredRepeater{\n\tprotected $id = self::UNPOWERED_REPEATER_BLOCK;\n\n\tpublic function getName(){\n\t\treturn \"Unpowered Repeater\";\n\t}\n\n\tpublic function getStrength(){\n\t\treturn 0;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn false;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\t$this->getLevel()->setBlock($this, new Air(), true);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Vine.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\n\nclass Vine extends Transparent{\n\n\tprotected $id = self::VINE;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Vines\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.2;\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn true;\n\t}\n\n\tpublic function hasEntityCollision(){\n\t\treturn true;\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\t$entity->resetFallDistance();\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\t$f1 = 1;\n\t\t$f2 = 1;\n\t\t$f3 = 1;\n\t\t$f4 = 0;\n\t\t$f5 = 0;\n\t\t$f6 = 0;\n\n\t\t$flag = $this->meta > 0;\n\n\t\tif(($this->meta & 0x02) > 0){\n\t\t\t$f4 = max($f4, 0.0625);\n\t\t\t$f1 = 0;\n\t\t\t$f2 = 0;\n\t\t\t$f5 = 1;\n\t\t\t$f3 = 0;\n\t\t\t$f6 = 1;\n\t\t\t$flag = true;\n\t\t}\n\n\t\tif(($this->meta & 0x08) > 0){\n\t\t\t$f1 = min($f1, 0.9375);\n\t\t\t$f4 = 1;\n\t\t\t$f2 = 0;\n\t\t\t$f5 = 1;\n\t\t\t$f3 = 0;\n\t\t\t$f6 = 1;\n\t\t\t$flag = true;\n\t\t}\n\n\t\tif(($this->meta & 0x01) > 0){\n\t\t\t$f3 = min($f3, 0.9375);\n\t\t\t$f6 = 1;\n\t\t\t$f1 = 0;\n\t\t\t$f4 = 1;\n\t\t\t$f2 = 0;\n\t\t\t$f5 = 1;\n\t\t\t$flag = true;\n\t\t}\n\n\t\tif(!$flag and $this->getSide(1)->isSolid()){\n\t\t\t$f2 = min($f2, 0.9375);\n\t\t\t$f5 = 1;\n\t\t\t$f1 = 0;\n\t\t\t$f4 = 1;\n\t\t\t$f3 = 0;\n\t\t\t$f6 = 1;\n\t\t}\n\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x + $f1,\n\t\t\t$this->y + $f2,\n\t\t\t$this->z + $f3,\n\t\t\t$this->x + $f4,\n\t\t\t$this->y + $f5,\n\t\t\t$this->z + $f6\n\t\t);\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif(!$target->isTransparent() and $target->isSolid()){\n\t\t\t$faces = [\n\t\t\t\t0 => 0,\n\t\t\t\t1 => 0,\n\t\t\t\t2 => 1,\n\t\t\t\t3 => 4,\n\t\t\t\t4 => 8,\n\t\t\t\t5 => 2,\n\t\t\t];\n\t\t\tif(isset($faces[$face])){\n\t\t\t\t$this->meta = $faces[$face];\n\t\t\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t/*if($this->getSide(0)->getId() === self::AIR){ //Replace with common break method\n\t\t\t\tServer::getInstance()->api->entity->drop($this, Item::get(LADDER, 0, 1));\n\t\t\t\t$this->getLevel()->setBlock($this, new Air(), true, true, true);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}*/\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\tif($item->isShears()){\n\t\t\treturn [\n\t\t\t\t[$this->id, 0, 1],\n\t\t\t];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHEARS;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/WallSign.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\level\\Level;\n\nclass WallSign extends SignPost{\n\t\n\tprotected $id = self::WALL_SIGN;\n\t\n\tpublic function getName(){\n\t\treturn \"Wall Sign\";\n\t}\n\t\n\tpublic function onUpdate($type){\n\t\t$faces = [\n\t\t\t2 => 3,\n\t\t\t3 => 2,\n\t\t\t4 => 5,\n\t\t\t5 => 4,\n\t\t];\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif(isset($faces[$this->meta])) {\n\t\t\t\tif ($this->getSide($faces[$this->meta])->getId() === self::AIR) {\n\t\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\t}\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Water.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass Water extends Liquid{\n\n\tprotected $id = self::WATER;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Water\";\n\t}\n\n\tpublic function onEntityCollide(Entity $entity){\n\t\t$entity->resetFallDistance();\n\t\tif($entity->fireTicks > 0){\n\t\t\t$entity->extinguish();\n\t\t}\n\n\t\t$entity->resetFallDistance();\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$ret = $this->getLevel()->setBlock($this, $this, true, false);\n\t\t$this->getLevel()->scheduleUpdate($this, $this->tickRate());\n\n\t\treturn $ret;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/WaterLily.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Item;\n\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\nclass WaterLily extends Flowable{\n\n\tprotected $id = self::WATER_LILY;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function isSolid(){\n\t\treturn false;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Lily Pad\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0;\n\t}\n\n\tpublic function getResistance(){\n\t\treturn 0;\n\t}\n\n\tpublic function canPassThrough(){\n\t\treturn true;\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\t\treturn new AxisAlignedBB(\n\t\t\t$this->x,\n\t\t\t$this->y,\n\t\t\t$this->z,\n\t\t\t$this->x,\n\t\t\t$this->y + 0.0625,\n\t\t\t$this->z\n\t\t);\n\t}\n\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($target instanceof Water){\n\t\t\t$up = $target->getSide(Vector3::SIDE_UP);\n\t\t\tif($up->getId() === Block::AIR){\n\t\t\t\t$this->getLevel()->setBlock($up, $this, true, true);\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\tif(!($this->getSide(0) instanceof Water)){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1]\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/WeightedPressurePlateHeavy.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass WeightedPressurePlateHeavy extends Solid{\n\n\tprotected $id = self::WEIGHTED_PRESSURE_PLATE_HEAVY;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Weighted Pressure Plate Heavy\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/WeightedPressurePlateLight.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\block;\n\nclass WeightedPressurePlateLight extends Solid{\n\n\tprotected $id = self::WEIGHTED_PRESSURE_PLATE_LIGHT;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Weighted Pressure Plate Light\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Wheat.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass Wheat extends Crops{\n\n\tprotected $id = self::WHEAT_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Wheat Block\";\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\t$drops = [];\n\t\tif($this->meta >= 0x07){\n\t\t\t$fortunel = $item->getEnchantmentLevel(Enchantment::TYPE_MINING_FORTUNE);\n\t\t\t$fortunel = $fortunel > 3 ? 3 : $fortunel;\n\t\t\t$drops[] = [Item::WHEAT, 0, 1];\n\t\t\t$drops[] = [Item::WHEAT_SEEDS, 0, mt_rand(0, 3 + $fortunel)];\n\t\t}else{\n\t\t\t$drops[] = [Item::WHEAT_SEEDS, 0, 1];\n\t\t}\n\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/Wood.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\Player;\n\nclass Wood extends Solid{\n\tconst OAK = 0;\n\tconst SPRUCE = 1;\n\tconst BIRCH = 2;\n\tconst JUNGLE = 3;\n\t//const ACACIA = 4;\n\t//const DARK_OAK = 5;\n\n\tprotected $id = self::WOOD;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\tself::OAK => \"Oak Wood\",\n\t\t\tself::SPRUCE => \"Spruce Wood\",\n\t\t\tself::BIRCH => \"Birch Wood\",\n\t\t\tself::JUNGLE => \"Jungle Wood\",\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 10;\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$faces = [\n\t\t\t0 => 0,\n\t\t\t1 => 0,\n\t\t\t2 => 0b1000,\n\t\t\t3 => 0b1000,\n\t\t\t4 => 0b0100,\n\t\t\t5 => 0b0100,\n\t\t];\n\n\t\t$this->meta = ($this->meta & 0x03) | $faces[$face];\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, $this->meta & 0x03, 1],\n\t\t];\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Wood2.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nclass Wood2 extends Wood{\n\n\tconst ACACIA = 0;\n\tconst DARK_OAK = 1;\n\n\tprotected $id = self::WOOD2;\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Acacia Wood\",\n\t\t\t1 => \"Dark Oak Wood\",\n\t\t\t2 => \"Unknown\",\n\t\t\t3 => \"Unknown\"\n\t\t];\n\t\treturn $names[$this->meta & 0x03];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/WoodDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass WoodDoor extends Door{\n\n\tprotected $id = self::WOOD_DOOR_BLOCK;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Wood Door Block\";\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 3;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[Item::WOODEN_DOOR, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/WoodSlab.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\Player;\n\nclass WoodSlab extends Transparent{\n\n\tprotected $id = self::WOOD_SLAB;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"Oak\",\n\t\t\t1 => \"Spruce\",\n\t\t\t2 => \"Birch\",\n\t\t\t3 => \"Jungle\",\n\t\t\t4 => \"Acacia\",\n\t\t\t5 => \"Dark Oak\",\n\t\t\t6 => \"\",\n\t\t\t7 => \"\"\n\t\t];\n\t\treturn (($this->meta & 0x08) === 0x08 ? \"Upper \" : \"\") . $names[$this->meta & 0x07] . \" Wooden Slab\";\n\t}\n\n\tprotected function recalculateBoundingBox() {\n\n\t\tif(($this->meta & 0x08) > 0){\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y + 0.5,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 1,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}else{\n\t\t\treturn new AxisAlignedBB(\n\t\t\t\t$this->x,\n\t\t\t\t$this->y,\n\t\t\t\t$this->z,\n\t\t\t\t$this->x + 1,\n\t\t\t\t$this->y + 0.5,\n\t\t\t\t$this->z + 1\n\t\t\t);\n\t\t}\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\t$this->meta &= 0x07;\n\t\tif($face === 0){\n\t\t\tif($target->getId() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0x08 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$this->meta |= 0x08;\n\t\t\t}\n\t\t}elseif($face === 1){\n\t\t\tif($target->getId() === self::WOOD_SLAB and ($target->getDamage() & 0x08) === 0 and ($target->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($target, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}elseif($block->getId() === self::WOOD_SLAB and ($block->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}else{ //TODO: collision\n\t\t\tif($block->getId() === self::WOOD_SLAB){\n\t\t\t\tif(($block->getDamage() & 0x07) === ($this->meta & 0x07)){\n\t\t\t\t\t$this->getLevel()->setBlock($block, Block::get(Item::DOUBLE_WOOD_SLAB, $this->meta), true);\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\tif($fy > 0.5){\n\t\t\t\t\t$this->meta |= 0x08;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($block->getId() === self::WOOD_SLAB and ($target->getDamage() & 0x07) !== ($this->meta & 0x07)){\n\t\t\treturn false;\n\t\t}\n\t\t$this->getLevel()->setBlock($block, $this, true, true);\n\n\t\treturn true;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, $this->meta & 0x07, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/WoodStairs.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\n\nclass WoodStairs extends Stair{\n\n\tprotected $id = self::WOOD_STAIRS;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Wood Stairs\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 20;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/WoodenButton.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\sound\\ButtonClickSound;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\nclass WoodenButton extends RedstoneSource{\n\tprotected $id = self::WOODEN_BUTTON;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function onUpdate($type){\n\t\tif($type == Level::BLOCK_UPDATE_SCHEDULED){\n\t\t\tif($this->isActivated()) {\n\t\t\t\t$this->meta ^= 0x08;\n\t\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t\t$this->getLevel()->addSound(new ButtonClickSound($this));\n\t\t\t\t$this->deactivate();\n\t\t\t}\n\t\t\treturn Level::BLOCK_UPDATE_SCHEDULED;\n\t\t}\n\t\tif($type === Level::BLOCK_UPDATE_NORMAL){\n\t\t\t$side = $this->getDamage();\n\t\t\tif($this->isActivated()) $side ^= 0x08;\n\t\t\t$faces = [\n\t\t\t\t0 => 1,\n\t\t\t\t1 => 0,\n\t\t\t\t2 => 3,\n\t\t\t\t3 => 2,\n\t\t\t\t4 => 5,\n\t\t\t\t5 => 4,\n\t\t\t];\n\n\t\t\tif($this->getSide($faces[$side]) instanceof Transparent){\n\t\t\t\t$this->getLevel()->useBreakOn($this);\n\n\t\t\t\treturn Level::BLOCK_UPDATE_NORMAL;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function deactivate(array $ignore = []){\n\t\tparent::deactivate($ignore = []);\n\t\t$faces = [\n\t\t\t0 => 1,\n\t\t\t1 => 0,\n\t\t\t2 => 3,\n\t\t\t3 => 2,\n\t\t\t4 => 5,\n\t\t\t5 => 4,\n\t\t];\n\t\t$side = $this->meta;\n\t\tif($this->isActivated()) $side ^= 0x08;\n\n\t\t$block = $this->getSide($faces[$side])->getSide(Vector3::SIDE_UP);\n\t\tif(!$this->equals($block)){\n\t\t\t$this->deactivateBlock($block);\n\t\t}\n\n\t\tif($side != 1){\n\t\t\t$this->deactivateBlock($this->getSide($faces[$side], 2));\n\t\t}\n\n\t\t$this->checkTorchOff($this->getSide($faces[$side]),[$this->getOppositeSide($faces[$side])]);\n\t}\n\n\tpublic function activate(array $ignore = []){\n\t\tparent::activate($ignore = []);\n\t\t$faces = [\n\t\t\t\t0 => 1,\n\t\t\t\t1 => 0,\n\t\t\t\t2 => 3,\n\t\t\t\t3 => 2,\n\t\t\t\t4 => 5,\n\t\t\t\t5 => 4,\n\t\t];\n\t\t\n\t\t$side = $this->meta;\n\t\tif($this->isActivated()) $side ^= 0x08;\n\n\t\t$block = $this->getSide($faces[$side])->getSide(Vector3::SIDE_UP);\n\t\tif(!$this->equals($block)){\n\t\t\t$this->activateBlock($block);\n\t\t}\n\n\t\tif($side != 1){\n\t\t\t$block = $this->getSide($faces[$side], 2);\n\t\t\t$this->activateBlock($block);\n\t\t}\n\n\t\t$this->checkTorchOn($this->getSide($faces[$side]),[$this->getOppositeSide($faces[$side])]);\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Wooden Button\";\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 0.5;\n\t}\n\n\tpublic function onBreak(Item $item){\n\t\tif($this->isActivated()){\n\t\t\t$this->meta ^= 0x08;\n\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t$this->deactivate();\n\t\t}\n\t\t$this->getLevel()->setBlock($this, new Air(), true, false);\n\t}\n\n\tpublic function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){\n\t\tif($target->isTransparent() === false){\n\t\t\t$this->meta = $face;\n\t\t\t$this->getLevel()->setBlock($block, $this, true, false);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function isActivated(Block $from = null){\n\t\treturn (($this->meta & 0x08) === 0x08);\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif(!$this->isActivated()){\n\t\t\t$this->meta ^= 0x08;\n\t\t\t$this->getLevel()->setBlock($this, $this, true, false);\n\t\t\t$this->getLevel()->addSound(new ButtonClickSound($this));\n\t\t\t$this->activate();\n\t\t\t$this->getLevel()->scheduleUpdate($this, 30);\n\t\t}\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/block/WoodenPressurePlate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\block;\n\nclass WoodenPressurePlate extends PressurePlate{\n\tprotected $id = self::WOODEN_PRESSURE_PLATE;\n\n\tpublic function getName(){\n\t\treturn \"Wooden Pressure Plate\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/block/Wool.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\n\nuse pocketmine\\item\\Tool;\n\nclass Wool extends Solid{\n\tconst WHITE = 0;\n\tconst ORANGE = 1;\n\tconst MAGENTA = 2;\n\tconst LIGHT_BLUE = 3;\n\tconst YELLOW = 4;\n\tconst LIME = 5;\n\tconst PINK = 6;\n\tconst GRAY = 7;\n\tconst LIGHT_GRAY = 8;\n\tconst CYAN = 9;\n\tconst PURPLE = 10;\n\tconst BLUE = 11;\n\tconst BROWN = 12;\n\tconst GREEN = 13;\n\tconst RED = 14;\n\tconst BLACK = 15;\n\n\tprotected $id = self::WOOL;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function getHardness(){\n\t\treturn 0.8;\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_SHEARS;\n\t}\n\n\tpublic function getName(){\n\t\tstatic $names = [\n\t\t\t0 => \"White Wool\",\n\t\t\t1 => \"Orange Wool\",\n\t\t\t2 => \"Magenta Wool\",\n\t\t\t3 => \"Light Blue Wool\",\n\t\t\t4 => \"Yellow Wool\",\n\t\t\t5 => \"Lime Wool\",\n\t\t\t6 => \"Pink Wool\",\n\t\t\t7 => \"Gray Wool\",\n\t\t\t8 => \"Light Gray Wool\",\n\t\t\t9 => \"Cyan Wool\",\n\t\t\t10 => \"Purple Wool\",\n\t\t\t11 => \"Blue Wool\",\n\t\t\t12 => \"Brown Wool\",\n\t\t\t13 => \"Green Wool\",\n\t\t\t14 => \"Red Wool\",\n\t\t\t15 => \"Black Wool\",\n\t\t];\n\t\treturn $names[$this->meta & 0x0f];\n\t}\n\n\tpublic function getBurnChance() : int{\n\t\treturn 30;\n\t}\n\n\tpublic function getBurnAbility() : int{\n\t\treturn 60;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/block/Workbench.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\block;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Tool;\nuse pocketmine\\Player;\n\n//TODO: check orientation\nclass Workbench extends Solid{\n\n\tprotected $id = self::WORKBENCH;\n\n\tpublic function __construct($meta = 0){\n\t\t$this->meta = $meta;\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function getHardness() {\n\t\treturn 2.5;\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Crafting Table\";\n\t}\n\n\tpublic function getToolType(){\n\t\treturn Tool::TYPE_AXE;\n\t}\n\n\tpublic function onActivate(Item $item, Player $player = null){\n\t\tif($player instanceof Player){\n\t\t\tif($player->getServer()->limitedCreative and $player->isCreative()) return true;\n\t\t\t$player->craftingType = Player::CRAFTING_BIG;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getDrops(Item $item) : array {\n\t\treturn [\n\t\t\t[$this->id, 0, 1],\n\t\t];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/Command.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Command handling related classes\n */\nnamespace pocketmine\\command;\n\nuse pocketmine\\event\\TextContainer;\nuse pocketmine\\event\\TimingsHandler;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\TextFormat;\n\nabstract class Command{\n\t/** @var \\stdClass */\n\tprivate static $defaultDataTemplate = null;\n\n\t/** @var string */\n\tprivate $name;\n\t/** @var \\stdClass */\n\tprotected $commandData = null;\n\n\t/** @var string */\n\tprivate $nextLabel;\n\n\t/** @var string */\n\tprivate $label;\n\n\t/**\n\t * @var string[]\n\t */\n\tprivate $aliases = [];\n\n\t/**\n\t * @var string[]\n\t */\n\tprivate $activeAliases = [];\n\n\t/** @var CommandMap */\n\tprivate $commandMap = null;\n\n\t/** @var string */\n\tprotected $description = \"\";\n\n\t/** @var string */\n\tprotected $usageMessage;\n\n\t/** @var string */\n\tprivate $permission = null;\n\n\t/** @var string */\n\tprivate $permissionMessage = null;\n\n\t/** @var TimingsHandler */\n\tpublic $timings;\n\n\t/**\n\t * @param string   $name\n\t * @param string   $description\n\t * @param string   $usageMessage\n\t * @param string[] $aliases\n\t */\n\tpublic function __construct($name, $description = \"\", $usageMessage = null, array $aliases = []){\n\t\t$this->commandData = self::generateDefaultData();\n\t\t$this->name = $this->nextLabel = $this->label = $name;\n\t\t$this->setDescription($description);\n\t\t$this->usageMessage = $usageMessage === null ? \"/\" . $name : $usageMessage;\n\t\t$this->setAliases($aliases);\n\t\t$this->timings = new TimingsHandler(\"** Command: \" . $name);\n\t}\n\n\t/**\n\t * Returns an \\stdClass containing command data\n\t *\n\t * @return \\stdClass\n\t */\n\tpublic function getDefaultCommandData() : \\stdClass{\n\t\treturn $this->commandData;\n\t}\n\n\t/**\n\t * Generates modified command data for the specified player\n\t * for AvailableCommandsPacket.\n\t *\n\t * @param Player $player\n\t *\n\t * @return \\stdClass|null\n\t */\n\tpublic function generateCustomCommandData(Player $player){\n\t\t//TODO: fix command permission filtering on join\n\t\t/*if(!$this->testPermission($player)){\n\t\t\treturn null;\n\t\t}*/\n\t\t$customData = clone $this->commandData;\n\t\t$customData->aliases = $this->getAliases();\n\t\t/*foreach($customData->overloads as &$overload){\n\t\t\tif(($p = @$overload->pocketminePermission) !== null and !$player->hasPermission($p)){\n\t\t\t\tunset($overload);\n\t\t\t}\n\t\t}*/\n\t\treturn $customData;\n\t}\n\n\tpublic function getOverloads(): \\stdClass{\n\t\treturn $this->commandData->overloads;\n\t}\n\n\t/**\n\t * @param CommandSender $sender\n\t * @param string        $commandLabel\n\t * @param string[]      $args\n\t *\n\t * @return mixed\n\t */\n\tpublic abstract function execute(CommandSender $sender, $commandLabel, array $args);\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName() : string{\n\t\treturn $this->name;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getPermission(){\n\t\treturn $this->commandData->pocketminePermission ?? null;\n\t}\n\t\n\n\t/**\n\t * @param string|null $permission\n\t */\n\tpublic function setPermission($permission){\n\t\tif($permission !== null){\n\t\t\t$this->commandData->pocketminePermission = $permission;\n\t\t}else{\n\t\t\tunset($this->commandData->pocketminePermission);\n\t\t}\n\t}\n\n\t/**\n\t * @param CommandSender $target\n\t *\n\t * @return bool\n\t */\n\tpublic function testPermission(CommandSender $target){\n\t\tif($this->testPermissionSilent($target)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif($this->permissionMessage === null){\n\t\t\t$target->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\t\t}elseif($this->permissionMessage !== \"\"){\n\t\t\t$target->sendMessage(str_replace(\"<permission>\", $this->getPermission(), $this->permissionMessage));\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param CommandSender $target\n\t *\n\t * @return bool\n\t */\n\tpublic function testPermissionSilent(CommandSender $target){\n\t\tif(($perm = $this->getPermission()) === null or $perm === \"\"){\n\t\t\treturn true;\n\t\t}\n\n\t\tforeach(explode(\";\", $perm) as $permission){\n\t\t\tif($target->hasPermission($permission)){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getLabel(){\n\t\treturn $this->label;\n\t}\n\n\tpublic function setLabel($name){\n\t\t$this->nextLabel = $name;\n\t\tif(!$this->isRegistered()){\n\t\t\t$this->timings = new TimingsHandler(\"** Command: \" . $name);\n\t\t\t$this->label = $name;\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Registers the command into a Command map\n\t *\n\t * @param CommandMap $commandMap\n\t *\n\t * @return bool\n\t */\n\tpublic function register(CommandMap $commandMap){\n\t\tif($this->allowChangesFrom($commandMap)){\n\t\t\t$this->commandMap = $commandMap;\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param CommandMap $commandMap\n\t *\n\t * @return bool\n\t */\n\tpublic function unregister(CommandMap $commandMap){\n\t\tif($this->allowChangesFrom($commandMap)){\n\t\t\t$this->commandMap = null;\n\t\t\t$this->activeAliases = $this->commandData->aliases;\n\t\t\t$this->label = $this->nextLabel;\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param CommandMap $commandMap\n\t *\n\t * @return bool\n\t */\n\tprivate function allowChangesFrom(CommandMap $commandMap){\n\t\treturn $this->commandMap === null or $this->commandMap === $commandMap;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isRegistered(){\n\t\treturn $this->commandMap !== null;\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic function getAliases(){\n\t\treturn $this->activeAliases;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getPermissionMessage(){\n\t\treturn $this->permissionMessage;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getDescription(){\n\t\treturn $this->commandData->description;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getUsage(){\n\t\treturn $this->usageMessage;\n\t}\n\n\t/**\n\t * @param string[] $aliases\n\t */\n\tpublic function setAliases(array $aliases){\n\t\t$this->commandData->aliases = $aliases;\n\t\tif(!$this->isRegistered()){\n\t\t\t$this->activeAliases = (array) $aliases;\n\t\t}\n\t}\n\n\t/**\n\t * @param string $description\n\t */\n\tpublic function setDescription($description){\n\t\t$this->commandData->description = $description;\n\t}\n\n\t/**\n\t * @param string $permissionMessage\n\t */\n\tpublic function setPermissionMessage($permissionMessage){\n\t\t$this->permissionMessage = $permissionMessage;\n\t}\n\n\t/**\n\t * @param string $usage\n\t */\n\tpublic function setUsage($usage){\n\t\t$this->usageMessage = $usage;\n\t}\n\n\tpublic static final function generateDefaultData() : \\stdClass{\n\t\tif(self::$defaultDataTemplate === null){\n\t\t\tself::$defaultDataTemplate = json_decode(file_get_contents(Server::getInstance()->getFilePath() . \"src/pocketmine/resources/command_default.json\"));\n\t\t}\n\t\treturn clone self::$defaultDataTemplate;\n\t}\n\n\t/**\n\t * @param CommandSender $source\n\t * @param string        $message\n\t * @param bool          $sendToSource\n\t */\n\tpublic static function broadcastCommandMessage(CommandSender $source, $message, $sendToSource = true){\n\t\tif($message instanceof TextContainer){\n\t\t\t$m = clone $message;\n\t\t\t$result = \"[\".$source->getName().\": \".($source->getServer()->getLanguage()->get($m->getText()) !== $m->getText() ? \"%\" : \"\") . $m->getText() .\"]\";\n\n\t\t\t$users = $source->getServer()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);\n\t\t\t$colored = TextFormat::GRAY . TextFormat::ITALIC . $result;\n\n\t\t\t$m->setText($result);\n\t\t\t$result = clone $m;\n\t\t\t$m->setText($colored);\n\t\t\t$colored = clone $m;\n\t\t}else{\n\t\t\t$users = $source->getServer()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_ADMINISTRATIVE);\n\t\t\t$result = new TranslationContainer(\"chat.type.admin\", [$source->getName(), $message]);\n\t\t\t$colored = new TranslationContainer(TextFormat::GRAY . TextFormat::ITALIC . \"%chat.type.admin\", [$source->getName(), $message]);\n\t\t}\n\n\t\tif($sendToSource === true and !($source instanceof ConsoleCommandSender)){\n\t\t\t$source->sendMessage($message);\n\t\t}\n\n\t\tforeach($users as $user){\n\t\t\tif($user instanceof CommandSender){\n\t\t\t\tif($user instanceof ConsoleCommandSender){\n\t\t\t\t\t$user->sendMessage($result);\n\t\t\t\t}elseif($user !== $source){\n\t\t\t\t\t$user->sendMessage($colored);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function __toString(){\n\t\treturn $this->name;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/CommandExecutor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\n\ninterface CommandExecutor{\n\n\t/**\n\t * @param CommandSender $sender\n\t * @param Command       $command\n\t * @param string        $label\n\t * @param string[]      $args\n\t *\n\t * @return boolean\n\t */\n\tpublic function onCommand(CommandSender $sender, Command $command, $label, array $args);\n\n}"
  },
  {
    "path": "src/pocketmine/command/CommandMap.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\n\ninterface CommandMap{\n\n\t/**\n\t * @param string    $fallbackPrefix\n\t * @param Command[] $commands\n\t */\n\tpublic function registerAll($fallbackPrefix, array $commands);\n\n\t/**\n\t * @param string  $fallbackPrefix\n\t * @param Command $command\n\t * @param string  $label\n\t */\n\tpublic function register($fallbackPrefix, Command $command, $label = null);\n\n\t/**\n\t * @param CommandSender $sender\n\t * @param string        $cmdLine\n\t *\n\t * @return boolean\n\t */\n\tpublic function dispatch(CommandSender $sender, $cmdLine);\n\n\t/**\n\t * @return void\n\t */\n\tpublic function clearCommands();\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return Command\n\t */\n\tpublic function getCommand($name);\n\n\n}"
  },
  {
    "path": "src/pocketmine/command/CommandReader.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\nuse pocketmine\\Thread;\nuse pocketmine\\utils\\MainLogger;\nuse pocketmine\\utils\\Utils;\n\nclass CommandReader extends Thread{\n\tprivate $readline;\n\t/** @var \\Threaded */\n\tprotected $buffer;\n\tprivate $shutdown = false;\n\tprivate $stdin;\n\t/** @var MainLogger */\n\tprivate $logger;\n\n\tpublic function __construct($logger){\n\t\t$this->stdin = fopen(\"php://stdin\", \"r\");\n\t\t$opts = getopt(\"\", [\"disable-readline\"]);\n\t\tif(extension_loaded(\"readline\") && !isset($opts[\"disable-readline\"]) && (!function_exists(\"posix_isatty\") || posix_isatty($this->stdin))){\n\t\t\t$this->readline = true;\n\t\t}else{\n\t\t\t$this->readline = false;\n\t\t}\n\t\t$this->logger = $logger;\n\t\t$this->buffer = new \\Threaded;\n\t\t$this->start();\n\t}\n\n\tpublic function shutdown(){\n\t\t$this->shutdown = true;\n\t}\n\n\tprivate function readline_callback($line){\n\t\tif($line !== \"\"){\n\t\t\t$this->buffer[] = $line;\n\t\t\treadline_add_history($line);\n\t\t}\n\t}\n\n\tprivate function readLine(){\n\t\tif(!$this->readline){\n\t\t\t$line = trim(fgets($this->stdin));\n\t\t\tif($line !== \"\"){\n\t\t\t\t$this->buffer[] = $line;\n\t\t\t}\n\t\t}else{\n\t\t\treadline_callback_read_char();\n\t\t}\n\t}\n\n\t/**\n\t * Reads a line from console, if available. Returns null if not available\n\t *\n\t * @return string|null\n\t */\n\tpublic function getLine(){\n\t\tif($this->buffer->count() !== 0){\n\t\t\treturn $this->buffer->shift();\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function quit(){\n\t\t$this->shutdown();\n\t\t// Windows sucks\n\t\tif(Utils::getOS() !== \"win\"){\n\t\t\tparent::quit();\n\t\t}\n\t}\n\n\tpublic function run(){\n\t\tif($this->readline){\n\t\t\treadline_callback_handler_install(\"Elywing> \", [$this, \"readline_callback\"]);\n\t\t\t$this->logger->setConsoleCallback(\"readline_redisplay\");\n\t\t}\n\n\t\twhile(!$this->shutdown){\n\t\t\t$r = [$this->stdin];\n\t\t\t$w = null;\n\t\t\t$e = null;\n\t\t\tif(stream_select($r, $w, $e, 0, 200000) > 0){\n\t\t\t\t// PHP on Windows sucks\n\t\t\t\tif(feof($this->stdin)){\n\t\t\t\t\tif(Utils::getOS() == \"win\"){\n\t\t\t\t\t\t$this->stdin = fopen(\"php://stdin\", \"r\");\n\t\t\t\t\t\tif(!is_resource($this->stdin)){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$this->readLine();\n\t\t\t}\n\t\t}\n\n\t\tif($this->readline){\n\t\t\t$this->logger->setConsoleCallback(null);\n\t\t\treadline_callback_handler_remove();\n\t\t}\n\t}\n\n\tpublic function getThreadName(){\n\t\treturn \"Console\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/CommandSender.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\nuse pocketmine\\permission\\Permissible;\n\ninterface CommandSender extends Permissible{\n\n\t/**\n\t * @param string $message\n\t */\n\tpublic function sendMessage($message);\n\n\t/**\n\t * @return \\pocketmine\\Server\n\t */\n\tpublic function getServer();\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName();\n\n\n}"
  },
  {
    "path": "src/pocketmine/command/ConsoleCommandSender.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\nuse pocketmine\\event\\TextContainer;\nuse pocketmine\\permission\\PermissibleBase;\nuse pocketmine\\permission\\PermissionAttachment;\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\MainLogger;\n\nclass ConsoleCommandSender implements CommandSender{\n\n\tprivate $perm;\n\n\tpublic function __construct(){\n\t\t$this->perm = new PermissibleBase($this);\n\t}\n\n\t/**\n\t * @param \\pocketmine\\permission\\Permission|string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isPermissionSet($name){\n\t\treturn $this->perm->isPermissionSet($name);\n\t}\n\n\t/**\n\t * @param \\pocketmine\\permission\\Permission|string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function hasPermission($name){\n\t\treturn $this->perm->hasPermission($name);\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t * @param string $name\n\t * @param bool   $value\n\t *\n\t * @return \\pocketmine\\permission\\PermissionAttachment\n\t */\n\tpublic function addAttachment(Plugin $plugin, $name = null, $value = null){\n\t\treturn $this->perm->addAttachment($plugin, $name, $value);\n\t}\n\n\t/**\n\t * @param PermissionAttachment $attachment\n\t *\n\t * @return void\n\t */\n\tpublic function removeAttachment(PermissionAttachment $attachment){\n\t\t$this->perm->removeAttachment($attachment);\n\t}\n\n\tpublic function recalculatePermissions(){\n\t\t$this->perm->recalculatePermissions();\n\t}\n\n\t/**\n\t * @return \\pocketmine\\permission\\PermissionAttachmentInfo[]\n\t */\n\tpublic function getEffectivePermissions(){\n\t\treturn $this->perm->getEffectivePermissions();\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isPlayer(){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\Server\n\t */\n\tpublic function getServer(){\n\t\treturn Server::getInstance();\n\t}\n\n\t/**\n\t * @param string $message\n\t */\n\tpublic function sendMessage($message){\n\t\tif($message instanceof TextContainer){\n\t\t\t$message = $this->getServer()->getLanguage()->translate($message);\n\t\t}else{\n\t\t\t$message = $this->getServer()->getLanguage()->translateString($message);\n\t\t}\n\n\t\tforeach(explode(\"\\n\", trim($message)) as $line){\n\t\t\tMainLogger::getLogger()->info($line);\n\t\t}\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName() : string{\n\t\treturn \"CONSOLE\";\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isOp(){\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setOp($value){\n\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/command/FormattedCommandAlias.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\MainLogger;\nuse pocketmine\\utils\\TextFormat;\n\nclass FormattedCommandAlias extends Command{\n\tprivate $formatStrings = [];\n\n\t/**\n\t * @param string   $alias\n\t * @param string[] $formatStrings\n\t */\n\tpublic function __construct($alias, array $formatStrings){\n\t\tparent::__construct($alias);\n\t\t$this->formatStrings = $formatStrings;\n\t}\n\n\tpublic function execute(CommandSender $sender, $commandLabel, array $args){\n\n\t\t$commands = [];\n\t\t$result = false;\n\n\t\tforeach($this->formatStrings as $formatString){\n\t\t\ttry{\n\t\t\t\t$commands[] = $this->buildCommand($formatString, $args);\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\tif($e instanceof \\InvalidArgumentException){\n\t\t\t\t\t$sender->sendMessage(TextFormat::RED . $e->getMessage());\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.exception\"));\n\t\t\t\t\t$logger = $sender->getServer()->getLogger();\n\t\t\t\t\tif($logger instanceof MainLogger){\n\t\t\t\t\t\t$logger->logException($e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tforeach($commands as $command){\n\t\t\t$result |= Server::getInstance()->dispatchCommand($sender, $command);\n\t\t}\n\n\t\treturn (bool) $result;\n\t}\n\n\t/**\n\t * @param string $formatString\n\t * @param array  $args\n\t *\n\t * @return string\n\t * @throws \\InvalidArgumentException\n\t */\n\tprivate function buildCommand($formatString, array $args){\n\t\t$index = strpos($formatString, '$');\n\t\twhile($index !== false){\n\t\t\t$start = $index;\n\t\t\tif($index > 0 and $formatString{$start - 1} === \"\\\\\"){\n\t\t\t\t$formatString = substr($formatString, 0, $start - 1) . substr($formatString, $start);\n\t\t\t\t$index = strpos($formatString, '$', $index);\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$required = false;\n\t\t\tif($formatString{$index + 1} == '$'){\n\t\t\t\t$required = true;\n\n\t\t\t\t++$index;\n\t\t\t}\n\n\t\t\t++$index;\n\n\t\t\t$argStart = $index;\n\n\t\t\twhile($index < strlen($formatString) and self::inRange(ord($formatString{$index}) - 48, 0, 9)){\n\t\t\t\t++$index;\n\t\t\t}\n\n\t\t\tif($argStart === $index){\n\t\t\t\tthrow new \\InvalidArgumentException(\"Invalid replacement token\");\n\t\t\t}\n\n\t\t\t$position = intval(substr($formatString, $argStart, $index));\n\n\t\t\tif($position === 0){\n\t\t\t\tthrow new \\InvalidArgumentException(\"Invalid replacement token\");\n\t\t\t}\n\n\t\t\t--$position;\n\n\t\t\t$rest = false;\n\n\t\t\tif($index < strlen($formatString) and $formatString{$index} === \"-\"){\n\t\t\t\t$rest = true;\n\t\t\t\t++$index;\n\t\t\t}\n\n\t\t\t$end = $index;\n\n\t\t\tif($required and $position >= count($args)){\n\t\t\t\tthrow new \\InvalidArgumentException(\"Missing required argument \" . ($position + 1));\n\t\t\t}\n\n\t\t\t$replacement = \"\";\n\t\t\tif($rest and $position < count($args)){\n\t\t\t\tfor($i = $position; $i < count($args); ++$i){\n\t\t\t\t\tif($i !== $position){\n\t\t\t\t\t\t$replacement .= \" \";\n\t\t\t\t\t}\n\n\t\t\t\t\t$replacement .= $args[$i];\n\t\t\t\t}\n\t\t\t}elseif($position < count($args)){\n\t\t\t\t$replacement .= $args[$position];\n\t\t\t}\n\n\t\t\t$formatString = substr($formatString, 0, $start) . $replacement . substr($formatString, $end);\n\n\t\t\t$index = $start + strlen($replacement);\n\n\t\t\t$index = strpos($formatString, '$', $index);\n\t\t}\n\n\t\treturn $formatString;\n\t}\n\n\t/**\n\t * @param int $i\n\t * @param int $j\n\t * @param int $k\n\t *\n\t * @return bool\n\t */\n\tprivate static function inRange($i, $j, $k){\n\t\treturn $i >= $j and $i <= $k;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/command/PluginCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\plugin\\Plugin;\n\n\nclass PluginCommand extends Command implements PluginIdentifiableCommand{\n\n\t/** @var Plugin */\n\tprivate $owningPlugin;\n\n\t/** @var CommandExecutor */\n\tprivate $executor;\n\n\t/**\n\t * @param string $name\n\t * @param Plugin $owner\n\t */\n\tpublic function __construct($name, Plugin $owner){\n\t\tparent::__construct($name);\n\t\t$this->owningPlugin = $owner;\n\t\t$this->executor = $owner;\n\t\t$this->usageMessage = \"\";\n\t}\n\n\tpublic function execute(CommandSender $sender, $commandLabel, array $args){\n\n\t\tif(!$this->owningPlugin->isEnabled()){\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn false;\n\t\t}\n\n\t\t$success = $this->executor->onCommand($sender, $this, $commandLabel, $args);\n\n\t\tif(!$success and $this->usageMessage !== \"\"){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t}\n\n\t\treturn $success;\n\t}\n\n\tpublic function getExecutor(){\n\t\treturn $this->executor;\n\t}\n\n\t/**\n\t * @param CommandExecutor $executor\n\t */\n\tpublic function setExecutor(CommandExecutor $executor){\n\t\t$this->executor = ($executor != null) ? $executor : $this->owningPlugin;\n\t}\n\n\t/**\n\t * @return Plugin\n\t */\n\tpublic function getPlugin(){\n\t\treturn $this->owningPlugin;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/PluginIdentifiableCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\ninterface PluginIdentifiableCommand{\n\n\t/**\n\t * @return \\pocketmine\\plugin\\Plugin\n\t */\n\tpublic function getPlugin();\n}\n"
  },
  {
    "path": "src/pocketmine/command/RemoteConsoleCommandSender.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\n\nuse pocketmine\\event\\TextContainer;\n\nclass RemoteConsoleCommandSender extends ConsoleCommandSender{\n\n\t/** @var string */\n\tprivate $messages = \"\";\n\n\tpublic function sendMessage($message){\n\t\tif($message instanceof TextContainer){\n\t\t\t$message = $this->getServer()->getLanguage()->translate($message);\n\t\t}else{\n\t\t\t$message = $this->getServer()->getLanguage()->translateString($message);\n\t\t}\n\n\t\t$this->messages .= trim($message, \"\\r\\n\") . \"\\n\";\n\t}\n\n\tpublic function getMessage(){\n\t\treturn $this->messages;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Rcon\";\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/command/SimpleCommandMap.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command;\n\nuse pocketmine\\command\\defaults\\BanCidByNameCommand;\nuse pocketmine\\command\\defaults\\BanCidCommand;\nuse pocketmine\\command\\defaults\\BanCommand;\nuse pocketmine\\command\\defaults\\BanIpByNameCommand;\nuse pocketmine\\command\\defaults\\BanIpCommand;\nuse pocketmine\\command\\defaults\\BanListCommand;\nuse pocketmine\\command\\defaults\\DefaultGamemodeCommand;\nuse pocketmine\\command\\defaults\\DeopCommand;\nuse pocketmine\\command\\defaults\\DifficultyCommand;\nuse pocketmine\\command\\defaults\\DumpMemoryCommand;\nuse pocketmine\\command\\defaults\\EffectCommand;\nuse pocketmine\\command\\defaults\\EnchantCommand;\nuse pocketmine\\command\\defaults\\GamemodeCommand;\nuse pocketmine\\command\\defaults\\GarbageCollectorCommand;\nuse pocketmine\\command\\defaults\\GiveCommand;\nuse pocketmine\\command\\defaults\\HelpCommand;\nuse pocketmine\\command\\defaults\\KickCommand;\nuse pocketmine\\command\\defaults\\KillCommand;\nuse pocketmine\\command\\defaults\\ListCommand;\nuse pocketmine\\command\\defaults\\MeCommand;\nuse pocketmine\\command\\defaults\\OpCommand;\nuse pocketmine\\command\\defaults\\PardonCommand;\nuse pocketmine\\command\\defaults\\PardonCidCommand;\nuse pocketmine\\command\\defaults\\PardonIpCommand;\nuse pocketmine\\command\\defaults\\ParticleCommand;\nuse pocketmine\\command\\defaults\\PluginsCommand;\nuse pocketmine\\command\\defaults\\ReloadCommand;\nuse pocketmine\\command\\defaults\\SaveCommand;\nuse pocketmine\\command\\defaults\\SaveOffCommand;\nuse pocketmine\\command\\defaults\\SaveOnCommand;\nuse pocketmine\\command\\defaults\\SayCommand;\nuse pocketmine\\command\\defaults\\SeedCommand;\nuse pocketmine\\command\\defaults\\SetBlockCommand;\nuse pocketmine\\command\\defaults\\SetWorldSpawnCommand;\nuse pocketmine\\command\\defaults\\SpawnpointCommand;\nuse pocketmine\\command\\defaults\\StatusCommand;\nuse pocketmine\\command\\defaults\\StopCommand;\nuse pocketmine\\command\\defaults\\SummonCommand;\nuse pocketmine\\command\\defaults\\TeleportCommand;\nuse pocketmine\\command\\defaults\\TellCommand;\nuse pocketmine\\command\\defaults\\TimeCommand;\nuse pocketmine\\command\\defaults\\TimingsCommand;\nuse pocketmine\\command\\defaults\\TransferCommand;\nuse pocketmine\\command\\defaults\\VanillaCommand;\nuse pocketmine\\command\\defaults\\VersionCommand;\nuse pocketmine\\command\\defaults\\WeatherCommand;\nuse pocketmine\\command\\defaults\\WhitelistCommand;\nuse pocketmine\\command\\defaults\\XpCommand;\nuse pocketmine\\command\\defaults\\MakePharCommand;\n\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\MainLogger;\nuse pocketmine\\utils\\TextFormat;\n\nclass SimpleCommandMap implements CommandMap{\n\n\t/**\n\t * @var Command[]\n\t */\n\tprotected $knownCommands = [];\n\t\n\t/**\n\t * @var bool[]\n\t */\n\tprotected $commandConfig = [];\n\n\t/** @var Server */\n\tprivate $server;\n\n\tpublic function __construct(Server $server){\n\t\t$this->server = $server;\n\t\t/** @var bool[] */\n\t\t$this->commandConfig = $this->server->getProperty(\"commands\");\n\t\t$this->setDefaultCommands();\n\t}\n\n\tprivate function setDefaultCommands(){\n\t\t$this->register(\"pocketmine\", new WeatherCommand(\"weather\"));\n\n\t\t$this->register(\"pocketmine\", new BanCidCommand(\"bancid\"));\n\t\t$this->register(\"pocketmine\", new PardonCidCommand(\"pardoncid\"));\n\t\t$this->register(\"pocketmine\", new BanCidByNameCommand(\"bancidbyname\"));\n\t\t$this->register(\"pocketmine\", new BanIpByNameCommand(\"banipbyname\"));\n\n\t\t$this->register(\"pocketmine\", new VersionCommand(\"version\"));\n\t\t$this->register(\"pocketmine\", new PluginsCommand(\"plugins\"));\n\t\t$this->register(\"pocketmine\", new SeedCommand(\"seed\"));\n\t\t$this->register(\"pocketmine\", new HelpCommand(\"help\"), null, true);\n\t\t$this->register(\"pocketmine\", new StopCommand(\"stop\"), null, true);\n\t\t$this->register(\"pocketmine\", new TellCommand(\"tell\"));\n\t\t$this->register(\"pocketmine\", new DefaultGamemodeCommand(\"defaultgamemode\"));\n\t\t$this->register(\"pocketmine\", new BanCommand(\"ban\"));\n\t\t$this->register(\"pocketmine\", new BanIpCommand(\"ban-ip\"));\n\t\t$this->register(\"pocketmine\", new BanListCommand(\"banlist\"));\n\t\t$this->register(\"pocketmine\", new PardonCommand(\"pardon\"));\n\t\t$this->register(\"pocketmine\", new PardonIpCommand(\"pardon-ip\"));\n\t\t$this->register(\"pocketmine\", new SayCommand(\"say\"));\n\t\t$this->register(\"pocketmine\", new MeCommand(\"me\"));\n\t\t$this->register(\"pocketmine\", new ListCommand(\"list\"));\n\t\t$this->register(\"pocketmine\", new DifficultyCommand(\"difficulty\"));\n\t\t$this->register(\"pocketmine\", new KickCommand(\"kick\"));\n\t\t$this->register(\"pocketmine\", new OpCommand(\"op\"));\n\t\t$this->register(\"pocketmine\", new DeopCommand(\"deop\"));\n\t\t$this->register(\"pocketmine\", new WhitelistCommand(\"whitelist\"));\n\t\t$this->register(\"pocketmine\", new SaveOnCommand(\"save-on\"));\n\t\t$this->register(\"pocketmine\", new SaveOffCommand(\"save-off\"));\n\t\t$this->register(\"pocketmine\", new SaveCommand(\"save-all\"), null, true);\n\t\t$this->register(\"pocketmine\", new GiveCommand(\"give\"));\n\t\t$this->register(\"pocketmine\", new EffectCommand(\"effect\"));\n\t\t$this->register(\"pocketmine\", new EnchantCommand(\"enchant\"));\n\t\t$this->register(\"pocketmine\", new ParticleCommand(\"particle\"));\n\t\t$this->register(\"pocketmine\", new GamemodeCommand(\"gamemode\"));\n\t\t$this->register(\"pocketmine\", new KillCommand(\"kill\"));\n\t\t$this->register(\"pocketmine\", new SpawnpointCommand(\"spawnpoint\"));\n\t\t$this->register(\"pocketmine\", new SetWorldSpawnCommand(\"setworldspawn\"));\n\t\t$this->register(\"pocketmine\", new SummonCommand(\"summon\"));\n\t\t$this->register(\"pocketmine\", new TeleportCommand(\"tp\"));\n\t\t$this->register(\"pocketmine\", new TimeCommand(\"time\"));\n\t\t$this->register(\"pocketmine\", new TimingsCommand(\"timings\"));\n\t\t$this->register(\"pocketmine\", new TransferCommand(\"transferserver\"));\n\t\t$this->register(\"pocketmine\", new ReloadCommand(\"reload\"), null, true);\n\t\t$this->register(\"pocketmine\", new XpCommand(\"xp\"));\n\t\t$this->register(\"pocketmine\", new SetBlockCommand(\"setblock\"));\n\n\t\tif($this->server->getProperty(\"debug.commands\", false)){\n\t\t\t$this->register(\"pocketmine\", new StatusCommand(\"status\"), null, true);\n\t\t\t$this->register(\"pocketmine\", new GarbageCollectorCommand(\"gc\"), null, true);\n\t\t\t$this->register(\"pocketmine\", new DumpMemoryCommand(\"dumpmemory\"), null, true);\n\t\t}\n\t}\n\n\n\tpublic function registerAll($fallbackPrefix, array $commands){\n\t\tforeach($commands as $command){\n\t\t\t$this->register($fallbackPrefix, $command);\n\t\t}\n\t}\n\n\tpublic function register($fallbackPrefix, Command $command, $label = null, $overrideConfig = false){\n\t\tif($label === null){\n\t\t\t$label = $command->getName();\n\t\t}\n\t\t$label = strtolower(trim($label));\n\t\t\n\t\t//Check if command was disabled in config and for override\n\t\tif(!(($this->commandConfig[$label] ?? $this->commandConfig[\"default\"] ?? true) or $overrideConfig)){\n\t\t\treturn false;\n\t\t}\n\t\t$fallbackPrefix = strtolower(trim($fallbackPrefix));\n\n\t\t$registered = $this->registerAlias($command, false, $fallbackPrefix, $label);\n\n\t\t$aliases = $command->getAliases();\n\t\tforeach($aliases as $index => $alias){\n\t\t\tif(!$this->registerAlias($command, true, $fallbackPrefix, $alias)){\n\t\t\t\tunset($aliases[$index]);\n\t\t\t}\n\t\t}\n\t\t$command->setAliases($aliases);\n\n\t\tif(!$registered){\n\t\t\t$command->setLabel($fallbackPrefix . \":\" . $label);\n\t\t}\n\n\t\t$command->register($this);\n\n\t\treturn $registered;\n\t}\n\n\tprivate function registerAlias(Command $command, $isAlias, $fallbackPrefix, $label){\n\t\t$this->knownCommands[$fallbackPrefix . \":\" . $label] = $command;\n\t\tif(($command instanceof VanillaCommand or $isAlias) and isset($this->knownCommands[$label])){\n\t\t\treturn false;\n\t\t}\n\n\t\tif(isset($this->knownCommands[$label]) and $this->knownCommands[$label]->getLabel() !== null and $this->knownCommands[$label]->getLabel() === $label){\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!$isAlias){\n\t\t\t$command->setLabel($label);\n\t\t}\n\n\t\t$this->knownCommands[$label] = $command;\n\n\t\treturn true;\n\t}\n\n\tprivate function dispatchAdvanced(CommandSender $sender, Command $command, $label, array $args, $offset = 0){\n\t\tif(isset($args[$offset])){\n\t\t\t$argsTemp = $args;\n\t\t\tswitch($args[$offset]){\n\t\t\t\tcase \"@a\":\n\t\t\t\t\t$p = $this->server->getOnlinePlayers();\n\t\t\t\t\tif(count($p) <= 0){\n\t\t\t\t\t\t$sender->sendMessage(TextFormat::RED . \"No players online\"); //TODO: add language\n\t\t\t\t\t}else{\n\t\t\t\t\t\tforeach($p as $player){\n\t\t\t\t\t\t\t$argsTemp[$offset] = $player->getName();\n\t\t\t\t\t\t\t$this->dispatchAdvanced($sender, $command, $label, $argsTemp, $offset + 1);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"@r\":\n\t\t\t\t\t$players = $this->server->getOnlinePlayers();\n\t\t\t\t\tif(count($players) > 0){\n\t\t\t\t\t\t$argsTemp[$offset] = $players[array_rand($players)]->getName();\n\t\t\t\t\t\t$this->dispatchAdvanced($sender, $command, $label, $argsTemp, $offset + 1);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase \"@p\":\n\t\t\t\t\tif($sender instanceof Player){\n\t\t\t\t\t\t$argsTemp[$offset] = $sender->getName();\n\t\t\t\t\t\t$this->dispatchAdvanced($sender, $command, $label, $argsTemp, $offset + 1);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$sender->sendMessage(TextFormat::RED . \"You must be a player!\"); //TODO: add language\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$this->dispatchAdvanced($sender, $command, $label, $argsTemp, $offset + 1);\n\t\t\t}\n\t\t}else $command->execute($sender, $label, $args);\n\t}\n\n\tpublic function dispatch(CommandSender $sender, $commandLine){\n\t\t$args = explode(\" \", $commandLine);\n\n\t\tif(count($args) === 0){\n\t\t\treturn false;\n\t\t}\n\n\t\t$sentCommandLabel = strtolower(array_shift($args));\n\t\t$target = $this->getCommand($sentCommandLabel);\n\n\t\tif($target === null){\n\t\t\treturn false;\n\t\t}\n\n\t\t$target->timings->startTiming();\n\t\ttry{\n\t\t\tif($this->server->advancedCommandSelector){\n\t\t\t\t$this->dispatchAdvanced($sender, $target, $sentCommandLabel, $args);\n\t\t\t}else{\n\t\t\t\t$target->execute($sender, $sentCommandLabel, $args);\n\t\t\t}\n\t\t}catch(\\Throwable $e){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.exception\"));\n\t\t\t$this->server->getLogger()->critical($this->server->getLanguage()->translateString(\"pocketmine.command.exception\", [$commandLine, (string) $target, $e->getMessage()]));\n\t\t\t$logger = $sender->getServer()->getLogger();\n\t\t\tif($logger instanceof MainLogger){\n\t\t\t\t$logger->logException($e);\n\t\t\t}\n\t\t}\n\t\t$target->timings->stopTiming();\n\n\t\treturn true;\n\t}\n\n\tpublic function clearCommands(){\n\t\tforeach($this->knownCommands as $command){\n\t\t\t$command->unregister($this);\n\t\t}\n\t\t$this->knownCommands = [];\n\t\t$this->setDefaultCommands();\n\t}\n\n\tpublic function getCommand($name){\n\t\tif(isset($this->knownCommands[$name])){\n\t\t\treturn $this->knownCommands[$name];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @return Command[]\n\t */\n\tpublic function getCommands(){\n\t\treturn $this->knownCommands;\n\t}\n\n\n\t/**\n\t * @return void\n\t */\n\tpublic function registerServerAliases(){\n\t\t$values = $this->server->getCommandAliases();\n\n\t\tforeach($values as $alias => $commandStrings){\n\t\t\tif(strpos($alias, \":\") !== false or strpos($alias, \" \") !== false){\n\t\t\t\t$this->server->getLogger()->warning($this->server->getLanguage()->translateString(\"pocketmine.command.alias.illegal\", [$alias]));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$targets = [];\n\n\t\t\t$bad = \"\";\n\t\t\tforeach($commandStrings as $commandString){\n\t\t\t\t$args = explode(\" \", $commandString);\n\t\t\t\t$command = $this->getCommand($args[0]);\n\n\t\t\t\tif($command === null){\n\t\t\t\t\tif(strlen($bad) > 0){\n\t\t\t\t\t\t$bad .= \", \";\n\t\t\t\t\t}\n\t\t\t\t\t$bad .= $commandString;\n\t\t\t\t}else{\n\t\t\t\t\t$targets[] = $commandString;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(strlen($bad) > 0){\n\t\t\t\t$this->server->getLogger()->warning($this->server->getLanguage()->translateString(\"pocketmine.command.alias.notFound\", [$alias, $bad]));\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t//These registered commands have absolute priority\n\t\t\tif(count($targets) > 0){\n\t\t\t\t$this->knownCommands[strtolower($alias)] = new FormattedCommandAlias(strtolower($alias), $targets);\n\t\t\t}else{\n\t\t\t\tunset($this->knownCommands[strtolower($alias)]);\n\t\t\t}\n\n\t\t}\n\t}\n\n\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/BanCidByNameCommand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass BanCidByNameCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.bancidbyname.description\",\n\t\t\t\"%pocketmine.command.bancidbyname.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.bancidbyname\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$name = array_shift($args);\n\t\t$reason = implode(\" \", $args);\n\t\t\n\t\tif ($sender->getServer()->getPlayer($name) instanceof Player) $target = $sender->getServer()->getPlayer($name);\n\t\telse return false;\n\n\t\t$sender->getServer()->getCIDBans()->addBan($target->getClientId(), $reason, null, $sender->getName());\n\n\t\t$target->kick($reason !== \"\" ? \"Banned by admin. Reason:\" . $reason : \"Banned by admin.\");\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.bancidbyname.success\", [$target !== null ? $target->getName() : $name]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/BanCidCommand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass BanCidCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.bancid.description\",\n\t\t\t\"%pocketmine.command.bancid.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.bancid\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$cid = array_shift($args);\n\t\t$reason = implode(\" \", $args);\n\n\t\t$sender->getServer()->getCIDBans()->addBan($cid, $reason, null, $sender->getName());\n\n\t\t$player = null;\n\n\t\tforeach($sender->getServer()->getOnlinePlayers() as $p){\n\t\t\tif($p->getClientId() == $cid) {\n\t\t\t\t$p->kick($reason !== \"\" ? \"Banned by admin. Reason:\" . $reason : \"Banned by admin.\");\n\t\t\t\t$player = $p;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.bancid.success\", [$player !== null ? $player->getName() : $cid]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/BanCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\n\n\nclass BanCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.ban.player.description\",\n\t\t\t\"%pocketmine.command.ban.player.ban.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.ban.player\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$name = array_shift($args);\n\t\tif(isset($args[0]) and isset($args[1])){\n\t\t\t$reason = $args[0];\n\t\t\tif($args[1] != null and is_numeric($args[1])){\n\t\t\t\t$until = new \\DateTime('@' . ($args[1] * 86400 + time()));\n\t\t\t}else{\n\t\t\t\t$until = null;\n\t\t\t}\n\n\t\t\t$sender->getServer()->getNameBans()->addBan($name, $reason, $until, $sender->getName());\n\t\t}else{\n\t\t\t$sender->getServer()->getNameBans()->addBan($name, $reason = implode(\" \", $args), null, $sender->getName());\n\t\t}\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.ban.success\", [$player !== null ? $player->getName() : $name]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/BanIpByNameCommand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass BanIpByNameCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.banipbyname.description\",\n\t\t\t\"%pocketmine.command.banipbyname.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.banipbyname\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn \\true;\n\t\t}\n\n\t\tif(\\count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn \\false;\n\t\t}\n\n\t\t$name = \\array_shift($args);\n\t\t$reason = \\implode(\" \", $args);\n\t\t\n\t\tif ($sender->getServer()->getPlayer($name) instanceof Player) $target = $sender->getServer()->getPlayer($name);\n\t\telse return \\false;\n\n\t\t$sender->getServer()->getIPBans()->addBan($target->getAddress(), $reason, \\null, $sender->getName());\n\n\t\tif(($player = $sender->getServer()->getPlayerExact($name)) instanceof Player){\n\t\t\t$player->kick($reason !== \"\" ? \"Banned by admin. Reason:\" . $reason : \"Banned by admin.\");\n\t\t}\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.banipbyname.success\", [$player !== \\null ? $player->getName() : $name]));\n\n\t\treturn \\true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/BanIpCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\n\n\nclass BanIpCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.banip.description\",\n\t\t\t\"%pocketmine.command.banip.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.ban.ip\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$value = array_shift($args);\n\t\t$reason = implode(\" \", $args);\n\n\t\tif(preg_match(\"/^([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])$/\", $value)){\n\t\t\t$this->processIPBan($value, $sender, $reason);\n\n\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.banip.success\", [$value]));\n\t\t}else{\n\t\t\tif(($player = $sender->getServer()->getPlayer($value)) instanceof Player){\n\t\t\t\t$this->processIPBan($player->getAddress(), $sender, $reason);\n\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.banip.success.players\", [$player->getAddress(), $player->getName()]));\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.banip.invalid\"));\n\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate function processIPBan($ip, CommandSender $sender, $reason){\n\t\t$sender->getServer()->getIPBans()->addBan($ip, $reason, null, $sender->getName());\n\n\t\tforeach($sender->getServer()->getOnlinePlayers() as $player){\n\t\t\tif($player->getAddress() === $ip){\n\t\t\t\t$player->kick($reason !== \"\" ? $reason : \"IP banned.\");\n\t\t\t}\n\t\t}\n\n\t\t$sender->getServer()->getNetwork()->blockAddress($ip, -1);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/BanListCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Server;\n\n\nclass BanListCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.banlist.description\",\n\t\t\t\"%pocketmine.command.banlist.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.ban.list\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t$args[0] = (isset($args[0]) ? strtolower($args[0]): \"\");\n\t\t$title = \"\";\n\t\t\n\t\tswitch($args[0]){\n\t\t\tcase \"ips\":\n\t\t\t\t$list = $sender->getServer()->getIPBans();\t\n\t\t\t\t$title = \"commands.banlist.ips\";\n\t\t\t\tbreak;\n\t\t\tcase \"cids\":\n\t\t\t\t$list = $list = $sender->getServer()->getCIDBans(); \n\t\t\t\t$title = \"commands.banlist.cids\";\n\t\t\t\tbreak;\n\t\t\tcase \"players\":\n\t\t\t\t$list = $sender->getServer()->getNameBans();\n\t\t\t\t$title = \"commands.banlist.players\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\t\treturn false;\t\t\t\n\t\t}\n\t\t\n\t\t$message = \"\";\n\t\t$list = $list->getEntries();\n\t\tforeach($list as $entry){\n\t\t\t$message .= $entry->getName() . \", \";\n\t\t}\n\t\t\n\t\t$sender->sendMessage(Server::getInstance()->getLanguage()->translateString($title, [count($list)]));\n\t\t$sender->sendMessage(\\substr($message, 0, -2));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/DefaultGamemodeCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Server;\n\n\nclass DefaultGamemodeCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.defaultgamemode.description\",\n\t\t\t\"%pocketmine.command.defaultgamemode.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.defaultgamemode\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$gameMode = Server::getGamemodeFromString($args[0]);\n\n\t\tif($gameMode !== -1){\n\t\t\t$sender->getServer()->setConfigInt(\"gamemode\", $gameMode);\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.defaultgamemode.success\", [Server::getGamemodeString($gameMode)]));\n\t\t}else{\n\t\t\t$sender->sendMessage(\"You entered an unknown gamemode\");\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/DeopCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass DeopCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.deop.description\",\n\t\t\t\"%pocketmine.command.deop.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.op.take\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$name = array_shift($args);\n\n\t\t$player = $sender->getServer()->getOfflinePlayer($name);\n\t\t$player->setOp(false);\n\t\tif($player instanceof Player){\n\t\t\t$player->sendMessage(TextFormat::GRAY . \"You are no longer op!\");\n\t\t}\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.deop.success\", [$player->getName()]));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/DifficultyCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\SetDifficultyPacket;\nuse pocketmine\\Server;\n\n\nclass DifficultyCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.difficulty.description\",\n\t\t\t\"%pocketmine.command.difficulty.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.difficulty\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) !== 1){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$difficulty = Server::getDifficultyFromString($args[0]);\n\n\t\tif($sender->getServer()->isHardcore()){\n\t\t\t$difficulty = 3;\n\t\t}\n\n\t\tif($difficulty !== -1){\n\t\t\t$sender->getServer()->setConfigInt(\"difficulty\", $difficulty);\n\n\t\t\t$pk = new SetDifficultyPacket();\n\t\t\t$pk->difficulty = $sender->getServer()->getDifficulty();\n\t\t\tServer::broadcastPacket($sender->getServer()->getOnlinePlayers(), $pk);\n\n\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.difficulty.success\", [$difficulty]));\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/DumpMemoryCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\command\\Command;\n\n\nclass DumpMemoryCommand extends VanillaCommand{\n\t\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"Dumps the memory\",\n\t\t\t\"/$name [path]\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.dumpmemory\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tCommand::broadcastCommandMessage($sender, \"Dumping server memory\");\n\t\t\n\t\t$sender->getServer()->getMemoryManager()->dumpServerMemory(isset($args[0]) ? $args[0] : $sender->getServer()->getDataPath() . \"/memory_dumps/memoryDump_\".date(\"D_M_j-H.i.s-T_Y\", time()), 48, 80);\n\t\treturn true;\n\t}\n\t\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/EffectCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\InstantEffect;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\utils\\TextFormat;\n\nclass EffectCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.effect.description\",\n\t\t\t\"%pocketmine.command.effect.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.effect;pocketmine.command.effect.other\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn true;\n\t\t}\n\n\t\t$player = $sender->getServer()->getPlayer($args[0]);\n\n\t\tif($player === null){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif($player->getName()!=$sender->getName() && !$sender->hasPermission(\"pocketmine.command.effect.other\")){\n\t\t\t$sender->sendMessage(\"You don't have permission to give effect to other player .\");\n\t\t\treturn true;\n\t\t}\n\n\t\tif(strtolower($args[1]) === \"clear\"){\n\t\t\tforeach($player->getEffects() as $effect){\n\t\t\t\t$player->removeEffect($effect->getId());\n\t\t\t}\n\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.effect.success.removed.all\", [$player->getDisplayName()]));\n\t\t\treturn true;\n\t\t}\n\n\t\t$effect = Effect::getEffectByName($args[1]);\n\n\t\tif($effect === null){\n\t\t\t$effect = Effect::getEffect((int) $args[1]);\n\t\t}\n\n\t\tif($effect === null){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.effect.notFound\", [(string) $args[1]]));\n\t\t\treturn true;\n\t\t}\n\n\t\t$duration = 300;\n\t\t$amplification = 0;\n\n\t\tif(count($args) >= 3){\n\t\t\t$duration = (int) $args[2];\n\t\t\tif(!($effect instanceof InstantEffect)){\n\t\t\t\t$duration *= 20;\n\t\t\t}\n\t\t}elseif($effect instanceof InstantEffect){\n\t\t\t$duration = 1;\n\t\t}\n\n\t\tif(count($args) >= 4){\n\t\t\t$amplification = (int) $args[3];\n\t\t}\n\n\t\tif(count($args) >= 5){\n\t\t\t$v = strtolower($args[4]);\n\t\t\tif($v === \"on\" or $v === \"true\" or $v === \"t\" or $v === \"1\"){\n\t\t\t\t$effect->setVisible(false);\n\t\t\t}\n\t\t}\n\n\t\tif($duration === 0){\n\t\t\tif(!$player->hasEffect($effect->getId())){\n\t\t\t\tif(count($player->getEffects()) === 0){\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.effect.failure.notActive.all\", [$player->getDisplayName()]));\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.effect.failure.notActive\", [$effect->getName(), $player->getDisplayName()]));\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif ($player->removeEffect($effect->getId())) {\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.effect.success.removed\", [$effect->getName(), $player->getDisplayName()]));\n\t\t\t}\n\t\t}else{\n\t\t\t$effect->setDuration($duration)->setAmplifier($amplification);\n\n\t\t\tif ($player->addEffect($effect)) {\n\t\t\t\tself::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.effect.success\", [$effect->getName(), $effect->getId(), $effect->getAmplifier(), $player->getDisplayName(), $effect->getDuration() / 20]));\n\t\t\t}\n\t\t}\n\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/EnchantCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\InstantEffect;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\utils\\TextFormat;\nuse pocketmine\\Server;\n\nclass EnchantCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.enchant.description\",\n\t\t\t\"%pocketmine.command.enchant.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.enchant\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn true;\n\t\t}\n\n\t\t$player = $sender->getServer()->getPlayer($args[0]);\n\n\t\tif($player === null){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\t\t\treturn true;\n\t\t}\n\n\t\t$enchantId = $args[1];\n\t\t$enchantLevel = isset($args[2]) ? (int) $args[2] : 1;\n\n\t\t$enchantment = Enchantment::getEnchantment($enchantId);\n\t\tif($enchantment->getId() === Enchantment::TYPE_INVALID){\n\t\t\t$enchantment = Enchantment::getEnchantmentByName($enchantId);\n\t\t\tif($enchantment->getId() === Enchantment::TYPE_INVALID){\n\t    \t\t$sender->sendMessage(new TranslationContainer(\"commands.enchant.notFound\", [$enchantment->getId()]));\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\t$id = $enchantment->getId();\n\t\t$maxLevel = Enchantment::getEnchantMaxLevel($id);\n\t\tif($enchantLevel > $maxLevel or $enchantLevel <= 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.enchant.maxLevel\", [$maxLevel]));\n\t\t\treturn true;\n\t\t}\n\t\t$enchantment->setLevel($enchantLevel);\n\n\t\t$item = $player->getInventory()->getItemInHand();\n\n\t\tif($item->getId() <= 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.enchant.noItem\"));\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\tif(Enchantment::getEnchantAbility($item) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.enchant.cantEnchant\"));\n\t\t\treturn true;\n\t\t}\n\n\t\t$item->addEnchantment($enchantment);\n\t\t$player->getInventory()->setItemInHand($item);\n\n\n\t\tself::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.enchant.success\"));\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/GamemodeCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\TextFormat;\n\nclass GamemodeCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.gamemode.description\",\n\t\t\t\"%pocketmine.command.gamemode.usage\",\n\t\t\t[\"gm\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.gamemode\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$gameMode = (int) Server::getGamemodeFromString($args[0]);\n\n\t\tif($gameMode === -1){\n\t\t\t$sender->sendMessage(\"Unknown game mode\");\n\n\t\t\treturn true;\n\t\t}\n\n\t\t$target = $sender;\n\t\tif(isset($args[1])){\n\t\t\t$target = $sender->getServer()->getPlayer($args[1]);\n\t\t\tif($target === null){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}elseif(!($sender instanceof Player)){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn true;\n\t\t}\n\n\t\tif($target->setGamemode($gameMode) == false){\n\t\t\t$sender->sendMessage(TextFormat::RED . \"Game mode change for \" . $target->getName() . \" failed!\");\n\t\t}else{\n\t\t\tif($target === $sender){\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.gamemode.success.self\", [' ', ' ', Server::getGamemodeString($gameMode)]));\n\t\t\t}else{\n\t\t\t\t$target->sendMessage(new TranslationContainer(\"gameMode.changed\"));\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.gamemode.success.other\", [$target->getName(), Server::getGamemodeString($gameMode)]));\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/GarbageCollectorCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\utils\\TextFormat;\n\n\nclass GarbageCollectorCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.gc.description\",\n\t\t\t\"%pocketmine.command.gc.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.gc\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$chunksCollected = 0;\n\t\t$entitiesCollected = 0;\n\t\t$tilesCollected = 0;\n\n\t\t$memory = memory_get_usage();\n\n\t\tforeach($sender->getServer()->getLevels() as $level){\n\t\t\t$diff = [count($level->getChunks()), count($level->getEntities()), count($level->getTiles())];\n\t\t\t$level->doChunkGarbageCollection();\n\t\t\t$level->unloadChunks(true);\n\t\t\t$chunksCollected += $diff[0] - count($level->getChunks());\n\t\t\t$entitiesCollected += $diff[1] - count($level->getEntities());\n\t\t\t$tilesCollected += $diff[2] - count($level->getTiles());\n\t\t\t$level->clearCache(true);\n\t\t}\n\n\t\t$cyclesCollected = $sender->getServer()->getMemoryManager()->triggerGarbageCollector();\n\t\t$sender->sendMessage(TextFormat::GREEN . \"---- \" . TextFormat::WHITE . \"%pocketmine.command.gc.title\" . TextFormat::GREEN . \" ----\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.gc.chunks \" . TextFormat::RED . \\number_format($chunksCollected));\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.gc.entities \" . TextFormat::RED . \\number_format($entitiesCollected));\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.gc.tiles \" . TextFormat::RED . \\number_format($tilesCollected));\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.gc.cycles \" . TextFormat::RED . \\number_format($cyclesCollected));\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.gc.memory \" . TextFormat::RED . \\number_format(\\round((($memory - \\memory_get_usage()) / 1024) / 1024, 2)).\" MB\");\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/GiveCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\item\\Item;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass GiveCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.give.description\",\n\t\t\t\"%pocketmine.command.give.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.give\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn true;\n\t\t}\n\n\t\t$player = $sender->getServer()->getPlayer($args[0]);\n\t\t$item = Item::fromString($args[1]);\n\n\t\tif(!isset($args[2])){\n\t\t\t$item->setCount($item->getMaxStackSize());\n\t\t}else{\n\t\t\t$item->setCount((int) $args[2]);\n\t\t}\n\n\t\tif(isset($args[3])){\n\t\t\t$tags = $exception = null;\n\t\t\t$data = implode(\" \", array_slice($args, 3));\n\t\t\ttry{\n\t\t\t\t$tags = NBT::parseJSON($data);\n\t\t\t}catch (\\Throwable $ex){\n\t\t\t\t$exception = $ex;\n\t\t\t}\n\n\t\t\tif(!($tags instanceof CompoundTag) or $exception !== null){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.give.tagError\", [$exception !== null ? $exception->getMessage() : \"Invalid tag conversion\"]));\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$item->setNamedTag($tags);\n\t\t}\n\n\t\tif($player instanceof Player){\n\t\t\tif($item->getId() === 0){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.give.item.notFound\", [$args[1]]));\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t//TODO: overflow\n\t\t\t$player->getInventory()->addItem(clone $item);\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\n\t\t\treturn true;\n\t\t}\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"%commands.give.success\", [\n\t\t\t$item->getName() . \" (\" . $item->getId() . \":\" . $item->getDamage() . \")\",\n\t\t\t(string) $item->getCount(),\n\t\t\t$player->getName()\n\t\t]));\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/HelpCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\command\\ConsoleCommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\utils\\TextFormat;\n\nclass HelpCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.help.description\",\n\t\t\t\"%pocketmine.command.help.usage\",\n\t\t\t[\"?\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.help\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$command = \"\";\n\t\t\t$pageNumber = 1;\n\t\t}elseif(is_numeric($args[count($args) - 1])){\n\t\t\t$pageNumber = (int) array_pop($args);\n\t\t\tif($pageNumber <= 0){\n\t\t\t\t$pageNumber = 1;\n\t\t\t}\n\t\t\t$command = implode(\" \", $args);\n\t\t}else{\n\t\t\t$command = implode(\" \", $args);\n\t\t\t$pageNumber = 1;\n\t\t}\n\n\t\tif($sender instanceof ConsoleCommandSender){\n\t\t\t$pageHeight = PHP_INT_MAX;\n\t\t}else{\n\t\t\t$pageHeight = 7;\n\t\t}\n\n\t\tif($command === \"\"){\n\t\t\t/** @var Command[][] $commands */\n\t\t\t$commands = [];\n\t\t\tforeach($sender->getServer()->getCommandMap()->getCommands() as $command){\n\t\t\t\tif($command->testPermissionSilent($sender)){\n\t\t\t\t\t$commands[$command->getName()] = $command;\n\t\t\t\t}\n\t\t\t}\n\t\t\tksort($commands, SORT_NATURAL | SORT_FLAG_CASE);\n\t\t\t$commands = array_chunk($commands, $pageHeight);\n\t\t\t$pageNumber = (int) min(count($commands), $pageNumber);\n\t\t\tif($pageNumber < 1){\n\t\t\t\t$pageNumber = 1;\n\t\t\t}\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.help.header\", [$pageNumber, count($commands)]));\n\t\t\tif(isset($commands[$pageNumber - 1])){\n\t\t\t\tforeach($commands[$pageNumber - 1] as $command){\n\t\t\t\t\t$sender->sendMessage(TextFormat::DARK_GREEN . \"/\" . $command->getName() . \": \" . TextFormat::WHITE . $command->getDescription());\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}else{\n\t\t\tif(($cmd = $sender->getServer()->getCommandMap()->getCommand(strtolower($command))) instanceof Command){\n\t\t\t\tif($cmd->testPermissionSilent($sender)){\n\t\t\t\t\t$message = TextFormat::YELLOW . \"--------- \" . TextFormat::WHITE . \" Help: /\" . $cmd->getName() . TextFormat::YELLOW . \" ---------\\n\";\n\t\t\t\t\t$message .= TextFormat::GOLD . \"Description: \" . TextFormat::WHITE . $cmd->getDescription() . \"\\n\";\n\t\t\t\t\t$message .= TextFormat::GOLD . \"Usage: \" . TextFormat::WHITE . implode(\"\\n\" . TextFormat::WHITE, explode(\"\\n\", $cmd->getUsage())) . \"\\n\";\n\t\t\t\t\t$sender->sendMessage($message);\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$sender->sendMessage(TextFormat::RED . \"No help for \" . strtolower($command));\n\n\t\t\treturn true;\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/KickCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass KickCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.kick.description\",\n\t\t\t\"%pocketmine.command.kick.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.kick\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$name = array_shift($args);\n\t\t$reason = trim(implode(\" \", $args));\n\n\t\tif(($player = $sender->getServer()->getPlayer($name)) instanceof Player){\n\t\t\t$player->kick($reason);\n\t\t\tif(strlen($reason) >= 1){\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.kick.success.reason\", [$player->getName(), $reason]));\n\t\t\t}else{\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.kick.success\", [$player->getName()]));\n\t\t\t}\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\t\t}\n\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/KillCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass KillCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.kill.description\",\n\t\t\t\"%pocketmine.command.kill.usage\",\n\t\t\t[\"suicide\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.kill.self;pocketmine.command.kill.other\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) >= 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif(count($args) === 1){\n\t\t\tif(!$sender->hasPermission(\"pocketmine.command.kill.other\")){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$player = $sender->getServer()->getPlayer($args[0]);\n\n\t\t\tif($player instanceof Player){\n\t\t\t\t$sender->getServer()->getPluginManager()->callEvent($ev = new EntityDamageEvent($player, EntityDamageEvent::CAUSE_SUICIDE, 1000));\n\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t$player->setLastDamageCause($ev);\n\t\t\t\t$player->setHealth(0);\n\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.kill.successful\", [$player->getName()]));\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\tif($sender instanceof Player){\n\t\t\tif(!$sender->hasPermission(\"pocketmine.command.kill.self\")){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$sender->getServer()->getPluginManager()->callEvent($ev = new EntityDamageEvent($sender, EntityDamageEvent::CAUSE_SUICIDE, 1000));\n\n\t\t\tif($ev->isCancelled()){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$sender->setLastDamageCause($ev);\n\t\t\t$sender->setHealth(0);\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.kill.successful\", [$sender->getName()]));\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/ListCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\n\n\nclass ListCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.list.description\",\n\t\t\t\"%pocketmine.command.players.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.list\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$online = \"\";\n\t\t$onlineCount = 0;\n\n\t\tforeach($sender->getServer()->getOnlinePlayers() as $player){\n\t\t\tif($player->isOnline() and (!($sender instanceof Player) or $sender->canSee($player))){\n\t\t\t\t$online .= $player->getDisplayName() . \", \";\n\t\t\t\t++$onlineCount;\n\t\t\t}\n\t\t}\n\n\t\t$sender->sendMessage(new TranslationContainer(\"commands.players.list\", [$onlineCount, $sender->getServer()->getMaxPlayers()]));\n\t\t$sender->sendMessage(substr($online, 0, -2));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/MeCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass MeCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.me.description\",\n\t\t\t\"%pocketmine.command.me.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.me\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$sender->getServer()->broadcastMessage(new TranslationContainer(\"chat.type.emote\", [$sender instanceof Player ? $sender->getDisplayName() : $sender->getName(), TextFormat::WHITE . implode(\" \", $args)]));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/OpCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass OpCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.op.description\",\n\t\t\t\"%pocketmine.command.op.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.op.give\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$name = array_shift($args);\n\n\t\t$player = $sender->getServer()->getOfflinePlayer($name);\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.op.success\", [$player->getName()]));\n\t\tif($player instanceof Player){\n\t\t\t$player->sendMessage(TextFormat::GRAY . \"You are now op!\");\n\t\t}\n\t\t$player->setOp(true);\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/PardonCidCommand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\utils\\TextFormat;\n\nclass PardonCidCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.unban.cid.description\",\n\t\t\t\"%pocketmine.command.unban.cid.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.pardoncid\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) !== 1){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn false;\n\t\t}\n\n\t\t$sender->getServer()->getCIDBans()->remove($args[0]);\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.unbancid.success\", [$args[0]]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/PardonCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\n\n\nclass PardonCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.unban.player.description\",\n\t\t\t\"%pocketmine.command.unban.player.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.unban.player\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) !== 1){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$sender->getServer()->getNameBans()->remove($args[0]);\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.unban.success\", [$args[0]]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/PardonIpCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\n\n\nclass PardonIpCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.unban.ip.description\",\n\t\t\t\"%pocketmine.command.unban.ip.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.unban.ip\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) !== 1){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif(preg_match(\"/^([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])\\\\.([01]?\\\\d\\\\d?|2[0-4]\\\\d|25[0-5])$/\", $args[0])){\n\t\t\t$sender->getServer()->getIPBans()->remove($args[0]);\n\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.unbanip.success\", [$args[0]]));\n\t\t\t$sender->getServer()->getNetwork()->unblockAddress($args[0]);\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.unbanip.invalid\"));\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/ParticleCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\particle\\AngryVillagerParticle;\nuse pocketmine\\level\\particle\\BubbleParticle;\nuse pocketmine\\level\\particle\\BlockForceFieldParticle;\nuse pocketmine\\level\\particle\\CriticalParticle;\nuse pocketmine\\level\\particle\\DustParticle;\nuse pocketmine\\level\\particle\\EnchantmentTableParticle;\nuse pocketmine\\level\\particle\\EnchantParticle;\nuse pocketmine\\level\\particle\\ExplodeParticle;\nuse pocketmine\\level\\particle\\FlameParticle;\nuse pocketmine\\level\\particle\\HappyVillagerParticle;\nuse pocketmine\\level\\particle\\HeartParticle;\nuse pocketmine\\level\\particle\\HugeExplodeParticle;\nuse pocketmine\\level\\particle\\HugeExplodeSeedParticle;\nuse pocketmine\\level\\particle\\InkParticle;\nuse pocketmine\\level\\particle\\InstantEnchantParticle;\nuse pocketmine\\level\\particle\\ItemBreakParticle;\nuse pocketmine\\level\\particle\\LavaDripParticle;\nuse pocketmine\\level\\particle\\LavaParticle;\nuse pocketmine\\level\\particle\\Particle;\nuse pocketmine\\level\\particle\\PortalParticle;\nuse pocketmine\\level\\particle\\RainSplashParticle;\nuse pocketmine\\level\\particle\\RedstoneParticle;\nuse pocketmine\\level\\particle\\SmokeParticle;\nuse pocketmine\\level\\particle\\SplashParticle;\nuse pocketmine\\level\\particle\\SporeParticle;\nuse pocketmine\\level\\particle\\TerrainParticle;\nuse pocketmine\\level\\particle\\WaterDripParticle;\nuse pocketmine\\level\\particle\\WaterParticle;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\utils\\TextFormat;\n\nclass ParticleCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.particle.description\",\n\t\t\t\"%pocketmine.command.particle.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.particle\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 7){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn true;\n\t\t}\n\n\t\tif($sender instanceof Player){\n\t\t\t$level = $sender->getLevel();\n\t\t}else{\n\t\t\t$level = $sender->getServer()->getDefaultLevel();\n\t\t}\n\n\t\t$name = strtolower($args[0]);\n\n\t\t$pos = new Vector3((float) $args[1], (float) $args[2], (float) $args[3]);\n\n\t\t$xd = (float) $args[4];\n\t\t$yd = (float) $args[5];\n\t\t$zd = (float) $args[6];\n\n\t\t$count = isset($args[7]) ? max(1, (int) $args[7]) : 1;\n\n\t\t$data = isset($args[8]) ? (int) $args[8] : null;\n\n\t\t$particle = $this->getParticle($name, $pos, $xd, $yd, $zd, $data);\n\n\t\tif($particle === null){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.particle.notFound\", [$name]));\n\t\t\treturn true;\n\t\t}\n\n\n\t\t$sender->sendMessage(new TranslationContainer(\"commands.particle.success\", [$name, $count]));\n\n\t\t$random = new Random((int) (microtime(true) * 1000) + mt_rand());\n\n\t\tfor($i = 0; $i < $count; ++$i){\n\t\t\t$particle->setComponents(\n\t\t\t\t$pos->x + $random->nextSignedFloat() * $xd,\n\t\t\t\t$pos->y + $random->nextSignedFloat() * $yd,\n\t\t\t\t$pos->z + $random->nextSignedFloat() * $zd\n\t\t\t);\n\t\t\t$level->addParticle($particle);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\n\t/**\n\t * @param         $name\n\t * @param Vector3 $pos\n\t * @param         $xd\n\t * @param         $yd\n\t * @param         $zd\n\t * @param         $data\n\t * @return null|DustParticle|ItemBreakParticle|TerrainParticle\n\t */\n\tprivate function getParticle($name, Vector3 $pos, $xd, $yd, $zd, $data){\n\t\tswitch($name){\n\t\t\tcase \"explode\":\n\t\t\t\treturn new ExplodeParticle($pos);\n\t\t\tcase \"hugeexplosion\":\n\t\t\t\treturn new HugeExplodeParticle($pos);\n\t\t\tcase \"hugeexplosionseed\":\n\t\t\t\treturn new HugeExplodeSeedParticle($pos);\n\t\t\tcase \"bubble\":\n\t\t\t\treturn new BubbleParticle($pos);\n\t\t\tcase \"splash\":\n\t\t\t\treturn new SplashParticle($pos);\n\t\t\tcase \"wake\":\n\t\t\tcase \"water\":\n\t\t\t\treturn new WaterParticle($pos);\n\t\t\tcase \"crit\":\n\t\t\t\treturn new CriticalParticle($pos);\n\t\t\tcase \"smoke\":\n\t\t\t\treturn new SmokeParticle($pos, $data ?? 0);\n\t\t\tcase \"spell\":\n\t\t\t\treturn new EnchantParticle($pos);\n\t\t\tcase \"instantspell\":\n\t\t\t\treturn new InstantEnchantParticle($pos);\n\t\t\tcase \"dripwater\":\n\t\t\t\treturn new WaterDripParticle($pos);\n\t\t\tcase \"driplava\":\n\t\t\t\treturn new LavaDripParticle($pos);\n\t\t\tcase \"townaura\":\n\t\t\tcase \"spore\":\n\t\t\t\treturn new SporeParticle($pos);\n\t\t\tcase \"portal\":\n\t\t\t\treturn new PortalParticle($pos);\n\t\t\tcase \"flame\":\n\t\t\t\treturn new FlameParticle($pos);\n\t\t\tcase \"lava\":\n\t\t\t\treturn new LavaParticle($pos);\n\t\t\tcase \"reddust\":\n\t\t\t\treturn new RedstoneParticle($pos, $data ?? 1);\n\t\t\tcase \"snowballpoof\":\n\t\t\t\treturn new ItemBreakParticle($pos, Item::get(Item::SNOWBALL));\n\t\t\tcase \"slime\":\n\t\t\t\treturn new ItemBreakParticle($pos, Item::get(Item::SLIMEBALL));\n\t\t\tcase \"itembreak\":\n\t\t\t\tif($data !== null and $data !== 0){\n\t\t\t\t\treturn new ItemBreakParticle($pos, $data);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"terrain\":\n\t\t\t\tif($data !== null and $data !== 0){\n\t\t\t\t\treturn new TerrainParticle($pos, $data);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"heart\":\n\t\t\t\treturn new HeartParticle($pos, $data ?? 0);\n\t\t\tcase \"ink\":\n\t\t\t\treturn new InkParticle($pos, $data ?? 0);\n\t\t\tcase \"droplet\":\n\t\t\t\treturn new RainSplashParticle($pos);\n\t\t\tcase \"enchantmenttable\":\n\t\t\t\treturn new EnchantmentTableParticle($pos);\n\t\t\tcase \"happyvillager\":\n\t\t\t\treturn new HappyVillagerParticle($pos);\n\t\t\tcase \"angryvillager\":\n\t\t\t\treturn new AngryVillagerParticle($pos);\n\t\t\tcase \"forcefield\":\n\t\t\t\treturn new BlockForceFieldParticle($pos, $data ?? 0);\n\n\t\t}\n\n\t\tif(substr($name, 0, 10) === \"iconcrack_\"){\n\t\t\t$d = explode(\"_\", $name);\n\t\t\tif(count($d) === 3){\n\t\t\t\treturn new ItemBreakParticle($pos, Item::get((int) $d[1], (int) $d[2]));\n\t\t\t}\n\t\t}elseif(substr($name, 0, 11) === \"blockcrack_\"){\n\t\t\t$d = explode(\"_\", $name);\n\t\t\tif(count($d) === 2){\n\t\t\t\treturn new TerrainParticle($pos, Block::get($d[1] & 0xff, $d[1] >> 12));\n\t\t\t}\n\t\t}elseif(substr($name, 0, 10) === \"blockdust_\"){\n\t\t\t$d = explode(\"_\", $name);\n\t\t\tif(count($d) >= 4){\n\t\t\t\treturn new DustParticle($pos, $d[1] & 0xff, $d[2] & 0xff, $d[3] & 0xff, isset($d[4]) ? $d[4] & 0xff : 255);\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/PluginsCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\utils\\TextFormat;\n\nclass PluginsCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.plugins.description\",\n\t\t\t\"%pocketmine.command.plugins.usage\",\n\t\t\t[\"pl\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.plugins\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\t\t$this->sendPluginList($sender);\n\t\treturn true;\n\t}\n\n\tprivate function sendPluginList(CommandSender $sender){\n\t\t$list = \"\";\n\t\tforeach(($plugins = $sender->getServer()->getPluginManager()->getPlugins()) as $plugin){\n\t\t\tif(strlen($list) > 0){\n\t\t\t\t$list .= TextFormat::WHITE . \", \";\n\t\t\t}\n\t\t\t$list .= $plugin->isEnabled() ? TextFormat::GREEN : TextFormat::RED;\n\t\t\t$list .= $plugin->getDescription()->getFullName();\n\t\t}\n\n\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.plugins.success\", [count($plugins), $list]));\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/ReloadCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\utils\\TextFormat;\n\nclass ReloadCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.reload.description\",\n\t\t\t\"%pocketmine.command.reload.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.reload\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(TextFormat::YELLOW . \"%pocketmine.command.reload.reloading\"));\n\n\t\t$sender->getServer()->reload();\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(TextFormat::YELLOW . \"%pocketmine.command.reload.reloaded\"));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/SaveCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\n\n\nclass SaveCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.save.description\",\n\t\t\t\"%pocketmine.command.save.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.save.perform\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.save.start\"));\n\n\t\tforeach($sender->getServer()->getOnlinePlayers() as $player){\n\t\t\t$player->save();\n\t\t}\n\n\t\tforeach($sender->getServer()->getLevels() as $level){\n\t\t\t$level->save(true);\n\t\t}\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.save.success\"));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/SaveOffCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\n\n\nclass SaveOffCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.saveoff.description\",\n\t\t\t\"%pocketmine.command.saveoff.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.save.disable\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$sender->getServer()->setAutoSave(false);\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.save.disabled\"));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/SaveOnCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\n\n\nclass SaveOnCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.saveon.description\",\n\t\t\t\"%pocketmine.command.saveon.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.save.enable\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$sender->getServer()->setAutoSave(true);\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.save.enabled\"));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/SayCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\command\\ConsoleCommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass SayCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.say.description\",\n\t\t\t\"%pocketmine.command.say.usage\",\n\t\t\t[\"broadcast\", \"announce\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.say\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$sender->getServer()->broadcastMessage(new TranslationContainer(TextFormat::LIGHT_PURPLE . \"%chat.type.announcement\", [$sender instanceof Player ? $sender->getDisplayName() : ($sender instanceof ConsoleCommandSender ? \"Server\" : $sender->getName()), TextFormat::LIGHT_PURPLE . implode(\" \", $args)]));\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/SeedCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\n\n\nclass SeedCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.seed.description\",\n\t\t\t\"%pocketmine.command.seed.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.seed\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif($sender instanceof Player){\n\t\t\t$seed = $sender->getLevel()->getSeed();\n\t\t}else{\n\t\t\t$seed = $sender->getServer()->getDefaultLevel()->getSeed();\n\t\t}\n\t\t$sender->sendMessage(new TranslationContainer(\"commands.seed.success\", [$seed]));\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/SetBlockCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\block\\Block;\nuse pocketmine\\item\\ItemBlock;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\n\nclass SetBlockCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.setblock.description\",\n\t\t\t\"%pocketmine.command.setblock.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.setblock\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 4 or count($args) > 5){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn false;\n\t\t}\n\n\t\t$itemblock = Item::fromString($args[3]);\n\t\tif($itemblock instanceof ItemBlock){\n\t\t\t$block = $itemblock->getBlock();\n\t\t\tif(isset($args[4]) and is_numeric($args[4])) $block->setDamage((int)$args[4]);\n\n\t\t\t$x = $args[0];\n\t\t\t$y = $args[1];\n\t\t\t$z = $args[2];\n\n\t\t\tif($x{0} === \"~\"){\n\t\t\t\tif((is_numeric(trim($x, \"~\")) or trim($x, \"~\") === \"\") and ($sender instanceof Player)) $x = (int)round(trim($x, \"~\") + $sender->x);\n\t\t\t}elseif(is_numeric($x)){\n\t\t\t\t$x = (int)round($x);\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif($y{0} === \"~\"){\n\t\t\t\tif((is_numeric(trim($y, \"~\")) or trim($y, \"~\") === \"\") and ($sender instanceof Player)) $y = (int)round(trim($y, \"~\") + $sender->y);\n\t\t\t\tif($y < 0 or $y > 256) return false;\n\t\t\t}elseif(is_numeric($y)){\n\t\t\t\t$y = (int)round($y);\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif($z{0} === \"~\"){\n\t\t\t\tif((is_numeric(trim($z, \"~\")) or trim($z, \"~\") === \"\") and ($sender instanceof Player)) $z = (int)round(trim($z, \"~\") + $sender->z);\n\t\t\t}elseif(is_numeric($z)){\n\t\t\t\t$z = (int)round($z);\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(!(is_integer($x) and is_integer($y) and is_integer($z))){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$pos = new Vector3($x, $y, $z);\n\t\t\tif($pos instanceof Vector3){\n\t\t\t\t$level = ($sender instanceof Player) ? $sender->getLevel() : $sender->getServer()->getDefaultLevel();\n\t\t\t\tif($level->setBlock($pos, $block)){\n\t\t\t\t\t$sender->sendMessage(\"Successfully set the block at ($x, $y, $z) to block $args[3]\");\n\t\t\t\t\treturn true;\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage(TextFormat::RED . new TranslationContainer(\"commands.generic.exception\", []));\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$sender->sendMessage(TextFormat::RED . new TranslationContainer(\"command.setblock.invalidBlock\", []));\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/SetWorldSpawnCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass SetWorldSpawnCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.setworldspawn.description\",\n\t\t\t\"%pocketmine.command.setworldspawn.usage\",\n\t\t\t[\"setspawn\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.setworldspawn\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$level = $sender->getLevel();\n\t\t\t\t$pos = (new Vector3($sender->x, $sender->y, $sender->z))->round();\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"You can only perform this command as a player\");\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}elseif(count($args) === 3){\n\t\t\t$level = $sender->getServer()->getDefaultLevel();\n\t\t\t$pos = new Vector3($this->getInteger($sender, $args[0]), $this->getInteger($sender, $args[1]), $this->getInteger($sender, $args[2]));\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn true;\n\t\t}\n\n\t\t$level->setSpawnLocation($pos);\n\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.setworldspawn.success\", [round($pos->x, 2), round($pos->y, 2), round($pos->z, 2)]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/SpawnpointCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\level\\Position;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass SpawnpointCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.spawnpoint.description\",\n\t\t\t\"%pocketmine.command.spawnpoint.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.spawnpoint\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$target = null;\n\n\t\tif(count($args) === 0){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$target = $sender;\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Please provide a player!\");\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}else{\n\t\t\t$target = $sender->getServer()->getPlayer($args[0]);\n\t\t\tif($target === null){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t$level = $target->getLevel();\n\n\t\tif(count($args) === 4){\n\t\t\tif($level !== null){\n\t\t\t\t$pos = $sender instanceof Player ? $sender->getPosition() : $level->getSpawnLocation();\n\t\t\t\t$x = (int) $this->getRelativeDouble($pos->x, $sender, $args[1]);\n\t\t\t\t$y = $this->getRelativeDouble($pos->y, $sender, $args[2], 0, 128);\n\t\t\t\t$z = $this->getRelativeDouble($pos->z, $sender, $args[3]);\n\t\t\t\t$target->setSpawn(new Position($x, $y, $z, $level));\n\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.spawnpoint.success\", [$target->getName(), round($x, 2), round($y, 2), round($z, 2)]));\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}elseif(count($args) <= 1){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$pos = new Position((int) $sender->x, (int) $sender->y, (int) $sender->z, $sender->getLevel());\n\t\t\t\t$target->setSpawn($pos);\n\n\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.spawnpoint.success\", [$target->getName(), round($pos->x, 2), round($pos->y, 2), round($pos->z, 2)]));\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Please provide a player!\");\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/StatusCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\nuse pocketmine\\utils\\Utils;\n\nclass StatusCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.status.description\",\n\t\t\t\"%pocketmine.command.status.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.status\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$mUsage = Utils::getMemoryUsage(true);\n\t\t$rUsage = Utils::getRealMemoryUsage();\n\n\t\t$server = $sender->getServer();\n\t\t$onlineCount = 0;\n\t\tforeach($sender->getServer()->getOnlinePlayers() as $player){\n\t\t\tif($player->isOnline() and (!($sender instanceof Player) or $sender->canSee($player))){\n\t\t\t\t++$onlineCount;\n\t\t\t}\n\t\t}\n\t\t$sender->sendMessage(TextFormat::GREEN . \"---- \" . TextFormat::WHITE . \"%pocketmine.command.status.title\" . TextFormat::GREEN . \" ----\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.player\" . TextFormat::GREEN .\" \". $onlineCount . \"/\" . $sender->getServer()->getMaxPlayers());\n\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.uptime \" . TextFormat::RED . $sender->getServer()->getUptime());\n\n\t\t$tpsColor = TextFormat::GREEN;\n\t\tif($server->getTicksPerSecondAverage() < 10){\n\t\t\t$tpsColor = TextFormat::GOLD;\n\t\t}elseif($server->getTicksPerSecondAverage() < 1){\n\t\t\t$tpsColor = TextFormat::RED;\n\t\t}\n\n\t\t$tpsColour = TextFormat::GREEN;\n\t\tif($server->getTicksPerSecond() < 10){\n\t\t\t$tpsColour = TextFormat::GOLD;\n\t\t}elseif($server->getTicksPerSecond() < 1){\n\t\t\t$tpsColour = TextFormat::RED;\n\t\t}\n\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.AverageTPS \" . $tpsColor . $server->getTicksPerSecondAverage() . \" (\" . $server->getTickUsageAverage() . \"%)\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.CurrentTPS \" . $tpsColour . $server->getTicksPerSecond() . \" (\" . $server->getTickUsage() . \"%)\");\n\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Networkupload \" . TextFormat::RED . \\round($server->getNetwork()->getUpload() / 1024, 2) . \" kB/s\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Networkdownload \" . TextFormat::RED . \\round($server->getNetwork()->getDownload() / 1024, 2) . \" kB/s\");\n\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Threadcount \" . TextFormat::RED . Utils::getThreadCount());\n\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Mainmemory \" . TextFormat::RED . number_format(round(($mUsage[0] / 1024) / 1024, 2)) . \" MB.\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Totalmemory \" . TextFormat::RED . number_format(round(($mUsage[1] / 1024) / 1024, 2)) . \" MB.\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Totalvirtualmemory \" . TextFormat::RED . number_format(round(($mUsage[2] / 1024) / 1024, 2)) . \" MB.\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Heapmemory \" . TextFormat::RED . number_format(round(($rUsage[0] / 1024) / 1024, 2)) . \" MB.\");\n\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Maxmemorysystem \" . TextFormat::RED . number_format(round(($mUsage[2] / 1024) / 1024, 2)) . \" MB.\");\n\n\t\tif($server->getProperty(\"memory.global-limit\") > 0){\n\t\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.Maxmemorymanager \" . TextFormat::RED . number_format(round($server->getProperty(\"memory.global-limit\"), 2)) . \" MB.\");\n\t\t}\n\t\tforeach($server->getLevels() as $level){\n\t\t\t$sender->sendMessage(TextFormat::GOLD . \"%pocketmine.command.status.World \\\"\" . $level->getFolderName() . \"\\\"\" . ($level->getFolderName() !== $level->getName() ? \" (\" . $level->getName() . \")\" : \"\") . \": \" .\n\t\t\t\tTextFormat::RED . number_format(count($level->getChunks())) . TextFormat::GREEN . \" %pocketmine.command.status.chunks \" .\n\t\t\t\tTextFormat::RED . number_format(count($level->getEntities())) . TextFormat::GREEN . \" %pocketmine.command.status.entities \" .\n\t\t\t\tTextFormat::RED . number_format(count($level->getTiles())) . TextFormat::GREEN . \" %pocketmine.command.status.tiles \" .\n\t\t\t\t\"%pocketmine.command.status.Time \" . (($level->getTickRate() > 1 or $level->getTickRateTime() > 40) ? TextFormat::RED : TextFormat::YELLOW) . round($level->getTickRateTime(), 2) . \"%pocketmine.command.status.ms\" . ($level->getTickRate() > 1 ? \" (tick rate \" . $level->getTickRate() . \")\" : \"\")\n\t\t\t);\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/StopCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\n\n\nclass StopCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.stop.description\",\n\t\t\t\"%pocketmine.command.stop.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.stop\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\t\t$restart = false;\n\t\tif(isset($args[0])){\n\t\t\tif($args[0] == 'force'){\n\t\t\t\t$restart = true;\n\t\t\t\tarray_shift($args);\n\t\t\t}else{\n\t\t\t\t$restart = false;\n\t\t\t}\n\t\t}\n\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.stop.start\"));\n\t\t$msg = implode(\" \", $args);\n\t\t$sender->getServer()->shutdown($restart, $msg);\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/SummonCommand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\Player;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\utils\\TextFormat;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\n\nclass SummonCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.summon.description\",\n\t\t\t\"%pocketmine.command.summon.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.summon\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) != 1 and count($args) != 4 and count($args) != 5){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn true;\n\t\t}\n\n\t\t$x = 0;\n\t\t$y = 0;\n\t\t$z = 0;\n\t\tif(count($args) == 4 or count($args) == 5){            //position is set\n\t\t\t//TODO:simpilify them to one piece of code\n\t\t\t//Code for setting $x\n\t\t\tif(is_numeric($args[1])){                            //x is given directly\n\t\t\t\t$x = $args[1];\n\t\t\t}elseif(strcmp($args[1], \"~\") >= 0){    //x is given with a \"~\"\n\t\t\t\t$offset_x = trim($args[1], \"~\");\n\t\t\t\tif($sender instanceof Player){            //using in-game\n\t\t\t\t\t$x = is_numeric($offset_x) ? ($sender->x + $offset_x) : $sender->x;\n\t\t\t\t}else{                                                            //using in console\n\t\t\t\t\t$sender->sendMessage(TextFormat::RED . \"You must specify a position where the entity is spawned to when using in console\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}else{                                                                //other circumstances\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Argument error\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t//Code for setting $y\n\t\t\tif(is_numeric($args[2])){                            //y is given directly\n\t\t\t\t$y = $args[2];\n\t\t\t}elseif(strcmp($args[2], \"~\") >= 0){    //y is given with a \"~\"\n\t\t\t\t$offset_y = trim($args[2], \"~\");\n\t\t\t\tif($sender instanceof Player){            //using in-game\n\t\t\t\t\t$y = is_numeric($offset_y) ? ($sender->y + $offset_y) : $sender->y;\n\t\t\t\t\t$y = min(128, max(0, $y));\n\t\t\t\t}else{                                                            //using in console\n\t\t\t\t\t$sender->sendMessage(TextFormat::RED . \"You must specify a position where the entity is spawned to when using in console\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}else{                                                                //other circumstances\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Argument error\");\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t//Code for setting $z\n\t\t\tif(is_numeric($args[3])){                            //z is given directly\n\t\t\t\t$z = $args[3];\n\t\t\t}elseif(strcmp($args[3], \"~\") >= 0){    //z is given with a \"~\"\n\t\t\t\t$offset_z = trim($args[3], \"~\");\n\t\t\t\tif($sender instanceof Player){            //using in-game\n\t\t\t\t\t$z = is_numeric($offset_z) ? ($sender->z + $offset_z) : $sender->z;\n\t\t\t\t}else{                                                            //using in console\n\t\t\t\t\t$sender->sendMessage(TextFormat::RED . \"You must specify a position where the entity is spawned to when using in console\");\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}else{                                                                //other circumstances\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Argument error\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}    //finish setting the location\n\n\t\tif(count($args) == 1){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$x = $sender->x;\n\t\t\t\t$y = $sender->y;\n\t\t\t\t$z = $sender->z;\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"You must specify a position where the entity is spawned to when using in console\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t} //finish setting the location\n\n\t\t$entity = null;\n\t\t$type = $args[0];\n\t\t$level = ($sender instanceof Player) ? $sender->getLevel() : $sender->getServer()->getDefaultLevel();\n\t\t$chunk = $level->getChunk($x >> 4, $z >> 4, true);\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\tnew DoubleTag(\"\", $x),\n\t\t\t\tnew DoubleTag(\"\", $y),\n\t\t\t\tnew DoubleTag(\"\", $z)\n\t\t\t]),\n\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t]),\n\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\tnew FloatTag(\"\", lcg_value() * 360),\n\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t]),\n\t\t]);\n\t\tif(count($args) == 5 and $args[4]{0} == \"{\"){//Tags are found\n\t\t\t$nbtExtra = NBT::parseJSON($args[4]);\n\t\t\t$nbt = NBT::combineCompoundTags($nbt, $nbtExtra, true);\n\t\t}\n\n\t\t$entity = Entity::createEntity($type, $chunk, $nbt);\n\t\tif($entity instanceof Entity){\n\t\t\t$entity->spawnToAll();\n\t\t\t$sender->sendMessage(\"Successfully spawned entity $type at ($x, $y, $z)\");\n\t\t\treturn true;\n\t\t}else{\n\t\t\t$sender->sendMessage(TextFormat::RED . \"An error occurred when spawning the entity $type\");\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/TeleportCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass TeleportCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.tp.description\",\n\t\t\t\"%pocketmine.command.tp.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.teleport\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 1 or count($args) > 6){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn true;\n\t\t}\n\n\t\t$target = null;\n\t\t$origin = $sender;\n\n\t\tif(count($args) === 1 or count($args) === 3){\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$target = $sender;\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Please provide a player!\");\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(count($args) === 1){\n\t\t\t\t$target = $sender->getServer()->getPlayer($args[0]);\n\t\t\t\tif($target === null){\n\t\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Can't find player \" . $args[0]);\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$target = $sender->getServer()->getPlayer($args[0]);\n\t\t\tif($target === null){\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Can't find player \" . $args[0]);\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif(count($args) === 2){\n\t\t\t\t$origin = $target;\n\t\t\t\t$target = $sender->getServer()->getPlayer($args[1]);\n\t\t\t\tif($target === null){\n\t\t\t\t\t$sender->sendMessage(TextFormat::RED . \"Can't find player \" . $args[1]);\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(count($args) < 3){\n\t\t\t$origin->teleport($target);\n\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.tp.success\", [$origin->getName(), $target->getName()]));\n\n\t\t\treturn true;\n\t\t}elseif($target->getLevel() !== null){\n\t\t\tif(count($args) === 4 or count($args) === 6){\n\t\t\t\t$pos = 1;\n\t\t\t}else{\n\t\t\t\t$pos = 0;\n\t\t\t}\n\n\t\t\t$x = $this->getRelativeDouble($target->x, $sender, $args[$pos++]);\n\t\t\t$y = $this->getRelativeDouble($target->y, $sender, $args[$pos++], 0, 256);\n\t\t\t$z = $this->getRelativeDouble($target->z, $sender, $args[$pos++]);\n\t\t\t$yaw = $target->getYaw();\n\t\t\t$pitch = $target->getPitch();\n\n\t\t\tif(count($args) === 6 or (count($args) === 5 and $pos === 3)){\n\t\t\t\t$yaw = $args[$pos++];\n\t\t\t\t$pitch = $args[$pos++];\n\t\t\t}\n\n\t\t\t$target->teleport(new Vector3($x, $y, $z), $yaw, $pitch);\n\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.tp.success.coordinates\", [$target->getName(), round($x, 2), round($y, 2), round($z, 2)]));\n\n\t\t\treturn true;\n\t\t}\n\n\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/TellCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass TellCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.tell.description\",\n\t\t\t\"%pocketmine.command.tell.usage\",\n\t\t\t[\"w\", \"whisper\", \"msg\", \"m\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.tell\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\t$name = strtolower(array_shift($args));\n\n\t\t$player = $sender->getServer()->getPlayer($name);\n\n\t\tif($player === $sender){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.message.sameTarget\"));\n\t\t\treturn true;\n\t\t}\n\n\t\tif($player instanceof Player){\n\t\t\t$sender->sendMessage(\"[\".$sender->getName().\" -> \" . $player->getDisplayName() . \"] \" . implode(\" \", $args));\n\t\t\t$player->sendMessage(\"[\" . ($sender instanceof Player ? $sender->getDisplayName() : $sender->getName()) . \" -> \".$player->getName().\"] \" . implode(\" \", $args));\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.player.notFound\"));\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/TimeCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass TimeCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.time.description\",\n\t\t\t\"%pocketmine.command.time.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.time.add;pocketmine.command.time.set;pocketmine.command.time.start;pocketmine.command.time.stop\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(count($args) < 1){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif($args[0] === \"start\"){\n\t\t\tif(!$sender->hasPermission(\"pocketmine.command.time.start\")){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tforeach($sender->getServer()->getLevels() as $level){\n\t\t\t\t$level->checkTime();\n\t\t\t\t$level->startTime();\n\t\t\t\t$level->checkTime();\n\t\t\t}\n\t\t\tCommand::broadcastCommandMessage($sender, \"Restarted the time\");\n\t\t\treturn true;\n\t\t}elseif($args[0] === \"stop\"){\n\t\t\tif(!$sender->hasPermission(\"pocketmine.command.time.stop\")){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tforeach($sender->getServer()->getLevels() as $level){\n\t\t\t\t$level->checkTime();\n\t\t\t\t$level->stopTime();\n\t\t\t\t$level->checkTime();\n\t\t\t}\n\t\t\tCommand::broadcastCommandMessage($sender, \"Stopped the time\");\n\t\t\treturn true;\n\t\t}elseif($args[0] === \"query\"){\n\t\t\tif(!$sender->hasPermission(\"pocketmine.command.time.query\")){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif($sender instanceof Player){\n\t\t\t\t$level = $sender->getLevel();\n\t\t\t}else{\n\t\t\t\t$level = $sender->getServer()->getDefaultLevel();\n\t\t\t}\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.time.query\", [$level->getTime()]));\n\t\t\treturn true;\n\t\t}\n\n\n\t\tif(count($args) < 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif($args[0] === \"set\"){\n\t\t\tif(!$sender->hasPermission(\"pocketmine.command.time.set\")){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif($args[1] === \"day\"){\n\t\t\t\t$value = 0;\n\t\t\t}elseif($args[1] === \"night\"){\n\t\t\t\t$value = Level::TIME_NIGHT;\n\t\t\t}else{\n\t\t\t\t$value = $this->getInteger($sender, $args[1], 0);\n\t\t\t}\n\n\t\t\tforeach($sender->getServer()->getLevels() as $level){\n\t\t\t\t$level->checkTime();\n\t\t\t\t$level->setTime($value);\n\t\t\t\t$level->checkTime();\n\t\t\t}\n\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.time.set\", [$value]));\n\t\t}elseif($args[0] === \"add\"){\n\t\t\tif(!$sender->hasPermission(\"pocketmine.command.time.add\")){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$value = $this->getInteger($sender, $args[1], 0);\n\t\t\tforeach($sender->getServer()->getLevels() as $level){\n\t\t\t\t$level->checkTime();\n\t\t\t\t$level->setTime($level->getTime() + $value);\n\t\t\t\t$level->checkTime();\n\t\t\t}\n\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.time.added\", [$value]));\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t}\n\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/TimingsCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TimingsHandler;\nuse pocketmine\\event\\TranslationContainer;\n\n\nclass TimingsCommand extends VanillaCommand{\n\n\tpublic static $timingStart = 0;\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.timings.description\",\n\t\t\t\"%pocketmine.command.timings.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.timings\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) !== 1){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn true;\n\t\t}\n\n\t\t$mode = strtolower($args[0]);\n\n\t\tif($mode === \"on\"){\n\t\t\t$sender->getServer()->getPluginManager()->setUseTimings(true);\n\t\t\tTimingsHandler::reload();\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.enable\"));\n\n\t\t\treturn true;\n\t\t}elseif($mode === \"off\"){\n\t\t\t$sender->getServer()->getPluginManager()->setUseTimings(false);\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.disable\"));\n\t\t\treturn true;\n\t\t}\n\n\t\tif(!$sender->getServer()->getPluginManager()->useTimings()){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.timingsDisabled\"));\n\n\t\t\treturn true;\n\t\t}\n\n\t\t$paste = $mode === \"paste\";\n\n\t\tif($mode === \"reset\"){\n\t\t\tTimingsHandler::reload();\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.reset\"));\n\t\t}elseif($mode === \"merged\" or $mode === \"report\" or $paste){\n\n\t\t\t$sampleTime = microtime(true) - self::$timingStart;\n\t\t\t$index = 0;\n\t\t\t$timingFolder = $sender->getServer()->getDataPath() . \"timings/\";\n\n\t\t\tif(!file_exists($timingFolder)){\n\t\t\t\tmkdir($timingFolder, 0777);\n\t\t\t}\n\t\t\t$timings = $timingFolder . \"timings.txt\";\n\t\t\twhile(file_exists($timings)){\n\t\t\t\t$timings = $timingFolder . \"timings\" . (++$index) . \".txt\";\n\t\t\t}\n\n\t\t\t$fileTimings = $paste ? fopen(\"php://temp\", \"r+b\") : fopen($timings, \"a+b\");\n\n\t\t\tTimingsHandler::printTimings($fileTimings);\n\n\t\t\tfwrite($fileTimings, \"Sample time \" . round($sampleTime * 1000000000) . \" (\" . $sampleTime . \"s)\" . PHP_EOL);\n\n\t\t\tif($paste){\n\t\t\t\tfseek($fileTimings, 0);\n\t\t\t\t$data = [\n\t\t\t\t\t\"syntax\" => \"text\",\n\t\t\t\t\t\"poster\" => $sender->getServer()->getName(),\n\t\t\t\t\t\"content\" => stream_get_contents($fileTimings)\n\t\t\t\t];\n\n\t\t\t\t$ch = curl_init(\"http://paste.ubuntu.com/\");\n\t\t\t\tcurl_setopt($ch, CURLOPT_POST, 1);\n\t\t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\t\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n\t\t\t\tcurl_setopt($ch, CURLOPT_FORBID_REUSE, 1);\n\t\t\t\tcurl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);\n\t\t\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $data);\n\t\t\t\tcurl_setopt($ch, CURLOPT_AUTOREFERER, false);\n\t\t\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, false);\n\t\t\t\tcurl_setopt($ch, CURLOPT_HEADER, true);\n\t\t\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, [\"User-Agent: \" . $this->getName() . \" \" . $sender->getServer()->getPocketMineVersion()]);\n\t\t\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\t\t\t$data = curl_exec($ch);\n\t\t\t\tcurl_close($ch);\n\t\t\t\tif(preg_match('#^Location: http://paste\\\\.ubuntu\\\\.com/([0-9]{1,})/#m', $data, $matches) == 0){\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.pasteError\"));\n\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.timingsUpload\", [\"http://paste.ubuntu.com/\" . $matches[1] . \"/\"]));\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.timingsRead\", [\"http://timings.aikar.co/?url=\" . $matches[1]]));\n\t\t\t\tfclose($fileTimings);\n\t\t\t}else{\n\t\t\t\tfclose($fileTimings);\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.timings.timingsWrite\", [$timings]));\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/TransferCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author H4PM Team\n * @link http://www.github.net/H4PM\n * \n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\network\\protocol\\TransferPacket;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\command\\Command;\nuse pocketmine\\Server;\nuse pocketmine\\Player;\n\nclass TransferCommand extends VanillaCommand{\n\t\n    public function __construct($name){\n        parent::__construct(\n        $name,\n        \"%pocketmine.command.transfer.description\",\n        \"%pocketmine.command.transfer.usage\",\n        [\"transfer\"]\n        );\n        $this->setPermission(\"pocketmine.command.transfer\");\n    }\n\n    public function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\t\t\n        if(!$sender instanceof Player){\n            $sender->sendMessage(\"Run command in-game\");\n            return;\n        }\n\t\t\n        if(!isset($args[0]) || !isset($args[1])){\n            $sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n            return false;\n        }\n\n        $sender->sendMessage(\"Transferring you to $args[0]\".\":\".$args[1]);\n        $pk = new TransferPacket();\n        $pk->address = $args[0];\n        $pk->port = $args[1];\n        $sender->dataPacket($pk);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/VanillaCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\n\nabstract class VanillaCommand extends Command{\n\tconst MAX_COORD = 30000000;\n\tconst MIN_COORD = -30000000;\n\n\tpublic function __construct($name, $description = \"\", $usageMessage = null, array $aliases = []){\n\t\tparent::__construct($name, $description, $usageMessage, $aliases);\n\t}\n\n\tprotected function getInteger(CommandSender $sender, $value, $min = self::MIN_COORD, $max = self::MAX_COORD){\n\t\t$i = (int) $value;\n\n\t\tif($i < $min){\n\t\t\t$i = $min;\n\t\t}elseif($i > $max){\n\t\t\t$i = $max;\n\t\t}\n\n\t\treturn $i;\n\t}\n\n\tprotected function getRelativeDouble($original, CommandSender $sender, $input, $min = self::MIN_COORD, $max = self::MAX_COORD){\n\t\tif($input{0} === \"~\"){\n\t\t\t$value = $this->getDouble($sender, substr($input, 1));\n\n\t\t\treturn $original + $value;\n\t\t}\n\n\t\treturn $this->getDouble($sender, $input, $min, $max);\n\t}\n\n\tprotected function getDouble(CommandSender $sender, $value, $min = self::MIN_COORD, $max = self::MAX_COORD){\n\t\t$i = (double) $value;\n\n\t\tif($i < $min){\n\t\t\t$i = $min;\n\t\t}elseif($i > $max){\n\t\t\t$i = $max;\n\t\t}\n\n\t\treturn $i;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/VersionCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\network\\protocol\\Info;\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\utils\\TextFormat;\n\nclass VersionCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.version.description\",\n\t\t\t\"%pocketmine.command.version.usage\",\n\t\t\t[\"ver\", \"about\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.version\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn \\true;\n\t\t}\n\n\t\tif(\\count($args) === 0){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.server.info.extended.title\"));\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.server.info.extended1\", [\n\t\t\t\t\t\t\t\t\t\t\t$sender->getServer()->getName(), \n\t\t\t\t\t\t\t\t\t\t\t$sender->getServer()->getFormattedVersion(\"-\"),\n\t\t\t\t\t\t\t\t\t\t\t$sender->getServer()->getCodename()\n\t\t\t]));\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.server.info.extended2\", [\n\t\t\t\t\t\t\t\t\t\t\tphpversion()\n\t\t\t]));\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.server.info.extended3\", [\n\t\t\t\t\t\t\t\t\t\t\t$sender->getServer()->getApiVersion()\n\t\t\t\n\t\t\t]));\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.server.info.extended4\", [\n\t\t\t\t\t\t\t\t\t\t\t$sender->getServer()->getVersion()\t\t\t\t\t\t\t\t\t\t\t \n\t\t\t]));\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.server.info.extended5\", [\n\t\t\t\t\t\t\t\t\t\t\tInfo::CURRENT_PROTOCOL\n\t\t\t]));\n\t\t}else{\n\t\t\t$pluginName = \\implode(\" \", $args);\n\t\t\t$exactPlugin = $sender->getServer()->getPluginManager()->getPlugin($pluginName);\n\n\t\t\tif($exactPlugin instanceof Plugin){\n\t\t\t\t$this->describeToSender($exactPlugin, $sender);\n\n\t\t\t\treturn \\true;\n\t\t\t}\n\n\t\t\t$found = \\false;\n\t\t\t$pluginName = \\strtolower($pluginName);\n\t\t\tforeach($sender->getServer()->getPluginManager()->getPlugins() as $plugin){\n\t\t\t\tif(\\stripos($plugin->getName(), $pluginName) !== \\false){\n\t\t\t\t\t$this->describeToSender($plugin, $sender);\n\t\t\t\t\t$found = \\true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!$found){\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.version.noSuchPlugin\"));\n\t\t\t}\n\t\t}\n\n\t\treturn \\true;\n\t}\n\n\tprivate function describeToSender(Plugin $plugin, CommandSender $sender){\n\t\t$desc = $plugin->getDescription();\n\t\t$sender->sendMessage(TextFormat::DARK_GREEN . $desc->getName() . TextFormat::WHITE . \" version \" . TextFormat::DARK_GREEN . $desc->getVersion());\n\n\t\tif($desc->getDescription() != \\null){\n\t\t\t$sender->sendMessage($desc->getDescription());\n\t\t}\n\n\t\tif($desc->getWebsite() != \\null){\n\t\t\t$sender->sendMessage(\"Website: \" . $desc->getWebsite());\n\t\t}\n\n\t\tif(\\count($authors = $desc->getAuthors()) > 0){\n\t\t\tif(\\count($authors) === 1){\n\t\t\t\t$sender->sendMessage(\"Author: \" . \\implode(\", \", $authors));\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(\"Authors: \" . \\implode(\", \", $authors));\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/command/defaults/WeatherCommand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\weather\\Weather;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass WeatherCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.weather.description\",\n\t\t\t\"%pocketmine.command.weather.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.weather\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 1){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\n\t\t\treturn false;\n\t\t}\n\n\t\tif($sender instanceof Player){\n\t\t\t$wea = Weather::getWeatherFromString($args[0]);\n\t\t\tif(!isset($args[1])) $duration = mt_rand(min($sender->getServer()->weatherRandomDurationMin, $sender->getServer()->weatherRandomDurationMax), max($sender->getServer()->weatherRandomDurationMin, $sender->getServer()->weatherRandomDurationMax));\n\t\t\telse $duration = (int) $args[1];\n\t\t\tif($wea >= 0 and $wea <= 3){\n\t\t\t\t$sender->getLevel()->getWeather()->setWeather($wea, $duration);\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.weather.changed\", [$sender->getLevel()->getFolderName()]));\n\t\t\t\treturn true;\n\t\t\t\t/*if(WeatherManager::isRegistered($sender->getLevel())){\n\t\t\t\t\t$sender->getLevel()->getWeather()->setWeather($wea, $duration);\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.weather.changed\", [$sender->getLevel()->getFolderName()]));\n\t\t\t\t\treturn true;\n\t\t\t\t}else{\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.weather.noregistered\", [$sender->getLevel()->getFolderName()]));\n\t\t\t\t\treturn false;\n\t\t\t\t}*/\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(TextFormat::RED . \"%pocketmine.command.weather.invalid\");\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif(count($args) < 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn false;\n\t\t}\n\n\t\t$level = $sender->getServer()->getLevelByName($args[0]);\n\t\tif(!$level instanceof Level){\n\t\t\t$sender->sendMessage(TextFormat::RED . \"%pocketmine.command.weather.invalid.level\");\n\t\t\treturn false;\n\t\t}\n\n\t\t$wea = Weather::getWeatherFromString($args[1]);\n\t\tif(!isset($args[1])) $duration = mt_rand(min($sender->getServer()->weatherRandomDurationMin, $sender->getServer()->weatherRandomDurationMax), max($sender->getServer()->weatherRandomDurationMin, $sender->getServer()->weatherRandomDurationMax));\n\t\telse $duration = (int) $args[1];\n\t\tif($wea >= 0 and $wea <= 3){\n\t\t\t$level->getWeather()->setWeather($wea, $duration);\n\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.weather.changed\", [$level->getFolderName()]));\n\t\t\treturn true;\n\t\t\t/*if(WeatherManager::isRegistered($level)){\n\t\t\t\t$level->getWeather()->setWeather($wea, $duration);\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.weather.changed\", [$level->getFolderName()]));\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$sender->sendMessage(new TranslationContainer(\"pocketmine.command.weather.noregistered\", [$level->getFolderName()]));\n\t\t\t\treturn false;\n\t\t\t}*/\n\t\t}else{\n\t\t\t$sender->sendMessage(TextFormat::RED . \"%pocketmine.command.weather.invalid\");\n\t\t\treturn false;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/WhitelistCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\utils\\TextFormat;\n\nclass WhitelistCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.whitelist.description\",\n\t\t\t\"%pocketmine.command.whitelist.usage\",\n\t\t\t[\"wl\"]\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.whitelist.reload;pocketmine.command.whitelist.enable;pocketmine.command.whitelist.disable;pocketmine.command.whitelist.list;pocketmine.command.whitelist.add;pocketmine.command.whitelist.remove\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 0 or count($args) > 2){\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) === 1){\n\t\t\tif($this->badPerm($sender, strtolower($args[0]))){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tswitch(strtolower($args[0])){\n\t\t\t\tcase \"reload\":\n\t\t\t\t\t$sender->getServer()->reloadWhitelist();\n\t\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.whitelist.reloaded\"));\n\n\t\t\t\t\treturn true;\n\t\t\t\tcase \"on\":\n\t\t\t\t\t$sender->getServer()->setConfigBool(\"white-list\", true);\n\t\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.whitelist.enabled\"));\n\n\t\t\t\t\treturn true;\n\t\t\t\tcase \"off\":\n\t\t\t\t\t$sender->getServer()->setConfigBool(\"white-list\", false);\n\t\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.whitelist.disabled\"));\n\n\t\t\t\t\treturn true;\n\t\t\t\tcase \"list\":\n\t\t\t\t\t$result = \"\";\n\t\t\t\t\t$count = 0;\n\t\t\t\t\tforeach($sender->getServer()->getWhitelisted()->getAll(true) as $player){\n\t\t\t\t\t\t$result .= $player . \", \";\n\t\t\t\t\t\t++$count;\n\t\t\t\t\t}\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.whitelist.list\", [$count, $count]));\n\t\t\t\t\t$sender->sendMessage(substr($result, 0, -2));\n\n\t\t\t\t\treturn true;\n\n\t\t\t\tcase \"add\":\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [\"%commands.whitelist.add.usage\"]));\n\t\t\t\t\treturn true;\n\n\t\t\t\tcase \"remove\":\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [\"%commands.whitelist.remove.usage\"]));\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}elseif(count($args) === 2){\n\t\t\tif($this->badPerm($sender, strtolower($args[0]))){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tswitch(strtolower($args[0])){\n\t\t\t\tcase \"add\":\n\t\t\t\t\t$sender->getServer()->getOfflinePlayer($args[1])->setWhitelisted(true);\n\t\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.whitelist.add.success\", [$args[1]]));\n\n\t\t\t\t\treturn true;\n\t\t\t\tcase \"remove\":\n\t\t\t\t\t$sender->getServer()->getOfflinePlayer($args[1])->setWhitelisted(false);\n\t\t\t\t\tCommand::broadcastCommandMessage($sender, new TranslationContainer(\"commands.whitelist.remove.success\", [$args[1]]));\n\n\t\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate function badPerm(CommandSender $sender, $perm){\n\t\tif(!$sender->hasPermission(\"pocketmine.command.whitelist.$perm\")){\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.permission\"));\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/command/defaults/XpCommand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\command\\defaults;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\command\\ConsoleCommandSender;\nuse pocketmine\\event\\TranslationContainer;\nuse pocketmine\\level\\sound\\ExpPickupSound;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass XpCommand extends VanillaCommand{\n\n\tpublic function __construct($name){\n\t\tparent::__construct(\n\t\t\t$name,\n\t\t\t\"%pocketmine.command.xp.description\",\n\t\t\t\"%pocketmine.command.xp.usage\"\n\t\t);\n\t\t$this->setPermission(\"pocketmine.command.xp\");\n\t}\n\n\tpublic function execute(CommandSender $sender, $currentAlias, array $args){\n\t\tif(!$this->testPermission($sender)){\n\t\t\treturn true;\n\t\t}\n\n\t\tif(count($args) < 2){\n\t\t\tif($sender instanceof ConsoleCommandSender){\n\t\t\t\t$sender->sendMessage(\"You must specify a target player in the console\");\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t$player = $sender;\n\t\t}else{\n\t\t\t$player = $sender->getServer()->getPlayer($args[1]);\n\t\t}\n\t\tif($player instanceof Player){\n\t\t\t$name = $player->getName();\n\t\t\tif(count($args) < 1){\n\t\t\t\t$player->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\tif(strcasecmp(substr($args[0], -1), \"L\") == 0){ //Set Experience Level(with \"L\" after args[0])\n\t\t\t\t$level = (int) rtrim($args[0], \"Ll\");\n\t\t\t\tif($level > 0){\n\t\t\t\t\t$player->addXpLevel((int) $level);\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"%commands.xp.success.levels\", [$level, $name]));\n\t\t\t\t\t$player->getLevel()->addSound(new ExpPickupSound($player, mt_rand(0, 1000))); //TODO: Find the level-up sound\n\t\t\t\t\treturn true;\n\t\t\t\t}elseif($level < 0){\n\t\t\t\t\t$player->takeXpLevel((int) -$level);\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"%commands.xp.success.negative.levels\", [-$level, $name]));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(($xp = (int) $args[0]) > 0){ //Set Experience\n\t\t\t\t\t$player->addXp((int) $args[0]);\n\t\t\t\t\t$player->getLevel()->addSound(new ExpPickupSound($player, mt_rand(0, 1000)));\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"%commands.xp.success\", [$name, $args[0]]));\n\t\t\t\t\treturn true;\n\t\t\t\t}elseif($xp < 0){ //Stupid, but this lines up with vanilla behaviour, so...\n\t\t\t\t\t$sender->sendMessage(new TranslationContainer(\"%commands.xp.failure.withdrawXp\"));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t//This statement will only be reached if the command failed\n\t\t\t$sender->sendMessage(new TranslationContainer(\"commands.generic.usage\", [$this->usageMessage]));\n\t\t\treturn false;\n\t\t}else{\n\t\t\t$sender->sendMessage(new TranslationContainer(TextFormat::RED . \"%commands.generic.player.notFound\"));\n\t\t\treturn false;\n\t\t}\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Ageable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface Ageable{\n\tpublic function isBaby();\n}"
  },
  {
    "path": "src/pocketmine/entity/Animal.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nabstract class Animal extends Creature implements Ageable{\n\n\tpublic function isBaby(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BABY);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Arrow.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____            _        _   __  __ _                  __  __ ____  \r\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \r\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\r\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \r\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author PocketMine Team\r\n * @link http://www.pocketmine.net/\r\n * \r\n *\r\n*/\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\item\\Potion;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\level\\particle\\CriticalParticle;\r\nuse pocketmine\\level\\particle\\MobSpellParticle;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\nbt\\tag\\ShortTag;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Player;\r\n\r\nclass Arrow extends Projectile{\r\n\tconst NETWORK_ID = 80;\r\n\r\n\tpublic $width = 0.5;\r\n\tpublic $length = 0.5;\r\n\tpublic $height = 0.5;\r\n\r\n\tprotected $gravity = 0.05;\r\n\tprotected $drag = 0.01;\r\n\r\n\tprotected $damage = 2;\r\n\r\n\tprotected $isCritical;\r\n\tprotected $potionId;\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null, $critical = false){\r\n\t\t$this->isCritical = (bool) $critical;\r\n\t\tif(!isset($nbt->Potion)){\r\n\t\t\t$nbt->Potion = new ShortTag(\"Potion\", 0);\r\n\t\t}\r\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\r\n\t\t$this->potionId = $this->namedtag[\"Potion\"];\r\n\t}\r\n\r\n\tpublic function getPotionId() : int{\r\n\t\treturn $this->potionId;\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$this->timings->startTiming();\r\n\r\n\t\t$hasUpdate = parent::onUpdate($currentTick);\r\n\r\n\t\tif(!$this->hadCollision and $this->isCritical){\r\n\t\t\t$this->level->addParticle(new CriticalParticle($this->add(\r\n\t\t\t\t$this->width / 2 + mt_rand(-100, 100) / 500,\r\n\t\t\t\t$this->height / 2 + mt_rand(-100, 100) / 500,\r\n\t\t\t\t$this->width / 2 + mt_rand(-100, 100) / 500)));\r\n\t\t}elseif($this->onGround){\r\n\t\t\t$this->isCritical = false;\r\n\t\t}\r\n\r\n\t\tif($this->potionId != 0){\r\n\t\t\tif(!$this->onGround or ($this->onGround and ($currentTick % 4) == 0)){\r\n\t\t\t\t$color = Potion::getColor($this->potionId - 1);\r\n\t\t\t\t$this->level->addParticle(new MobSpellParticle($this->add(\r\n\t\t\t\t\t$this->width / 2 + mt_rand(-100, 100) / 500,\r\n\t\t\t\t\t$this->height / 2 + mt_rand(-100, 100) / 500,\r\n\t\t\t\t\t$this->width / 2 + mt_rand(-100, 100) / 500), $color[0], $color[1], $color[2]));\r\n\t\t\t}\r\n\t\t\t$hasUpdate = true;\r\n\t\t}\r\n\r\n\t\tif($this->age > 1200){\r\n\t\t\t$this->kill();\r\n\t\t\t$hasUpdate = true;\r\n\t\t}\r\n\r\n\t\t$this->timings->stopTiming();\r\n\r\n\t\treturn $hasUpdate;\r\n\t}\r\n\r\n\tpublic function isCritical(){\r\n\t    return $this->isCritical;\r\n    }\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->type = Arrow::NETWORK_ID;\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}"
  },
  {
    "path": "src/pocketmine/entity/Attachable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface Attachable{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Attribute.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\Server;\n\nclass Attribute{\n\n\tconst ABSORPTION = 0;\n\tconst SATURATION = 1;\n\tconst EXHAUSTION = 2;\n\tconst KNOCKBACK_RESISTANCE = 3;\n\tconst HEALTH = 4;\n\tconst MOVEMENT_SPEED = 5;\n\tconst FOLLOW_RANGE = 6;\n\tconst HUNGER = 7;\n\tconst FOOD = 7;\n\tconst ATTACK_DAMAGE = 8;\n\tconst EXPERIENCE_LEVEL = 9;\n\tconst EXPERIENCE = 10;\n\n\tprivate $id;\n\tprotected $minValue;\n\tprotected $maxValue;\n\tprotected $defaultValue;\n\tprotected $currentValue;\n\tprotected $name;\n\tprotected $shouldSend;\n\n\tprotected $desynchronized = true;\n\n\t/** @var Attribute[] */\n\tprotected static $attributes = [];\n\n\tpublic static function init(){\n\t\tself::addAttribute(self::ABSORPTION, \"minecraft:absorption\", 0.00, 340282346638528859811704183484516925440.00, 0.00);\n\t\tself::addAttribute(self::SATURATION, \"minecraft:player.saturation\", 0.00, 20.00, 5.00);\n\t\tself::addAttribute(self::EXHAUSTION, \"minecraft:player.exhaustion\", 0.00, 5.00, 0.41);\n\t\tself::addAttribute(self::KNOCKBACK_RESISTANCE, \"minecraft:knockback_resistance\", 0.00, 1.00, 0.00);\n\t\tself::addAttribute(self::HEALTH, \"minecraft:health\", 0.00, 20.00, 20.00);\n\t\tself::addAttribute(self::MOVEMENT_SPEED, \"minecraft:movement\", 0.00, 340282346638528859811704183484516925440.00, 0.10);\n\t\tself::addAttribute(self::FOLLOW_RANGE, \"minecraft:follow_range\", 0.00, 2048.00, 16.00, false);\n\t\tself::addAttribute(self::HUNGER, \"minecraft:player.hunger\", 0.00, 20.00, 20.00);\n\t\tself::addAttribute(self::ATTACK_DAMAGE, \"minecraft:attack_damage\", 0.00, 340282346638528859811704183484516925440.00, 1.00, false);\n\t\tself::addAttribute(self::EXPERIENCE_LEVEL, \"minecraft:player.level\", 0.00, 24791.00, 0.00);\n\t\tself::addAttribute(self::EXPERIENCE, \"minecraft:player.experience\", 0.00, 1.00, 0.00);\n\t\t//TODO: minecraft:luck (for fishing?)\n\t}\n\n\t/**\n\t * @param int    $id\n\t * @param string $name\n\t * @param float  $minValue\n\t * @param float  $maxValue\n\t * @param float  $defaultValue\n\t * @param bool   $shouldSend\n\t *\n\t * @return Attribute\n\t */\n\tpublic static function addAttribute($id, $name, $minValue, $maxValue, $defaultValue, $shouldSend = true){\n\t\tif($minValue > $maxValue or $defaultValue > $maxValue or $defaultValue < $minValue){\n\t\t\tthrow new \\InvalidArgumentException(\"Invalid ranges: min value: $minValue, max value: $maxValue, $defaultValue: $defaultValue\");\n\t\t}\n\n\t\treturn self::$attributes[(int) $id] = new Attribute($id, $name, $minValue, $maxValue, $defaultValue, $shouldSend);\n\t}\n\n\t/**\n\t * @param $id\n\t *\n\t * @return null|Attribute\n\t */\n\tpublic static function getAttribute($id){\n\t\treturn isset(self::$attributes[$id]) ? clone self::$attributes[$id] : null;\n\t}\n\n\t/**\n\t * @param $name\n\t *\n\t * @return null|Attribute\n\t */\n\tpublic static function getAttributeByName($name){\n\t\tforeach(self::$attributes as $a){\n\t\t\tif($a->getName() === $name){\n\t\t\t\treturn clone $a;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate function __construct($id, $name, $minValue, $maxValue, $defaultValue, $shouldSend = true){\n\t\t$this->id = (int) $id;\n\t\t$this->name = (string) $name;\n\t\t$this->minValue = (float) $minValue;\n\t\t$this->maxValue = (float) $maxValue;\n\t\t$this->defaultValue = (float) $defaultValue;\n\t\t$this->shouldSend = (bool) $shouldSend;\n\n\t\t$this->currentValue = $this->defaultValue;\n\t}\n\n\tpublic function getMinValue(){\n\t\treturn $this->minValue;\n\t}\n\n\tpublic function setMinValue($minValue){\n\t\tif($minValue > $this->getMaxValue()){\n\t\t\tthrow new \\InvalidArgumentException(\"Value $minValue is bigger than the maxValue!\");\n\t\t}\n\n\t\tif($this->minValue != $minValue){\n\t\t\t$this->desynchronized = true;\n\t\t\t$this->minValue = $minValue;\n\t\t}\n\t\treturn $this;\n\t}\n\n\tpublic function getMaxValue(){\n\t\treturn $this->maxValue;\n\t}\n\n\tpublic function setMaxValue($maxValue){\n\t\tif($maxValue < $this->getMinValue()){\n\t\t\tthrow new \\InvalidArgumentException(\"Value $maxValue is bigger than the minValue!\");\n\t\t}\n\n\t\tif($this->maxValue != $maxValue){\n\t\t\t$this->desynchronized = true;\n\t\t\t$this->maxValue = $maxValue;\n\t\t}\n\t\treturn $this;\n\t}\n\n\tpublic function getDefaultValue(){\n\t\treturn $this->defaultValue;\n\t}\n\n\tpublic function setDefaultValue($defaultValue){\n\t\tif($defaultValue > $this->getMaxValue() or $defaultValue < $this->getMinValue()){\n\t\t\tthrow new \\InvalidArgumentException(\"Value $defaultValue exceeds the range!\");\n\t\t}\n\n\t\tif($this->defaultValue !== $defaultValue){\n\t\t\t$this->desynchronized = true;\n\t\t\t$this->defaultValue = $defaultValue;\n\t\t}\n\t\treturn $this;\n\t}\n\n\tpublic function getValue(){\n\t\treturn $this->currentValue;\n\t}\n\n\tpublic function setValue($value, bool $fit = true, bool $shouldSend = false){\n\t\tif($value > $this->getMaxValue() or $value < $this->getMinValue()){\n\t\t\tif(!$fit){\n\t\t\t\tServer::getInstance()->getLogger()->error(\"[Attribute / {$this->getName()}] Value $value exceeds the range!\");\n\t\t\t}\n\t\t\t$value = min(max($value, $this->getMinValue()), $this->getMaxValue());\n\t\t}\n\n\t\tif($this->currentValue != $value){\n\t\t\t$this->desynchronized = true;\n\t\t\t$this->currentValue = $value;\n\t\t}\n\n\t\tif($shouldSend){\n\t\t\t$this->desynchronized = true;\n\t\t}\n\t\treturn $this;\n\t}\n\n\tpublic function getName(){\n\t\treturn $this->name;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function isSyncable(){\n\t\treturn $this->shouldSend;\n\t}\n\n\tpublic function isDesynchronized() : bool{\n\t\treturn $this->shouldSend and $this->desynchronized;\n\t}\n\n\tpublic function markSynchronized(bool $synced = true){\n\t\t$this->desynchronized = !$synced;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/AttributeMap.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\entity;\n\nclass AttributeMap implements \\ArrayAccess{\n\t/** @var Attribute[] */\n\tprivate $attributes = [];\n\n\tpublic function addAttribute(Attribute $attribute){\n\t\t$this->attributes[$attribute->getId()] = $attribute;\n\t}\n\n\t/**\n\t * @param int $id\n\t *\n\t * @return Attribute|null\n\t */\n\tpublic function getAttribute(int $id){\n\t\treturn $this->attributes[$id] ?? null;\n\t}\n\n\tpublic function getAll(): array{\n\t\treturn $this->attributes;\n\t}\n\n\t/**\n\t * @return Attribute[]\n\t */\n\tpublic function needSend() : array{\n\t\treturn array_filter($this->attributes, function (Attribute $attribute){\n\t\t\treturn $attribute->isSyncable() and $attribute->isDesynchronized();\n\t\t});\n\t}\n\n\tpublic function offsetExists($offset){\n\t\treturn isset($this->attributes[$offset]);\n\t}\n\n\tpublic function offsetGet($offset){\n\t\treturn $this->attributes[$offset]->getValue();\n\t}\n\n\tpublic function offsetSet($offset, $value){\n\t\t$this->attributes[$offset]->setValue($value);\n\t}\n\n\tpublic function offsetUnset($offset){\n\t\tthrow new \\RuntimeException(\"Could not unset an attribute from an attribute map\");\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Bat.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\nbt\\tag\\ByteTag;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\Player;\r\n\r\nclass Bat extends FlyingAnimal{\r\n\r\n\tconst NETWORK_ID = 19;\r\n\r\n\tconst DATA_IS_RESTING = 16;\r\n\r\n\tpublic $width = 0.6;\r\n\tpublic $length = 0.6;\r\n\tpublic $height = 0.6;\r\n\r\n\tpublic $flySpeed = 0.8;\r\n\tpublic $switchDirectionTicks = 100;\r\n\r\n\tpublic function getName() {\r\n\t\treturn \"Bat\";\r\n\t}\r\n\r\n\tpublic function initEntity(){\r\n\t\t$this->setMaxHealth(6);\r\n\t\tparent::initEntity();\r\n\t}\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\r\n\t\tif(!isset($nbt->isResting)){\r\n\t\t\t$nbt->isResting = new ByteTag(\"isResting\", 0);\r\n\t\t}\r\n\t\tparent::__construct($chunk, $nbt);\r\n\r\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_RESTING, $this->isResting());\r\n\t}\r\n\r\n\tpublic function isResting() : int{\r\n\t\treturn (int) $this->namedtag[\"isResting\"];\r\n\t}\r\n\r\n\tpublic function setResting(bool $resting){\r\n\t\t$this->namedtag->isResting = new ByteTag(\"isResting\", $resting ? 1 : 0);\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif ($this->age > 20 * 60 * 10) {\r\n\t\t\t$this->kill();\r\n\t\t}\r\n\t\treturn parent::onUpdate($currentTick);\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->type = Bat::NETWORK_ID;\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->yaw = $this->yaw;\r\n\t\t$pk->pitch = $this->pitch;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}"
  },
  {
    "path": "src/pocketmine/entity/Blaze.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Blaze extends Monster{\n\tconst NETWORK_ID = 43;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.8;\n\n\tpublic $dropExp = [10, 10];\n\t\n\tpublic function getName(){\n\t\treturn \"Blaze\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = self::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\t\tparent::spawnTo($player);\n\t}\n\n\tpublic function getDrops(){\n\t\t$cause = $this->lastDamageCause;\n\t\t//Only drop when kill by player or dog(No add now.)\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\n\t\t\t$drops = array(ItemItem::get(ItemItem::BLAZE_ROD, 0, mt_rand(0, 1 + $lootingL)));\n\t\t\treturn $drops;\n\t\t}\n\t\treturn [];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Boat.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\nbt\\tag\\IntTag;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Player;\r\nuse pocketmine\\math\\Vector3;\r\nuse pocketmine\\event\\entity\\EntityDamageEvent;\r\nuse pocketmine\\network\\protocol\\EntityEventPacket;\r\nuse pocketmine\\item\\Item as ItemItem;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\n\r\nclass Boat extends Vehicle{\r\n\tconst NETWORK_ID = 90;\r\n\r\n\tpublic $height = 0.7;\r\n\tpublic $width = 1.6;\r\n\r\n\tpublic $gravity = 0.5;\r\n\tpublic $drag = 0.1;\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\r\n\t\tif(!isset($nbt->WoodID)){\r\n\t\t\t$nbt->WoodID = new IntTag(\"WoodID\", 0);\r\n\t\t}\r\n\t\tparent::__construct($chunk, $nbt);\r\n\t\t$this->setDataProperty(self::DATA_VARIANT, self::DATA_TYPE_INT, $this->getWoodID());\r\n\t}\r\n\r\n\tpublic function getWoodID() : int{\r\n\t\treturn (int) $this->namedtag[\"WoodID\"];\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->type = Boat::NETWORK_ID;\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = 0;\r\n\t\t$pk->speedY = 0;\r\n\t\t$pk->speedZ = 0;\r\n\t\t$pk->yaw = 0;\r\n\t\t$pk->pitch = 0;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n\r\n\tpublic function attack($damage, EntityDamageEvent $source){\r\n\t\tparent::attack($damage, $source);\r\n\r\n\t\tif(!$source->isCancelled()){\r\n\t\t\t$pk = new EntityEventPacket();\r\n\t\t\t$pk->eid = $this->id;\r\n\t\t\t$pk->event = EntityEventPacket::HURT_ANIMATION;\r\n\t\t\tforeach($this->getLevel()->getPlayers() as $player){\r\n\t\t\t\t$player->dataPacket($pk);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\r\n\t\tif($tickDiff <= 0 and !$this->justCreated){\r\n\t\t\treturn true;\r\n\t\t}\r\n\r\n\t\t$this->lastUpdate = $currentTick;\r\n\r\n\t\t$this->timings->startTiming();\r\n\r\n\t\t$hasUpdate = $this->entityBaseTick($tickDiff);\r\n\r\n\t\tif(!$this->level->getBlock(new Vector3($this->x,$this->y,$this->z))->getBoundingBox()==null or $this->isInsideOfWater()){\r\n\t\t\t$this->motionY = 0.1;\r\n\t\t}else{\r\n\t\t\t$this->motionY = -0.08;\r\n\t\t}\r\n\r\n\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\r\n\t\t$this->updateMovement();\r\n\r\n\t\tif($this->linkedEntity == null or $this->linkedType = 0){\r\n\t\t\tif($this->age > 1500){\r\n\t\t\t\t$this->close();\r\n\t\t\t\t$hasUpdate = true;\r\n\t\t\t\t//$this->scheduleUpdate();\r\n\r\n\t\t\t\t$this->age = 0;\r\n\t\t\t}\r\n\t\t\t$this->age++;\r\n\t\t}else $this->age = 0;\r\n\r\n\t\t$this->timings->stopTiming();\r\n\r\n\r\n\t\treturn $hasUpdate or !$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\r\n\t}\r\n\r\n\r\n\tpublic function getDrops(){\r\n\t\treturn [\r\n\t\t\tItemItem::get(ItemItem::BOAT, 0, 1)\r\n\t\t];\r\n\t}\r\n\r\n\tpublic function getSaveId(){\r\n\t\t$class = new \\ReflectionClass(static::class);\r\n\t\treturn $class->getShortName();\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/entity/CaveSpider.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass CaveSpider extends Monster{\n\tconst NETWORK_ID = 40;\n\n\tpublic $width = 1;\n\tpublic $length = 1;\n\tpublic $height = 0.5;\n\n\tpublic $dropExp = [5, 5];\n\n\tpublic function getName(){\n\t\treturn \"Cave Spider\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = CaveSpider::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Chicken.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Chicken extends Animal{\n\tconst NETWORK_ID = 10;\n\n\tpublic $width = 0.6;\n\tpublic $length = 0.6;\n\tpublic $height = 1.8;\n\n\tpublic $dropExp = [1, 3];\n\t\n\tpublic function getName(){\n\t\treturn \"Chicken\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Chicken::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t$drops = [];\n\t\tif ($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player) {\n\t\t\t\n\t\t\t\tswitch (\\mt_rand(0, 2)) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::RAW_CHICKEN, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::FEATHER, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::FEATHER, 0, 2);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t}\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Colorable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface Colorable{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Cow.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Cow extends Animal{\n\tconst NETWORK_ID = 11;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.8;\n\n\tpublic $dropExp = [1, 3];\n\t\n\tpublic function getName(){\n\t\treturn \"Cow\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Cow::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t$lootingL = 0;\n\t\t$cause = $this->lastDamageCause;\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\n\t\t}\n\t\t$drops = array(ItemItem::get(ItemItem::RAW_BEEF, 0, mt_rand(1, 3 + $lootingL)));\n\t\t$drops[] = ItemItem::get(ItemItem::LEATHER, 0, mt_rand(0, 2 + $lootingL));\n\t\t//TODO: add judgement for Steak\n\t\t/*if ($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player) {\n\t\t\t$drops[] = ItemItem::get(ItemItem::LEATHER, 0, mt_rand(0,2));\n\t\t}*/\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Creature.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\n\nabstract class Creature extends Living{\n\tpublic $attackingTick = 0;\n\n\tpublic function onUpdate($tick){\n\t\tif(!$this instanceof Human){\n\t\t\tif($this->attackingTick > 0){\n\t\t\t\t$this->attackingTick--;\n\t\t\t}\n\t\t\tif(!$this->isAlive() and $this->hasSpawned){\n\t\t\t\t++$this->deadTicks;\n\t\t\t\tif($this->deadTicks >= 20){\n\t\t\t\t\t$this->despawnFromAll();\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\tif($this->isAlive()){\n\n\t\t\t\t$this->motionY -= $this->gravity;\n\n\t\t\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\n\n\t\t\t\t$friction = 1 - $this->drag;\n\n\t\t\t\tif($this->onGround and (abs($this->motionX) > 0.00001 or abs($this->motionZ) > 0.00001)){\n\t\t\t\t\t$friction = $this->getLevel()->getBlock($this->temporalVector->setComponents((int) floor($this->x), (int) floor($this->y - 1), (int) floor($this->z) - 1))->getFrictionFactor() * $friction;\n\t\t\t\t}\n\n\t\t\t\t$this->motionX *= $friction;\n\t\t\t\t$this->motionY *= 1 - $this->drag;\n\t\t\t\t$this->motionZ *= $friction;\n\n\t\t\t\tif($this->onGround){\n\t\t\t\t\t$this->motionY *= -0.5;\n\t\t\t\t}\n\n\t\t\t\t$this->updateMovement();\n\t\t\t}\n\t\t}\n\t\tparent::entityBaseTick();\n\t\treturn parent::onUpdate($tick);\n\t}\n\n\tpublic function willMove($distance = 36){\n\t\tforeach($this->getViewers() as $viewer){\n\t\t\tif($this->distance($viewer->getLocation()) <= $distance) return true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tparent::attack($damage, $source);\n\t\tif(!$source->isCancelled() and $source->getCause() == EntityDamageEvent::CAUSE_ENTITY_ATTACK){\n\t\t\t$this->attackingTick = 20;\n\t\t}\n\t}\n\n\t/**\n\t * @param Level   $level\n\t * @param Vector3 $v3\n\t * @param bool    $hate\n\t * @param bool    $reason\n\t * @return bool|float|string\n\t * 判断某坐标是否可以行走\n\t * 并给出原因\n\t */\n\tpublic function ifjump(Level $level, Vector3 $v3, $hate = false, $reason = false){  //boybook Y轴算法核心函数\n\t\t$x = floor($v3->getX());\n\t\t$y = floor($v3->getY());\n\t\t$z = floor($v3->getZ());\n\n\t\t//echo ($y.\" \");\n\t\tif($this->whatBlock($level, new Vector3($x, $y, $z)) == \"air\"){\n\t\t\t//echo \"前方空气 \";\n\t\t\tif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == \"block\" or new Vector3($x, $y - 1, $z) == \"climb\"){  //方块\n\t\t\t\t//echo \"考虑向前 \";\n\t\t\t\tif($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"block\" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"half\" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"high\"){  //上方一格被堵住了\n\t\t\t\t\t//echo \"上方卡住 \\n\";\n\t\t\t\t\tif($reason) return 'up!';\n\t\t\t\t\treturn false;  //上方卡住\n\t\t\t\t}else{\n\t\t\t\t\t//echo \"GO向前走 \\n\";\n\t\t\t\t\tif($reason) return 'GO';\n\t\t\t\t\treturn $y;  //向前走\n\t\t\t\t}\n\t\t\t}elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == \"water\"){  //水\n\t\t\t\t//echo \"下水游泳 \\n\";\n\t\t\t\tif($reason) return 'swim';\n\t\t\t\treturn $y - 1;  //降低一格向前走（下水游泳）\n\t\t\t}elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == \"half\"){  //半砖\n\t\t\t\t//echo \"下到半砖 \\n\";\n\t\t\t\tif($reason) return 'half';\n\t\t\t\treturn $y - 0.5;  //向下跳0.5格\n\t\t\t}elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == \"lava\"){  //岩浆\n\t\t\t\t//echo \"前方岩浆 \\n\";\n\t\t\t\tif($reason) return 'lava';\n\t\t\t\treturn false;  //前方岩浆\n\t\t\t}elseif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == \"air\"){  //空气\n\t\t\t\t//echo \"考虑向下跳 \";\n\t\t\t\tif($this->whatBlock($level, new Vector3($x, $y - 2, $z)) == \"block\"){\n\t\t\t\t\t//echo \"GO向下跳 \\n\";\n\t\t\t\t\tif($reason) return 'down';\n\t\t\t\t\treturn $y - 1;  //向下跳\n\t\t\t\t}else{ //前方悬崖\n\t\t\t\t\t//echo \"前方悬崖 \\n\";\n\t\t\t\t\tif($reason) return 'fall';\n\t\t\t\t\tif($hate === false){\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn $y - 1;  //向下跳\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == \"water\"){  //水\n\t\t\t//echo \"正在水中\";\n\t\t\tif($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"water\"){  //上面还是水\n\t\t\t\t//echo \"向上游 \\n\";\n\t\t\t\tif($reason) return 'inwater';\n\t\t\t\treturn $y + 1;  //向上游，防溺水\n\t\t\t}elseif($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"block\" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"half\"){  //上方一格被堵住了\n\t\t\t\tif($this->whatBlock($level, new Vector3($x, $y - 1, $z)) == \"block\" or $this->whatBlock($level, new Vector3($x, $y - 1, $z)) == \"half\"){  //下方一格被也堵住了\n\t\t\t\t\t//echo \"上下都被卡住 \\n\";\n\t\t\t\t\tif($reason) return 'up!_down!';\n\t\t\t\t\treturn false;  //上下都被卡住\n\t\t\t\t}else{\n\t\t\t\t\t//echo \"向下游 \\n\";\n\t\t\t\t\tif($reason) return 'up!';\n\t\t\t\t\treturn $y - 1;  //向下游，防卡住\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t//echo \"游泳ing... \\n\";\n\t\t\t\tif($reason) return 'swim...';\n\t\t\t\treturn $y;  //向前游\n\t\t\t}\n\t\t}elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == \"half\"){  //半砖\n\t\t\t//echo \"前方半砖 \\n\";\n\t\t\tif($this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"block\" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"half\" or $this->whatBlock($level, new Vector3($x, $y + 1, $z)) == \"high\"){  //上方一格被堵住了\n\t\t\t\t//return false;  //上方卡住\n\t\t\t}else{\n\t\t\t\tif($reason) return 'halfGO';\n\t\t\t\treturn $y + 0.5;\n\t\t\t}\n\n\t\t}elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == \"lava\"){  //岩浆\n\t\t\t//echo \"前方岩浆 \\n\";\n\t\t\tif($reason) return 'lava';\n\t\t\treturn false;\n\t\t}elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == \"high\"){  //1.5格高方块\n\t\t\t//echo \"前方栅栏 \\n\";\n\t\t\tif($reason) return 'high';\n\t\t\treturn false;\n\t\t}elseif($this->whatBlock($level, new Vector3($x, $y, $z)) == \"climb\"){  //梯子\n\t\t\t//echo \"前方梯子 \\n\";\n\t\t\t//return $y;\n\t\t\tif($reason) return 'climb';\n\t\t\tif($hate){\n\t\t\t\treturn $y + 0.7;\n\t\t\t}else{\n\t\t\t\treturn $y + 0.5;\n\t\t\t}\n\t\t}else{  //考虑向上\n\t\t\t//echo \"考虑向上 \";\n\t\t\tif($this->whatBlock($level, new Vector3($x, $y + 1, $z)) != \"air\"){  //前方是面墙\n\t\t\t\t//echo \"前方是墙 \\n\";\n\t\t\t\tif($reason) return 'wall';\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\tif($this->whatBlock($level, new Vector3($x, $y + 2, $z)) == \"block\" or $this->whatBlock($level, new Vector3($x, $y + 2, $z)) == \"half\" or $this->whatBlock($level, new Vector3($x, $y + 2, $z)) == \"high\"){  //上方两格被堵住了\n\t\t\t\t\t//echo \"2格处被堵 \\n\";\n\t\t\t\t\tif($reason) return 'up2!';\n\t\t\t\t\treturn false;\n\t\t\t\t}else{\n\t\t\t\t\t//echo \"GO向上跳 \\n\";\n\t\t\t\t\tif($reason) return 'upGO';\n\t\t\t\t\treturn $y + 1;  //向上跳\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function whatBlock(Level $level, $v3){  //boybook的y轴判断法 核心 什么方块？\n\t\t$id = $level->getBlockIdAt($v3->x, $v3->y, $v3->z);\n\t\t$damage = $level->getBlockDataAt($v3->x, $v3->y, $v3->z);\n\t\tswitch($id){\n\t\t\tcase 0:\n\t\t\tcase 6:\n\t\t\tcase 27:\n\t\t\tcase 30:\n\t\t\tcase 31:\n\t\t\tcase 37:\n\t\t\tcase 38:\n\t\t\tcase 39:\n\t\t\tcase 40:\n\t\t\tcase 50:\n\t\t\tcase 51:\n\t\t\tcase 63:\n\t\t\tcase 66:\n\t\t\tcase 68:\n\t\t\tcase 78:\n\t\t\tcase 111:\n\t\t\tcase 141:\n\t\t\tcase 142:\n\t\t\tcase 171:\n\t\t\tcase 175:\n\t\t\tcase 244:\n\t\t\tcase 323:\n\t\t\t\t//透明方块\n\t\t\t\treturn \"air\";\n\t\t\t\tbreak;\n\t\t\tcase 8:\n\t\t\tcase 9:\n\t\t\t\t//水\n\t\t\t\treturn \"water\";\n\t\t\t\tbreak;\n\t\t\tcase 10:\n\t\t\tcase 11:\n\t\t\t\t//岩浆\n\t\t\t\treturn \"lava\";\n\t\t\t\tbreak;\n\t\t\tcase 44:\n\t\t\tcase 158:\n\t\t\t\t//半砖\n\t\t\t\tif($damage >= 8){\n\t\t\t\t\treturn \"block\";\n\t\t\t\t}else{\n\t\t\t\t\treturn \"half\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 64:\n\t\t\t\t//门\n\t\t\t\t//var_dump($damage.\" \");\n\t\t\t\t//TODO 不知如何判断门是否开启，因为以下条件永远满足\n\t\t\t\tif(($damage & 0x08) === 0x08){\n\t\t\t\t\treturn \"air\";\n\t\t\t\t}else{\n\t\t\t\t\treturn \"block\";\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase 85:\n\t\t\tcase 107:\n\t\t\tcase 139:\n\t\t\t\t//1.5格高的无法跳跃物\n\t\t\t\treturn \"high\";\n\t\t\t\tbreak;\n\t\t\tcase 65:\n\t\t\tcase 106:\n\t\t\t\t//可攀爬物\n\t\t\t\treturn \"climb\";\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\t//普通方块\n\t\t\t\treturn \"block\";\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\t/**\n\t * @param $mx\n\t * @param $mz\n\t * @return float|int\n\t * 获取yaw角度\n\t */\n\tpublic function getMyYaw($mx, $mz){  //根据motion计算转向角度\n\t\t//转向计算\n\t\tif($mz == 0){  //斜率不存在\n\t\t\tif($mx < 0){\n\t\t\t\t$yaw = -90;\n\t\t\t}else{\n\t\t\t\t$yaw = 90;\n\t\t\t}\n\t\t}else{  //存在斜率\n\t\t\tif($mx >= 0 and $mz > 0){  //第一象限\n\t\t\t\t$atan = atan($mx / $mz);\n\t\t\t\t$yaw = rad2deg($atan);\n\t\t\t}elseif($mx >= 0 and $mz < 0){  //第二象限\n\t\t\t\t$atan = atan($mx / abs($mz));\n\t\t\t\t$yaw = 180 - rad2deg($atan);\n\t\t\t}elseif($mx < 0 and $mz < 0){  //第三象限\n\t\t\t\t$atan = atan($mx / $mz);\n\t\t\t\t$yaw = -(180 - rad2deg($atan));\n\t\t\t}elseif($mx < 0 and $mz > 0){  //第四象限\n\t\t\t\t$atan = atan(abs($mx) / $mz);\n\t\t\t\t$yaw = -(rad2deg($atan));\n\t\t\t}else{\n\t\t\t\t$yaw = 0;\n\t\t\t}\n\t\t}\n\n\t\t$yaw = -$yaw;\n\t\treturn $yaw;\n\t}\n\n\t/**\n\t * @param Vector3 $from\n\t * @param Vector3 $to\n\t * @return float|int\n\t * 获取pitch角度\n\t */\n\tpublic function getMyPitch(Vector3 $from, Vector3 $to){\n\t\t$distance = $from->distance($to);\n\t\t$height = $to->y - $from->y;\n\t\tif($height > 0){\n\t\t\treturn -rad2deg(asin($height / $distance));\n\t\t}elseif($height < 0){\n\t\t\treturn rad2deg(asin(-$height / $distance));\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Creeper.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\event\\entity\\CreeperPowerEvent;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass Creeper extends Monster{\n\tconst NETWORK_ID = 33;\n\n\tconst DATA_SWELL = 19;\n\tconst DATA_SWELL_OLD = 20;\n\tconst DATA_SWELL_DIRECTION = 21;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Creeper\";\n\t}\n\n\tpublic function initEntity(){\n\t\tparent::initEntity();\n\n\t\tif(!isset($this->namedtag->powered)){\n\t\t\t$this->setPowered(false);\n\t\t}\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_POWERED, $this->isPowered());\n\t}\n\n\tpublic function setPowered(bool $powered, Lightning $lightning = null){\n\t\tif($lightning != null){\n\t\t\t$powered = true;\n\t\t\t$cause = CreeperPowerEvent::CAUSE_LIGHTNING;\n\t\t}else $cause = $powered ? CreeperPowerEvent::CAUSE_SET_ON : CreeperPowerEvent::CAUSE_SET_OFF;\n\n\t\t$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new CreeperPowerEvent($this, $lightning, $cause));\n\n\t\tif(!$ev->isCancelled()){\n\t\t\t$this->namedtag->powered = new ByteTag(\"powered\", $powered ? 1 : 0);\n\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_POWERED, $powered);\n\t\t}\n\t}\n\n\tpublic function isPowered() : bool{\n\t\treturn (bool) $this->namedtag[\"powered\"];\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Creeper::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Damageable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface Damageable{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Dragon.php",
    "content": "<?php\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass Dragon extends Monster {\n\tconst NETWORK_ID = 53;\n\n\tpublic $dropExp = [500, 12,000];//TODO: Add death animation and exp drop.\n\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(200);\n\t\tparent::initEntity();\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Ender Dragon\";\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Dragon::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/DragonFireBall.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass DragonFireBall extends Projectile{\n\tconst NETWORK_ID = 79;\n\n\tpublic $width = 0.25;\n\tpublic $length = 0.25;\n\tpublic $height = 0.25;\n\n\tprotected $gravity = 0.03;\n\tprotected $drag = 0.01;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = parent::onUpdate($currentTick);\n\n\t\tif($this->age > 1200 or $this->isCollided){\n\t\t\t$this->kill();\n\t\t\t$hasUpdate = true;\n\t\t}\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = DragonFireBall::NETWORK_ID;\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Effect.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____            _        _   __  __ _                  __  __ ____\r\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\r\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\r\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\r\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author PocketMine Team\r\n * @link http://www.pocketmine.net/\r\n *\r\n *\r\n*/\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\event\\entity\\EntityDamageEvent;\r\nuse pocketmine\\event\\entity\\EntityRegainHealthEvent;\r\nuse pocketmine\\event\\player\\PlayerExhaustEvent;\r\nuse pocketmine\\network\\Network;\r\nuse pocketmine\\network\\protocol\\MobEffectPacket;\r\nuse pocketmine\\Player;\r\n\r\nclass Effect{\r\n\tconst SPEED = 1;\r\n\tconst SLOWNESS = 2;\r\n\tconst HASTE = 3;\r\n\tconst SWIFTNESS = 3;\r\n\tconst FATIGUE = 4;\r\n\tconst MINING_FATIGUE = 4;\r\n\tconst STRENGTH = 5;\r\n\tconst HEALING = 6;\r\n\tconst HARMING = 7;\r\n\tconst JUMP = 8;\r\n\tconst NAUSEA = 9;\r\n\tconst CONFUSION = 9;\r\n\tconst REGENERATION = 10;\r\n\tconst DAMAGE_RESISTANCE = 11;\r\n\tconst FIRE_RESISTANCE = 12;\r\n\tconst WATER_BREATHING = 13;\r\n\tconst INVISIBILITY = 14;\r\n\tconst BLINDNESS = 15;\r\n\tconst NIGHT_VISION = 16;\r\n\tconst HUNGER = 17;\r\n\tconst WEAKNESS = 18;\r\n\tconst POISON = 19;\r\n\tconst WITHER = 20;\r\n\tconst HEALTH_BOOST = 21;\r\n\tconst ABSORPTION = 22;\r\n\tconst SATURATION = 23;\r\n\r\n\tconst MAX_DURATION = 2147483648;\r\n\r\n\t/** @var Effect[] */\r\n\tprotected static $effects;\r\n\r\n\tpublic static function init(){\r\n\t\tself::$effects = new \\SplFixedArray(256);\r\n\r\n\t\tself::$effects[Effect::SPEED] = new Effect(Effect::SPEED, \"%potion.moveSpeed\", 124, 175, 198);\r\n\t\tself::$effects[Effect::SLOWNESS] = new Effect(Effect::SLOWNESS, \"%potion.moveSlowdown\", 90, 108, 129, true);\r\n\t\tself::$effects[Effect::SWIFTNESS] = new Effect(Effect::SWIFTNESS, \"%potion.digSpeed\", 217, 192, 67);\r\n\t\tself::$effects[Effect::FATIGUE] = new Effect(Effect::FATIGUE, \"%potion.digSlowDown\", 74, 66, 23, true);\r\n\t\tself::$effects[Effect::STRENGTH] = new Effect(Effect::STRENGTH, \"%potion.damageBoost\", 147, 36, 35);\r\n\t\tself::$effects[Effect::HEALING] = new InstantEffect(Effect::HEALING, \"%potion.heal\", 248, 36, 35);\r\n\t\tself::$effects[Effect::HARMING] = new InstantEffect(Effect::HARMING, \"%potion.harm\", 67, 10, 9, true);\r\n\t\tself::$effects[Effect::JUMP] = new Effect(Effect::JUMP, \"%potion.jump\", 34, 255, 76);\r\n\t\tself::$effects[Effect::NAUSEA] = new Effect(Effect::NAUSEA, \"%potion.confusion\", 85, 29, 74, true);\r\n\t\tself::$effects[Effect::REGENERATION] = new Effect(Effect::REGENERATION, \"%potion.regeneration\", 205, 92, 171);\r\n\t\tself::$effects[Effect::DAMAGE_RESISTANCE] = new Effect(Effect::DAMAGE_RESISTANCE, \"%potion.resistance\", 153, 69, 58);\r\n\t\tself::$effects[Effect::FIRE_RESISTANCE] = new Effect(Effect::FIRE_RESISTANCE, \"%potion.fireResistance\", 228, 154, 58);\r\n\t\tself::$effects[Effect::WATER_BREATHING] = new Effect(Effect::WATER_BREATHING, \"%potion.waterBreathing\", 46, 82, 153);\r\n\t\tself::$effects[Effect::INVISIBILITY] = new Effect(Effect::INVISIBILITY, \"%potion.invisibility\", 127, 131, 146);\r\n\r\n\t\tself::$effects[Effect::BLINDNESS] = new Effect(Effect::BLINDNESS, \"%potion.blindness\", 191, 192, 192);\r\n\t\tself::$effects[Effect::NIGHT_VISION] = new Effect(Effect::NIGHT_VISION, \"%potion.nightVision\", 0, 0, 139);\r\n\t\tself::$effects[Effect::HUNGER] = new Effect(Effect::HUNGER, \"%potion.hunger\", 46, 139, 87);\r\n\r\n\t\tself::$effects[Effect::WEAKNESS] = new Effect(Effect::WEAKNESS, \"%potion.weakness\", 72, 77, 72 , true);\r\n\t\tself::$effects[Effect::POISON] = new Effect(Effect::POISON, \"%potion.poison\", 78, 147, 49, true);\r\n\t\tself::$effects[Effect::WITHER] = new Effect(Effect::WITHER, \"%potion.wither\", 53, 42, 39, true);\r\n\t\tself::$effects[Effect::HEALTH_BOOST] = new Effect(Effect::HEALTH_BOOST, \"%potion.healthBoost\", 248, 125, 35);\r\n\r\n\t\tself::$effects[Effect::ABSORPTION] = new Effect(Effect::ABSORPTION, \"%potion.absorption\", 36, 107, 251);\r\n\t\tself::$effects[Effect::SATURATION] = new Effect(Effect::SATURATION, \"%potion.saturation\", 255, 0, 255);\r\n\t}\r\n\r\n\t/**\r\n\t * @param int $id\r\n\t * @return $this\r\n\t */\r\n\tpublic static function getEffect($id){\r\n\t\tif(isset(self::$effects[$id])){\r\n\t\t\treturn clone self::$effects[(int) $id];\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tpublic static function getEffectByName($name){\r\n\t\tif(defined(Effect::class . \"::\" . strtoupper($name))){\r\n\t\t\treturn self::getEffect(constant(Effect::class . \"::\" . strtoupper($name)));\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\t/** @var int */\r\n\tprotected $id;\r\n\r\n\tprotected $name;\r\n\r\n\tprotected $duration;\r\n\r\n\tprotected $amplifier = 0;\r\n\r\n\tprotected $color;\r\n\r\n\tprotected $show = true;\r\n\r\n\tprotected $ambient = false;\r\n\r\n\tprotected $bad;\r\n\r\n\tpublic function __construct($id, $name, $r, $g, $b, $isBad = false){\r\n\t\t$this->id = $id;\r\n\t\t$this->name = $name;\r\n\t\t$this->bad = (bool) $isBad;\r\n\t\t$this->setColor($r, $g, $b);\r\n\t}\r\n\r\n\tpublic function getName(){\r\n\t\treturn $this->name;\r\n\t}\r\n\r\n\tpublic function getId(){\r\n\t\treturn $this->id;\r\n\t}\r\n\r\n\tpublic function setDuration($ticks){\r\n\t\t$this->duration = (($ticks > self::MAX_DURATION) ? self::MAX_DURATION : $ticks);\r\n\t\treturn $this;\r\n\t}\r\n\r\n\tpublic function getDuration(){\r\n\t\treturn $this->duration;\r\n\t}\r\n\r\n\tpublic function isVisible(){\r\n\t\treturn $this->show;\r\n\t}\r\n\r\n\tpublic function setVisible($bool){\r\n\t\t$this->show = (bool) $bool;\r\n\t\treturn $this;\r\n\t}\r\n\r\n\t/**\r\n\t * @return int\r\n\t */\r\n\tpublic function getAmplifier(){\r\n\t\treturn $this->amplifier;\r\n\t}\r\n\r\n\t/**\r\n\t * @param int $amplifier\r\n\t *\r\n\t * @return $this\r\n\t */\r\n\tpublic function setAmplifier(int $amplifier){\r\n\t\t$this->amplifier = $amplifier & 0xff;\r\n\t\treturn $this;\r\n\t}\r\n\r\n\tpublic function isAmbient(){\r\n\t\treturn $this->ambient;\r\n\t}\r\n\r\n\tpublic function setAmbient($ambient = true){\r\n\t\t$this->ambient = (bool) $ambient;\r\n\t\treturn $this;\r\n\t}\r\n\r\n\tpublic function isBad(){\r\n\t\treturn $this->bad;\r\n\t}\r\n\r\n\tpublic function canTick(){\r\n\t\tif($this->amplifier < 0) $this->amplifier = 0;\r\n\t\tswitch($this->id){\r\n\t\t\tcase Effect::POISON:\r\n\t\t\t\tif(($interval = (25 >> $this->amplifier)) > 0){\r\n\t\t\t\t\treturn ($this->duration % $interval) === 0;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\tcase Effect::WITHER:\r\n\t\t\t\tif(($interval = (50 >> $this->amplifier)) > 0){\r\n\t\t\t\t\treturn ($this->duration % $interval) === 0;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\tcase Effect::REGENERATION:\r\n\t\t\t\tif(($interval = (40 >> $this->amplifier)) > 0){\r\n\t\t\t\t\treturn ($this->duration % $interval) === 0;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\tcase Effect::HUNGER:\r\n\t\t\t\tif($this->amplifier < 0){ // prevents hacking with amplifier -1\r\n\t\t\t\t\treturn false;\r\n\t\t\t\t}\r\n\t\t\t\tif(($interval = 20) > 0){\r\n\t\t\t\t\treturn ($this->duration % $interval) === 0;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t\tcase Effect::HEALING:\r\n\t\t\tcase Effect::HARMING:\r\n\t\t\t\treturn true;\r\n\t\t\tcase Effect::SATURATION:\r\n\t\t\t\tif(($interval = (20 >> $this->amplifier)) > 0){\r\n\t\t\t\t\treturn ($this->duration % $interval) === 0;\r\n\t\t\t\t}\r\n\t\t\t\treturn true;\r\n\t\t}\r\n\t\treturn false;\r\n\t}\r\n\r\n\tpublic function applyEffect(Entity $entity){\r\n\t\tswitch($this->id){\r\n\t\t\tcase Effect::POISON:\r\n\t\t\t\tif($entity->getHealth() > 1){\r\n\t\t\t\t\t$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, 1);\r\n\t\t\t\t\t$entity->attack($ev->getFinalDamage(), $ev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase Effect::WITHER:\r\n\t\t\t\t$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, 1);\r\n\t\t\t\t$entity->attack($ev->getFinalDamage(), $ev);\r\n\t\t\t\tbreak;\r\n\r\n\t\t\tcase Effect::REGENERATION:\r\n\t\t\t\tif($entity->getHealth() < $entity->getMaxHealth()){\r\n\t\t\t\t\t$ev = new EntityRegainHealthEvent($entity, 1, EntityRegainHealthEvent::CAUSE_MAGIC);\r\n\t\t\t\t\t$entity->heal($ev->getAmount(), $ev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase Effect::HUNGER:\r\n\t\t\t\tif($entity instanceof Human){\r\n\t\t\t\t\t$entity->exhaust(0.5 * $this->amplifier, PlayerExhaustEvent::CAUSE_POTION);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase Effect::HEALING:\r\n\t\t\t\t$level = $this->amplifier + 1;\r\n\t\t\t\tif(($entity->getHealth() + 4 * $level) <= $entity->getMaxHealth()) {\r\n\t\t\t\t\t$ev = new EntityRegainHealthEvent($entity, 4 * $level, EntityRegainHealthEvent::CAUSE_MAGIC);\r\n\t\t\t\t\t$entity->heal($ev->getAmount(), $ev);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$ev = new EntityRegainHealthEvent($entity, $entity->getMaxHealth() - $entity->getHealth(), EntityRegainHealthEvent::CAUSE_MAGIC);\r\n\t\t\t\t\t$entity->heal($ev->getAmount(), $ev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase Effect::HARMING:\r\n\t\t\t\t$level = $this->amplifier + 1;\r\n\t\t\t\tif(($entity->getHealth() - 6 * $level) >= 0) {\r\n\t\t\t\t\t$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, 6 * $level);\r\n\t\t\t\t\t$entity->attack($ev->getFinalDamage(), $ev);\r\n\t\t\t\t} else {\r\n\t\t\t\t\t$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_MAGIC, $entity->getHealth());\r\n\t\t\t\t\t$entity->attack($ev->getFinalDamage(), $ev);\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t\tcase Effect::SATURATION:\r\n\t\t\t\tif($entity instanceof Player){\r\n\t\t\t\t\tif($entity->getServer()->foodEnabled) {\r\n\t\t\t\t\t\t$entity->setFood($entity->getFood() + 1);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tbreak;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function getColor(){\r\n\t\treturn [$this->color >> 16, ($this->color >> 8) & 0xff, $this->color & 0xff];\r\n\t}\r\n\r\n\tpublic function setColor($r, $g, $b){\r\n\t\t$this->color = (($r & 0xff) << 16) + (($g & 0xff) << 8) + ($b & 0xff);\r\n\t}\r\n\r\n\tpublic function add(Entity $entity, $modify = false, Effect $oldEffect = null){\r\n\t\tif($entity instanceof Player){\r\n\t\t\t$pk = new MobEffectPacket();\r\n\t\t\t$pk->eid = 0;\r\n\t\t\t$pk->effectId = $this->getId();\r\n\t\t\t$pk->amplifier = $this->getAmplifier();\r\n\t\t\t$pk->particles = $this->isVisible();\r\n\t\t\t$pk->duration = $this->getDuration();\r\n\t\t\tif($modify){\r\n\t\t\t\t$pk->eventId = MobEffectPacket::EVENT_MODIFY;\r\n\t\t\t}else{\r\n\t\t\t\t$pk->eventId = MobEffectPacket::EVENT_ADD;\r\n\t\t\t}\r\n\r\n\t\t\t$entity->dataPacket($pk);\r\n\r\n\t\t\tif($this->id === Effect::SPEED){\r\n\t\t\t\t$attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);\r\n\t\t\t\tif($modify and $oldEffect !== null){\r\n\t\t\t\t\t$speed = $attr->getValue() / (1 + 0.2 * ($oldEffect->getAmplifier() + 1));\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$speed = $attr->getValue();\r\n\t\t\t\t}\r\n\t\t\t\t$speed *= (1 + 0.2 * ($this->amplifier + 1));\r\n\t\t\t\t$attr->setValue($speed);\r\n\t\t\t}elseif($this->id === Effect::SLOWNESS){\r\n\t\t\t\t$attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);\r\n\t\t\t\tif($modify and $oldEffect !== null){\r\n\t\t\t\t\t$speed = $attr->getValue() / (1 - 0.15 * ($oldEffect->getAmplifier() + 1));\r\n\t\t\t\t}else{\r\n\t\t\t\t\t$speed = $attr->getValue();\r\n\t\t\t\t}\r\n\t\t\t\t$speed *= (1 - (0.15 * $this->amplifier + 1));\r\n\t\t\t\t$attr->setValue($speed);\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif($this->id === Effect::INVISIBILITY){\r\n\t\t\t$entity->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, true);\r\n\t\t\t$entity->setNameTagVisible(false);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function remove(Entity $entity){\r\n\t\tif($entity instanceof Player){\r\n\t\t\t$pk = new MobEffectPacket();\r\n\t\t\t$pk->eid = 0;\r\n\t\t\t$pk->eventId = MobEffectPacket::EVENT_REMOVE;\r\n\t\t\t$pk->effectId = $this->getId();\r\n\r\n\t\t\t$entity->dataPacket($pk);\r\n\r\n\t\t\tif($this->id === Effect::SPEED){\r\n\t\t\t\t$attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);\r\n\t\t\t\t$attr->setValue($attr->getValue() / (1 + 0.2 * ($this->amplifier + 1)));\r\n\t\t\t}elseif($this->id === Effect::SLOWNESS){\r\n\t\t\t\t$attr = $entity->getAttributeMap()->getAttribute(Attribute::MOVEMENT_SPEED);\r\n\t\t\t\t$attr->setValue($attr->getValue() / (1 - 0.15 * ($this->amplifier + 1)));\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif($this->id === Effect::INVISIBILITY){\r\n\t\t\t$entity->setDataFlag(Entity::DATA_FLAGS, Entity::DATA_FLAG_INVISIBLE, false);\r\n\t\t\t$entity->setNameTagVisible(true);\r\n\t\t}\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/entity/Egg.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\Player;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\n\r\nclass Egg extends Projectile{\r\n\tconst NETWORK_ID = 82;\r\n\r\n\tpublic $width = 0.25;\r\n\tpublic $length = 0.25;\r\n\tpublic $height = 0.25;\r\n\r\n\tprotected $gravity = 0.03;\r\n\tprotected $drag = 0.01;\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\r\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$this->timings->startTiming();\r\n\r\n\t\t$hasUpdate = parent::onUpdate($currentTick);\r\n\r\n\t\tif($this->age > 1200 or $this->isCollided){\r\n\t\t\t$this->kill();\r\n\t\t\t$hasUpdate = true; //Chance to spawn chicken\r\n\t\t}\r\n\r\n\t\t$this->timings->stopTiming();\r\n\r\n\t\treturn $hasUpdate;\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->type = Egg::NETWORK_ID;\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/entity/EnderCrystal.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\level\\format\\Chunk;\n\nclass EnderCrystal extends Vehicle{\n\tconst NETWORK_ID = 71;\n\n\tpublic $height = 0.7;\n\tpublic $width = 1.6;\n\n\tpublic $gravity = 0.5;\n\tpublic $drag = 0.1;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tparent::__construct($chunk, $nbt);\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = EnderCrystal::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = 0;\n\t\t$pk->speedY = 0;\n\t\t$pk->speedZ = 0;\n\t\t$pk->yaw = 0;\n\t\t$pk->pitch = 0;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/EnderPearl.php",
    "content": "<?php\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\entity\\{Entity, Projectile};\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass EnderPearl extends Projectile{\n\tconst NETWORK_ID = 87;\n\n\tpublic $width = 0.25;\n\tpublic $length = 0.25;\n\tpublic $height = 0.25;\n\n\tprotected $gravity = 0.03;\n\tprotected $drag = 0.01;\n\tprotected $player;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = parent::onUpdate($currentTick);\n\n\t\tif($this->age > 1200 or $this->isCollided){\n\t\t\t$this->kill();\n\t\t\t$hasUpdate = true;\n\t\t}\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate;\n\t}\n\n\t/** @return Player */\n\tpublic function getSpawner(){\n\t\treturn $this->player;\n\t}\n\n\tpublic function setSpawner(Player $player){\n\t\t$this->player = $player;\n\t}\n\n\tpublic function close(){\n\t\tif ($this->getSpawner() instanceof Player) {\n\t\t\t$this->getSpawner()->teleport($this);\n\t\t}\n\t\tparent::close();\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = self::NETWORK_ID;\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Enderman.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass Enderman extends Monster{\n\tconst NETWORK_ID = 38;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.8;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Enderman\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Enderman::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Entity.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * All the entity classes\n */\nnamespace pocketmine\\entity;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Fire;\nuse pocketmine\\block\\Portal;\nuse pocketmine\\block\\PressurePlate;\nuse pocketmine\\block\\Water;\nuse pocketmine\\block\\SlimeBlock;\nuse pocketmine\\entity\\Item as DroppedItem;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\event\\entity\\EntityDespawnEvent;\nuse pocketmine\\event\\entity\\EntityEffectAddEvent;\nuse pocketmine\\event\\entity\\EntityEffectRemoveEvent;\nuse pocketmine\\event\\entity\\EntityLevelChangeEvent;\nuse pocketmine\\event\\entity\\EntityMotionEvent;\nuse pocketmine\\event\\entity\\EntityRegainHealthEvent;\nuse pocketmine\\event\\entity\\EntitySpawnEvent;\nuse pocketmine\\event\\entity\\EntityTeleportEvent;\nuse pocketmine\\event\\Timings;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\Location;\nuse pocketmine\\level\\particle\\DestroyBlockParticle;\nuse pocketmine\\level\\Position;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Math;\nuse pocketmine\\math\\Vector2;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\metadata\\Metadatable;\nuse pocketmine\\metadata\\MetadataValue;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\network\\protocol\\MobEffectPacket;\nuse pocketmine\\network\\protocol\\RemoveEntityPacket;\nuse pocketmine\\network\\protocol\\SetEntityDataPacket;\nuse pocketmine\\network\\protocol\\SetEntityLinkPacket;\nuse pocketmine\\Player;\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\ChunkException;\n\nabstract class Entity extends Location implements Metadatable{\n\n\tconst NETWORK_ID = -1;\n\n\tconst DATA_TYPE_BYTE = 0;\n\tconst DATA_TYPE_SHORT = 1;\n\tconst DATA_TYPE_INT = 2;\n\tconst DATA_TYPE_FLOAT = 3;\n\tconst DATA_TYPE_STRING = 4;\n\tconst DATA_TYPE_SLOT = 5;\n\tconst DATA_TYPE_POS = 6;\n\tconst DATA_TYPE_LONG = 7;\n\tconst DATA_TYPE_VECTOR3F = 8;\n\n\tconst DATA_FLAGS = 0;\n\t//1 (int)\n\tconst DATA_VARIANT = 2; //int\n\tconst DATA_COLOUR = 3; //byte\n\tconst DATA_NAMETAG = 4; //string\n\tconst DATA_OWNER_EID = 5; //long\n\n\tconst DATA_AIR = 7; //short\n\tconst DATA_POTION_COLOR = 8; //int (ARGB!)\n\tconst DATA_POTION_AMBIENT = 9; //byte\n\tconst DATA_LEAD = 24;\n\t/* 27 (byte) player-specific flags\n\t * 28 (int) player \"index\"?\n\t * 29 (block coords) bed position */\n\tconst DATA_LEAD_HOLDER_EID = 38; const DATA_LEAD_HOLDER = 38; //long\n\tconst DATA_SCALE = 39; //float\n\tconst DATA_INTERACTIVE_TAG = 40; //string (button text)\n\t/* 41 (long) */\n\tconst DATA_URL_TAG = 43; //string\n\tconst DATA_MAX_AIR = 44; //short\n\tconst DATA_MARK_VARIANT = 45; //int\n\t/* 46 (byte)\n\t * 47 (int)\n\t * 48 (int)\n\t * 49 (long)\n\t * 50 (long)\n\t * 51 (long)\n\t /* 52 (short) */\n\tconst DATA_BOUNDING_BOX_WIDTH = 53; //float\n\tconst DATA_BOUNDING_BOX_HEIGHT = 54; //float\n\tconst DATA_FUSE_LENGTH = 55; //int\n\t/* 56 (vector3f)\n\t * 57 (byte)\n\t * 58 (float)\n\t * 59 (float) */\n\n\tconst DATA_FLAG_ONFIRE = 0;\n\tconst DATA_FLAG_SNEAKING = 1;\n\tconst DATA_FLAG_RIDING = 2;\n\tconst DATA_FLAG_SPRINTING = 3;\n\tconst DATA_FLAG_ACTION = 4;\n\tconst DATA_FLAG_INVISIBLE = 5;\n\tconst DATA_FLAG_TEMPTED = 6; //???\n\tconst DATA_FLAG_INLOVE = 7;\n\tconst DATA_FLAG_SADDLED = 8;\n\tconst DATA_FLAG_POWERED = 9;\n\tconst DATA_FLAG_IGNITED = 10; //for creepers?\n\tconst DATA_FLAG_BABY = 11;\n\tconst DATA_FLAG_CONVERTING = 12; //???\n\tconst DATA_FLAG_CRITICAL = 13;\n\tconst DATA_FLAG_CAN_SHOW_NAMETAG = 14;\n\tconst DATA_FLAG_ALWAYS_SHOW_NAMETAG = 15;\n\tconst DATA_FLAG_IMMOBILE = 16, DATA_FLAG_NO_AI = 16;\n\tconst DATA_FLAG_SILENT = 17;\n\tconst DATA_FLAG_WALLCLIMBING = 18;\n\tconst DATA_FLAG_RESTING = 19; //for bats?\n\tconst DATA_FLAG_SITTING = 20;\n\tconst DATA_FLAG_ANGRY = 21;\n\tconst DATA_FLAG_INTERESTED = 22; //for mobs following players with food?\n\tconst DATA_FLAG_CHARGED = 23;\n\tconst DATA_FLAG_TAMED = 24;\n\tconst DATA_FLAG_LEASHED = 25;\n\tconst DATA_FLAG_SHEARED = 26; //for sheep\n\tconst DATA_FLAG_GLIDING = 27, DATA_FLAG_FALL_FLYING = 27;\n\tconst DATA_FLAG_ELDER = 28; //elder guardian\n\tconst DATA_FLAG_MOVING = 29;\n\tconst DATA_FLAG_BREATHING = 30; //hides bubbles if true\n\tconst DATA_FLAG_CHESTED = 31; //for mules?\n\tconst DATA_FLAG_STACKABLE = 32;\n\tconst DATA_FLAG_IDLING = 36;\n\n\tconst SOUTH = 0;\n\tconst WEST = 1;\n\tconst NORTH = 2;\n\tconst EAST = 3;\n\n\tpublic static $entityCount = 1;\n\t/** @var Entity[] */\n\tprivate static $knownEntities = [];\n\tprivate static $shortNames = [];\n\n\tpublic static function init(){\n\t\tEntity::registerEntity(Arrow::class);\n\t\tEntity::registerEntity(Bat::class);\n\t\tEntity::registerEntity(Blaze::class);\n\t\tEntity::registerEntity(Boat::class);\n\t\tEntity::registerEntity(CaveSpider::class);\n\t\tEntity::registerEntity(Chicken::class);\n\t\tEntity::registerEntity(Cow::class);\n\t\tEntity::registerEntity(Creeper::class);\n\t\tEntity::registerEntity(DroppedItem::class);\n\t\tEntity::registerEntity(Egg::class);\n\t\tEntity::registerEntity(Enderman::class);\n\t\tEntity::registerEntity(EnderPearl::class);\n\t\tEntity::registerEntity(FallingSand::class);\n\t\tEntity::registerEntity(FishingHook::class);\n\t\tEntity::registerEntity(Ghast::class);\n\t\tEntity::registerEntity(Husk::class);\n\t\tEntity::registerEntity(IronGolem::class);\n\t\tEntity::registerEntity(LavaSlime::class); //Magma Cube\n\t\tEntity::registerEntity(Lightning::class);\n\t\tEntity::registerEntity(Minecart::class);\n\t\tEntity::registerEntity(MinecartChest::class);\n\t\tEntity::registerEntity(MinecartHopper::class);\n\t\tEntity::registerEntity(MinecartTNT::class);\n\t\tEntity::registerEntity(Mooshroom::class);\n\t\tEntity::registerEntity(Ocelot::class);\n\t\tEntity::registerEntity(Painting::class);\n\t\tEntity::registerEntity(Pig::class);\n\t\tEntity::registerEntity(PigZombie::class);\n\t\tEntity::registerEntity(PrimedTNT::class);\n\t\tEntity::registerEntity(Rabbit::class);\n\t\tEntity::registerEntity(Sheep::class);\n\t\tEntity::registerEntity(Silverfish::class);\n\t\tEntity::registerEntity(Skeleton::class);\n\t\tEntity::registerEntity(Slime::class);\n\t\tEntity::registerEntity(Snowball::class);\n\t\tEntity::registerEntity(SnowGolem::class);\n\t\tEntity::registerEntity(Spider::class);\n\t\tEntity::registerEntity(Squid::class);\n\t\tEntity::registerEntity(Stray::class);\n\t\tEntity::registerEntity(ThrownExpBottle::class);\n\t\tEntity::registerEntity(ThrownPotion::class);\n\t\tEntity::registerEntity(Villager::class);\n\t\tEntity::registerEntity(Witch::class);\n\t\tEntity::registerEntity(Wolf::class);\n\t\tEntity::registerEntity(XPOrb::class);\n\t\tEntity::registerEntity(Zombie::class);\n\t\tEntity::registerEntity(ZombieVillager::class);\n\n\t\tEntity::registerEntity(Human::class, true);\n\t}\n\n\t/**\n\t * @var Player[]\n\t */\n\tprotected $hasSpawned = [];\n\n\t/** @var Effect[] */\n\tprotected $effects = [];\n\n\tprotected $id;\n\n\tprotected $dataFlags = 0;\n\tprotected $dataProperties = [\n\t\tself::DATA_FLAGS => [self::DATA_TYPE_LONG, 0],\n\t\tself::DATA_AIR => [self::DATA_TYPE_SHORT, 400],\n\t\tself::DATA_MAX_AIR => [self::DATA_TYPE_SHORT, 400],\n\t\tself::DATA_NAMETAG => [self::DATA_TYPE_STRING, \"\"],\n\t\tself::DATA_LEAD_HOLDER_EID => [self::DATA_TYPE_LONG, -1],\n\t\tself::DATA_SCALE => [self::DATA_TYPE_FLOAT, 1],\n\t];\n\n\tpublic $passenger = null;\n\tpublic $vehicle = null;\n\n\t/** @var Chunk */\n\tpublic $chunk;\n\n\tprotected $lastDamageCause = null;\n\n\t/** @var Block[] */\n\tprivate $blocksAround = [];\n\n\tpublic $lastX = null;\n\tpublic $lastY = null;\n\tpublic $lastZ = null;\n\n\tpublic $motionX;\n\tpublic $motionY;\n\tpublic $motionZ;\n\t/** @var Vector3 */\n\tpublic $temporalVector;\n\tpublic $lastMotionX;\n\tpublic $lastMotionY;\n\tpublic $lastMotionZ;\n\n\tpublic $lastYaw;\n\tpublic $lastPitch;\n\n\t/** @var AxisAlignedBB */\n\tpublic $boundingBox;\n\tpublic $onGround;\n\tpublic $inBlock = false;\n\tpublic $positionChanged;\n\tpublic $motionChanged;\n\tpublic $deadTicks = 0;\n\tprotected $age = 0;\n\n\tpublic $height;\n\n\tpublic $eyeHeight = null;\n\n\tpublic $width;\n\tpublic $length;\n\n\t/** @var int */\n\tprivate $health = 20;\n\tprivate $maxHealth = 20;\n\n\tprotected $ySize = 0;\n\tprotected $stepHeight = 0;\n\tpublic $keepMovement = false;\n\n\tpublic $fallDistance = 0;\n\tpublic $ticksLived = 0;\n\tpublic $lastUpdate;\n\tpublic $maxFireTicks;\n\tpublic $fireTicks = 0;\n\tpublic $namedtag;\n\tpublic $canCollide = true;\n\n\tprotected $isStatic = false;\n\n\tpublic $isCollided = false;\n\tpublic $isCollidedHorizontally = false;\n\tpublic $isCollidedVertically = false;\n\n\tpublic $noDamageTicks;\n\tprotected $justCreated;\n\tprivate $invulnerable;\n\n\t/** @var AttributeMap */\n\tprotected $attributeMap;\n\n\tprotected $gravity;\n\tprotected $drag;\n\n\t/** @var Server */\n\tprotected $server;\n\n\tpublic $closed = false;\n\n\t/** @var \\pocketmine\\event\\TimingsHandler */\n\tprotected $timings;\n\tprotected $isPlayer = false;\n\n\t/** @var Entity */\n\tprotected $linkedEntity = null;\n\t/** 0 no linked 1 linked other 2 be linked */\n\tprotected $linkedType = null;\n\n\n\tprotected $riding = null;\n\n\t/** @var PressurePlate */\n\tprotected $activatedPressurePlates = [];\n\n\tpublic $dropExp = [0, 0];\n\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif($chunk === null or $chunk->getProvider() === null){\n \t\t\tthrow new ChunkException(\"Invalid garbage Chunk given to Entity\");\n\t\t}\n\n\t\t$this->timings = Timings::getEntityTimings($this);\n\n\t\t$this->isPlayer = $this instanceof Player;\n\n\t\t$this->temporalVector = new Vector3();\n\n\t\tif($this->eyeHeight === null){\n\t\t\t$this->eyeHeight = $this->height / 2 + 0.1;\n\t\t}\n\n\t\t$this->id = Entity::$entityCount++;\n\t\t$this->justCreated = true;\n\t\t$this->namedtag = $nbt;\n\n\t\t$this->chunk = $chunk;\n\t\t$this->setLevel($chunk->getProvider()->getLevel());\n\t\t$this->server = $chunk->getProvider()->getLevel()->getServer();\n\n\t\t$this->boundingBox = new AxisAlignedBB(0, 0, 0, 0, 0, 0);\n\t\t$this->setPositionAndRotation(\n\t\t\t$this->temporalVector->setComponents(\n\t\t\t\t$this->namedtag[\"Pos\"][0],\n\t\t\t\t$this->namedtag[\"Pos\"][1],\n\t\t\t\t$this->namedtag[\"Pos\"][2]\n\t\t\t),\n\t\t\t$this->namedtag->Rotation[0],\n\t\t\t$this->namedtag->Rotation[1]\n\t\t);\n\t\t$this->setMotion($this->temporalVector->setComponents($this->namedtag[\"Motion\"][0], $this->namedtag[\"Motion\"][1], $this->namedtag[\"Motion\"][2]));\n\n\t\tif(is_nan($this->x) or is_infinite($this->x) or is_nan($this->y) or is_infinite($this->y) or is_nan($this->z) or is_infinite($this->z)){\n\t\t\tthrow new \\InvalidStateException(\"Invalid entity coordinates\");\n\t\t}\n\n\t\tif(!isset($this->namedtag->FallDistance)){\n\t\t\t$this->namedtag->FallDistance = new FloatTag(\"FallDistance\", 0);\n\t\t}\n\t\t$this->fallDistance = $this->namedtag[\"FallDistance\"];\n\n\t\tif(!isset($this->namedtag->Fire)){\n\t\t\t$this->namedtag->Fire = new ShortTag(\"Fire\", 0);\n\t\t}\n\t\t$this->fireTicks = $this->namedtag[\"Fire\"];\n\n\t\tif(!isset($this->namedtag->Air)){\n\t\t\t$this->namedtag->Air = new ShortTag(\"Air\", 300);\n\t\t}\n\t\t$this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $this->namedtag[\"Air\"]);\n\n\t\tif(!isset($this->namedtag->OnGround)){\n\t\t\t$this->namedtag->OnGround = new ByteTag(\"OnGround\", 0);\n\t\t}\n\t\t$this->onGround = $this->namedtag[\"OnGround\"] > 0 ? true : false;\n\n\t\tif(!isset($this->namedtag->Invulnerable)){\n\t\t\t$this->namedtag->Invulnerable = new ByteTag(\"Invulnerable\", 0);\n\t\t}\n\t\t$this->invulnerable = $this->namedtag[\"Invulnerable\"] > 0 ? true : false;\n\n\t\t$this->attributeMap = new AttributeMap();\n\n\t\t$this->chunk->addEntity($this);\n\t\t$this->level->addEntity($this);\n\t\t$this->initEntity();\n\t\t$this->lastUpdate = $this->server->getTick();\n\t\t$this->server->getPluginManager()->callEvent(new EntitySpawnEvent($this));\n\n\t\t$this->scheduleUpdate();\n\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getDropExpMin() : int{\n\t\treturn $this->dropExp[0];\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getDropExpMax() : int{\n\t\treturn $this->dropExp[1];\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getNameTag(){\n\t\treturn $this->getDataProperty(self::DATA_NAMETAG);\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isNameTagVisible(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_CAN_SHOW_NAMETAG);\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isNameTagAlwaysVisible(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ALWAYS_SHOW_NAMETAG);\n\t}\n\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function setNameTag($name){\n\t\t$this->setDataProperty(self::DATA_NAMETAG, self::DATA_TYPE_STRING, $name);\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setNameTagVisible($value = true){\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_CAN_SHOW_NAMETAG, $value);\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setNameTagAlwaysVisible($value = true){\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ALWAYS_SHOW_NAMETAG, $value);\n\t}\n\n\tpublic function isSneaking(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_SNEAKING);\n\t}\n\n\tpublic function setSneaking($value = true){\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_SNEAKING, (bool) $value);\n\t}\n\n\tpublic function isSprinting(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_SPRINTING);\n\t}\n\n\tpublic function setSprinting($value = true){\n\t\tif($value !== $this->isSprinting()){\n\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_SPRINTING, (bool) $value);\n\t\t\t$attr = $this->attributeMap->getAttribute(Attribute::MOVEMENT_SPEED);\n\t\t\t$attr->setValue($value ? ($attr->getValue() * 1.3) : ($attr->getValue() / 1.3));\n\t\t}\n\t}\n\t\n\tpublic function isGliding(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_IDLING);\n \t}\n\n\tpublic function setGliding($value = true){\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_FALL_FLYING, (bool) $value);\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_IDLING, (bool) $value);\n\t}\n\n\tpublic function isImmobile() : bool{\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_IMMOBILE);\n\t}\n\n\tpublic function setImmobile($value = true){\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_IMMOBILE, $value);\n\t}\n\n\t/**\n\t * @return Effect[]\n\t */\n\tpublic function getEffects(){\n\t\treturn $this->effects;\n\t}\n\n\tpublic function removeAllEffects(){\n\t\tforeach($this->effects as $effect){\n\t\t\t$this->removeEffect($effect->getId());\n\t\t}\n\t}\n\n\tpublic function removeEffect($effectId){\n\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityEffectRemoveEvent($this, $effectId));\n\t\tif($ev->isCancelled()){\n\t\t\treturn false;\n\t\t}\n\t\tif(isset($this->effects[$effectId])){\n\t\t\t$effect = $this->effects[$effectId];\n\t\t\tunset($this->effects[$effectId]);\n\t\t\t$effect->remove($this);\n\t\t\tif($effectId === Effect::ABSORPTION and $this instanceof Human){\n\t\t\t\t$this->setAbsorption(0);\n\t\t\t}\n\n\t\t\t$this->recalculateEffectColor();\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tpublic function getEffect($effectId){\n\t\treturn isset($this->effects[$effectId]) ? $this->effects[$effectId] : null;\n\t}\n\n\tpublic function hasEffect($effectId){\n\t\treturn isset($this->effects[$effectId]);\n\t}\n\n\tpublic function addEffect(Effect $effect){\n\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityEffectAddEvent($this, $effect));\n\t\tif($ev->isCancelled()){\n\t\t\treturn false;\n\t\t}\n\t\tif($effect->getId() === Effect::HEALTH_BOOST){\n\t\t\t$this->setHealth($this->getHealth() + 4 * ($effect->getAmplifier() + 1));\n\t\t}\n\t\tif($effect->getId() === Effect::ABSORPTION and $this instanceof Human){\n\t\t\t$this->setAbsorption(4 * ($effect->getAmplifier() + 1));\n\t\t}\n\n\t\tif(isset($this->effects[$effect->getId()])){\n\t\t\t$oldEffect = $this->effects[$effect->getId()];\n\t\t\tif(($effect->getAmplifier() <= ($oldEffect->getAmplifier())) and $effect->getDuration() < $oldEffect->getDuration()){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$effect->add($this, true, $oldEffect);\n\t\t}else{\n\t\t\t$effect->add($this, false);\n\t\t}\n\n\t\t$this->effects[$effect->getId()] = $effect;\n\n\t\t$this->recalculateEffectColor();\n\t\treturn true;\n\t}\n\n\tprotected function recalculateEffectColor(){\n\t\t//TODO: add transparency values\n\t\t$color = [0, 0, 0]; //RGB\n\t\t$count = 0;\n\t\t$ambient = true;\n\t\tforeach($this->effects as $effect){\n\t\t\tif($effect->isVisible()){\n\t\t\t\t$c = $effect->getColor();\n\t\t\t\t$color[0] += $c[0] * ($effect->getAmplifier() + 1);\n\t\t\t\t$color[1] += $c[1] * ($effect->getAmplifier() + 1);\n\t\t\t\t$color[2] += $c[2] * ($effect->getAmplifier() + 1);\n\t\t\t\t$count += $effect->getAmplifier() + 1;\n\t\t\t\tif(!$effect->isAmbient()){\n\t\t\t\t\t$ambient = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($count > 0){\n\t\t\t$r = ($color[0] / $count) & 0xff;\n\t\t\t$g = ($color[1] / $count) & 0xff;\n\t\t\t$b = ($color[2] / $count) & 0xff;\n\n\t\t\t$this->setDataProperty(Entity::DATA_POTION_COLOR, Entity::DATA_TYPE_INT, ($r << 16) + ($g << 8) + $b);\n\t\t\t$this->setDataProperty(Entity::DATA_POTION_AMBIENT, Entity::DATA_TYPE_BYTE, $ambient ? 1 : 0);\n\t\t}else{\n\t\t\t$this->setDataProperty(Entity::DATA_POTION_COLOR, Entity::DATA_TYPE_INT, 0);\n\t\t\t$this->setDataProperty(Entity::DATA_POTION_AMBIENT, Entity::DATA_TYPE_BYTE, 0);\n\t\t}\n\t}\n\n\t/**\n\t * @param int|string  $type\n\t * @param Chunk       $chunk\n\t * @param CompoundTag $nbt\n\t * @param             $args\n\t *\n\t * @return Entity|Projectile\n\t */\n\tpublic static function createEntity($type, Chunk $chunk, CompoundTag $nbt, ...$args){\n\t\tif(isset(self::$knownEntities[$type])){\n\t\t\t$class = self::$knownEntities[$type];\n\t\t\treturn new $class($chunk, $nbt, ...$args);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic static function registerEntity($className, $force = false){\n\t\t$class = new \\ReflectionClass($className);\n\t\tif(is_a($className, Entity::class, true) and !$class->isAbstract()){\n\t\t\tif($className::NETWORK_ID !== -1){\n\t\t\t\tself::$knownEntities[$className::NETWORK_ID] = $className;\n\t\t\t}elseif(!$force){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tself::$knownEntities[$class->getShortName()] = $className;\n\t\t\tself::$shortNames[$className] = $class->getShortName();\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns the short save name\n\t *\n\t * @return string\n\t */\n\tpublic function getSaveId(){\n\t\treturn self::$shortNames[static::class];\n\t}\n\n\tpublic function saveNBT(){\n\t\tif(!($this instanceof Player)){\n\t\t\t$this->namedtag->id = new StringTag(\"id\", $this->getSaveId());\n\t\t\tif($this->getNameTag() !== \"\"){\n\t\t\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $this->getNameTag());\n\t\t\t\t$this->namedtag->CustomNameVisible = new StringTag(\"CustomNameVisible\", $this->isNameTagVisible());\n\t\t\t}else{\n\t\t\t\tunset($this->namedtag->CustomName);\n\t\t\t\tunset($this->namedtag->CustomNameVisible);\n\t\t\t}\n\t\t}\n\n\t\t$this->namedtag->Pos = new ListTag(\"Pos\", [\n\t\t\tnew DoubleTag(0, $this->x),\n\t\t\tnew DoubleTag(1, $this->y),\n\t\t\tnew DoubleTag(2, $this->z)\n\t\t]);\n\n\t\t$this->namedtag->Motion = new ListTag(\"Motion\", [\n\t\t\tnew DoubleTag(0, $this->motionX),\n\t\t\tnew DoubleTag(1, $this->motionY),\n\t\t\tnew DoubleTag(2, $this->motionZ)\n\t\t]);\n\n\t\t$this->namedtag->Rotation = new ListTag(\"Rotation\", [\n\t\t\tnew FloatTag(0, $this->yaw),\n\t\t\tnew FloatTag(1, $this->pitch)\n\t\t]);\n\n\t\t$this->namedtag->FallDistance = new FloatTag(\"FallDistance\", $this->fallDistance);\n\t\t$this->namedtag->Fire = new ShortTag(\"Fire\", $this->fireTicks);\n\t\t$this->namedtag->Air = new ShortTag(\"Air\", $this->getDataProperty(self::DATA_AIR));\n\t\t$this->namedtag->OnGround = new ByteTag(\"OnGround\", $this->onGround == true ? 1 : 0);\n\t\t$this->namedtag->Invulnerable = new ByteTag(\"Invulnerable\", $this->invulnerable == true ? 1 : 0);\n\n\t\tif(count($this->effects) > 0){\n\t\t\t$effects = [];\n\t\t\tforeach($this->effects as $effect){\n\t\t\t\t$effects[$effect->getId()] = new CompoundTag($effect->getId(), [\n\t\t\t\t\t\"Id\" => new ByteTag(\"Id\", $effect->getId()),\n\t\t\t\t\t\"Amplifier\" => new ByteTag(\"Amplifier\", $effect->getAmplifier()),\n\t\t\t\t\t\"Duration\" => new IntTag(\"Duration\", $effect->getDuration()),\n\t\t\t\t\t\"Ambient\" => new ByteTag(\"Ambient\", 0),\n\t\t\t\t\t\"ShowParticles\" => new ByteTag(\"ShowParticles\", $effect->isVisible() ? 1 : 0)\n\t\t\t\t]);\n\t\t\t}\n\n\t\t\t$this->namedtag->ActiveEffects = new ListTag(\"ActiveEffects\", $effects);\n\t\t}else{\n\t\t\tunset($this->namedtag->ActiveEffects);\n\t\t}\n\t}\n\n\tprotected function initEntity(){\n\t\tif(!($this->namedtag instanceof CompoundTag)){\n\t\t\tthrow new \\InvalidArgumentException(\"Expecting CompoundTag, received \" . get_class($this->namedtag));\n\t\t}\n\n\t\tif(isset($this->namedtag->CustomName)){\n\t\t\t$this->setNameTag($this->namedtag[\"CustomName\"]);\n\t\t\tif(isset($this->namedtag->CustomNameVisible)){\n\t\t\t\t$this->setNameTagVisible($this->namedtag[\"CustomNameVisible\"] > 0);\n\t\t\t}\n\t\t}\n\n\t\t$this->scheduleUpdate();\n\n\t\t$this->addAttributes();\n\n\t\tif(isset($this->namedtag->ActiveEffects)){\n\t\t\tforeach($this->namedtag->ActiveEffects->getValue() as $e){\n\t\t\t\t$amplifier = $e[\"Amplifier\"] & 0xff; //0-255 only\n\n\t\t\t\t$effect = Effect::getEffect($e[\"Id\"]);\n\t\t\t\tif($effect === null){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$effect->setAmplifier($amplifier)->setDuration($e[\"Duration\"])->setVisible($e[\"ShowParticles\"] > 0);\n\n\t\t\t\t$this->addEffect($effect);\n\t\t\t}\n\t\t}\n\n\t}\n\n\tprotected function addAttributes(){\n\t}\n\n\t/**\n\t * @return Player[]\n\t */\n\tpublic function getViewers(){\n\t\treturn $this->hasSpawned;\n\t}\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function spawnTo(Player $player){\n\t\tif(!isset($this->hasSpawned[$player->getLoaderId()]) and isset($player->usedChunks[Level::chunkHash($this->chunk->getX(), $this->chunk->getZ())])){\n\t\t\t$this->hasSpawned[$player->getLoaderId()] = $player;\n\t\t}\n\t}\n\n\tpublic function sendPotionEffects(Player $player){\n\t\tforeach($this->effects as $effect){\n\t\t\t$pk = new MobEffectPacket();\n\t\t\t$pk->eid = 0;\n\t\t\t$pk->effectId = $effect->getId();\n\t\t\t$pk->amplifier = $effect->getAmplifier();\n\t\t\t$pk->particles = $effect->isVisible();\n\t\t\t$pk->duration = $effect->getDuration();\n\t\t\t$pk->eventId = MobEffectPacket::EVENT_ADD;\n\n\t\t\t$player->dataPacket($pk);\n\t\t}\n\t}\n\n\t/**\n\t * @param Player[]|Player $player\n\t * @param array           $data Properly formatted entity data, defaults to everything\n\t */\n\tpublic function sendData($player, array $data = null){\n\t\tif(!is_array($player)){\n\t\t\t$player = [$player];\n\t\t}\n\n\t\t$pk = new SetEntityDataPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->metadata = $data === null ? $this->dataProperties : $data;\n\n\t\tforeach($player as $p){\n\t\t\tif($p === $this){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$p->dataPacket(clone $pk);\n\t\t}\n\t\tif($this instanceof Player){\n\t\t\t$pk->eid = 0;\n\t\t\t$this->dataPacket($pk);\n\t\t}\n\t}\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function despawnFrom(Player $player){\n\t\tif(isset($this->hasSpawned[$player->getLoaderId()])){\n\t\t\t$pk = new RemoveEntityPacket();\n\t\t\t$pk->eid = $this->getId();\n\t\t\t$player->dataPacket($pk);\n\t\t\tunset($this->hasSpawned[$player->getLoaderId()]);\n\t\t}\n\t}\n\n\t/**\n\t * @param float             $damage\n\t * @param EntityDamageEvent $source\n\t *\n\t * @return bool\n\t */\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tif($this->hasEffect(Effect::FIRE_RESISTANCE)\n\t\t\tand ($source->getCause() === EntityDamageEvent::CAUSE_FIRE\n\t\t\t\tor $source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK\n\t\t\t\tor $source->getCause() === EntityDamageEvent::CAUSE_LAVA)\n\t\t){\n\t\t\t$source->setCancelled();\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($source);\n\t\tif($source->isCancelled()){\n\t\t\treturn false;\n\t\t}\n\t\t$this->setLastDamageCause($source);\n\n\t\tif($this instanceof Human){\n\t\t\t$damage = round($source->getFinalDamage());\n\t\t\tif($this->getAbsorption() > 0){\n\t\t\t\t$absorption = $this->getAbsorption() - $damage;\n\t\t\t\t$this->setAbsorption($absorption <= 0 ? 0 : $absorption);\n\t\t\t\t$this->setHealth($this->getHealth() + $absorption);\n\t\t\t}else{\n\t\t\t\t$this->setHealth($this->getHealth() - $damage);\n\t\t\t}\n\t\t}else{\n\t\t\t$this->setHealth($this->getHealth() - round($source->getFinalDamage()));\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param float                   $amount\n\t * @param EntityRegainHealthEvent $source\n\t *\n\t */\n\tpublic function heal($amount, EntityRegainHealthEvent $source){\n\t\t$this->server->getPluginManager()->callEvent($source);\n\t\tif($source->isCancelled()){\n\t\t\treturn;\n\t\t}\n\n\t\t$this->setHealth($this->getHealth() + $source->getAmount());\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getHealth(){\n\t\treturn $this->health;\n\t}\n\n\tpublic function isAlive(){\n\t\treturn $this->health > 0;\n\t}\n\n\t/**\n\t * Sets the health of the Entity. This won't send any update to the players\n\t *\n\t * @param int $amount\n\t */\n\tpublic function setHealth($amount){\n\t\t$amount = (int) $amount;\n\t\tif($amount === $this->health){\n\t\t\treturn;\n\t\t}\n\n\t\tif($amount <= 0){\n\t\t\tif($this->isAlive()){\n\t\t\t\t$this->kill();\n\t\t\t}\n\t\t}elseif($amount <= $this->getMaxHealth() or $amount < $this->health){\n\t\t\t$this->health = (int) $amount;\n\t\t}else{\n\t\t\t$this->health = $this->getMaxHealth();\n\t\t}\n\t}\n\n\t/**\n\t * @param EntityDamageEvent $type\n\t */\n\tpublic function setLastDamageCause(EntityDamageEvent $type){\n\t\t$this->lastDamageCause = $type;\n\t}\n\n\t/**\n\t * @return EntityDamageEvent|null\n\t */\n\tpublic function getLastDamageCause(){\n\t\treturn $this->lastDamageCause;\n\t}\n\n\tpublic function getAttributeMap(){\n\t\treturn $this->attributeMap;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getMaxHealth(){\n\t\treturn $this->maxHealth + ($this->hasEffect(Effect::HEALTH_BOOST) ? 4 * ($this->getEffect(Effect::HEALTH_BOOST)->getAmplifier() + 1) : 0);\n\t}\n\n\t/**\n\t * @param int $amount\n\t */\n\tpublic function setMaxHealth($amount){\n\t\t$this->maxHealth = (int) $amount;\n\t}\n\n\tpublic function canCollideWith(Entity $entity){\n\t\treturn !$this->justCreated and $entity !== $this;\n\t}\n\n\tprotected function checkObstruction($x, $y, $z){\n\t\t$i = Math::floorFloat($x);\n\t\t$j = Math::floorFloat($y);\n\t\t$k = Math::floorFloat($z);\n\n\t\t$diffX = $x - $i;\n\t\t$diffY = $y - $j;\n\t\t$diffZ = $z - $k;\n\n\t\tif(Block::$solid[$this->level->getBlockIdAt($i, $j, $k)]){\n\t\t\t$flag = !Block::$solid[$this->level->getBlockIdAt($i - 1, $j, $k)];\n\t\t\t$flag1 = !Block::$solid[$this->level->getBlockIdAt($i + 1, $j, $k)];\n\t\t\t$flag2 = !Block::$solid[$this->level->getBlockIdAt($i, $j - 1, $k)];\n\t\t\t$flag3 = !Block::$solid[$this->level->getBlockIdAt($i, $j + 1, $k)];\n\t\t\t$flag4 = !Block::$solid[$this->level->getBlockIdAt($i, $j, $k - 1)];\n\t\t\t$flag5 = !Block::$solid[$this->level->getBlockIdAt($i, $j, $k + 1)];\n\n\t\t\t$direction = -1;\n\t\t\t$limit = 9999;\n\n\t\t\tif($flag){\n\t\t\t\t$limit = $diffX;\n\t\t\t\t$direction = 0;\n\t\t\t}\n\n\t\t\tif($flag1 and 1 - $diffX < $limit){\n\t\t\t\t$limit = 1 - $diffX;\n\t\t\t\t$direction = 1;\n\t\t\t}\n\n\t\t\tif($flag2 and $diffY < $limit){\n\t\t\t\t$limit = $diffY;\n\t\t\t\t$direction = 2;\n\t\t\t}\n\n\t\t\tif($flag3 and 1 - $diffY < $limit){\n\t\t\t\t$limit = 1 - $diffY;\n\t\t\t\t$direction = 3;\n\t\t\t}\n\n\t\t\tif($flag4 and $diffZ < $limit){\n\t\t\t\t$limit = $diffZ;\n\t\t\t\t$direction = 4;\n\t\t\t}\n\n\t\t\tif($flag5 and 1 - $diffZ < $limit){\n\t\t\t\t$direction = 5;\n\t\t\t}\n\n\t\t\t$force = lcg_value() * 0.2 + 0.1;\n\n\t\t\tif($direction === 0){\n\t\t\t\t$this->motionX = -$force;\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif($direction === 1){\n\t\t\t\t$this->motionX = $force;\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif($direction === 2){\n\t\t\t\t$this->motionY = -$force;\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif($direction === 3){\n\t\t\t\t$this->motionY = $force;\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif($direction === 4){\n\t\t\t\t$this->motionZ = -$force;\n\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif($direction === 5){\n\t\t\t\t$this->motionZ = $force;\n\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function entityBaseTick($tickDiff = 1){\n\n\t\tTimings::$timerEntityBaseTick->startTiming();\n\t\t//TODO: check vehicles\n\n\t\t$this->blocksAround = null;\n\t\t$this->justCreated = false;\n\n\t\tif(!$this->isAlive()){\n\t\t\t$this->removeAllEffects();\n\t\t\t$this->despawnFromAll();\n\t\t\tif(!$this->isPlayer){\n\t\t\t\t$this->close();\n\t\t\t}\n\n\t\t\tTimings::$timerEntityBaseTick->stopTiming();\n\t\t\treturn false;\n\t\t}\n\n\t\tif(count($this->effects) > 0){\n\t\t\tforeach($this->effects as $effect){\n\t\t\t\tif($effect->canTick()){\n\t\t\t\t\t$effect->applyEffect($this);\n\t\t\t\t}\n\t\t\t\t$effect->setDuration($effect->getDuration() - $tickDiff);\n\t\t\t\tif($effect->getDuration() <= 0){\n\t\t\t\t\t$this->removeEffect($effect->getId());\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$hasUpdate = false;\n\n\t\t$this->checkBlockCollision();\n\n\t\tif($this->y <= -16 and $this->isAlive()){\n\t\t\t$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_VOID, 10);\n\t\t\t$this->attack($ev->getFinalDamage(), $ev);\n\t\t\t$hasUpdate = true;\n\t\t}\n\n\t\tif($this->fireTicks > 0){\n\t\t\tif($this->isFireProof()){\n\t\t\t\tif($this->fireTicks > 1){\n\t\t\t\t\t$this->fireTicks = 1;\n\t\t\t\t}else{\n\t\t\t\t\t$this->fireTicks -= 1;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(!$this->hasEffect(Effect::FIRE_RESISTANCE) and (($this->fireTicks % 20) === 0 or $tickDiff > 20)){\n\t\t\t\t\t$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FIRE_TICK, 1);\n\t\t\t\t\t$this->attack($ev->getFinalDamage(), $ev);\n\t\t\t\t}\n\t\t\t\t$this->fireTicks -= $tickDiff;\n\t\t\t}\n\n\t\t\tif($this->fireTicks <= 0 && $this->fireTicks > -10){\n\t\t\t\t$this->extinguish();\n\t\t\t}else{\n\t\t\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ONFIRE, true);\n\t\t\t\t$hasUpdate = true;\n\t\t\t}\n\t\t}\n\n\t\tif($this->noDamageTicks > 0){\n\t\t\t$this->noDamageTicks -= $tickDiff;\n\t\t\tif($this->noDamageTicks < 0){\n\t\t\t\t$this->noDamageTicks = 0;\n\t\t\t}\n\t\t}\n\n\t\t$this->age += $tickDiff;\n\t\t$this->ticksLived += $tickDiff;\n\n\t\tTimings::$timerEntityBaseTick->stopTiming();\n\n\t\treturn $hasUpdate;\n\t}\n\n\tprotected function updateMovement(){\n\t\t$diffPosition = ($this->x - $this->lastX) ** 2 + ($this->y - $this->lastY) ** 2 + ($this->z - $this->lastZ) ** 2;\n\t\t$diffRotation = ($this->yaw - $this->lastYaw) ** 2 + ($this->pitch - $this->lastPitch) ** 2;\n\n\t\t$diffMotion = ($this->motionX - $this->lastMotionX) ** 2 + ($this->motionY - $this->lastMotionY) ** 2 + ($this->motionZ - $this->lastMotionZ) ** 2;\n\n\t\tif($diffPosition > 0.04 or $diffRotation > 2.25 and ($diffMotion > 0.0001 and $this->getMotion()->lengthSquared() <= 0.00001)){ //0.2 ** 2, 1.5 ** 2\n\t\t\t$this->lastX = $this->x;\n\t\t\t$this->lastY = $this->y;\n\t\t\t$this->lastZ = $this->z;\n\n\t\t\t$this->lastYaw = $this->yaw;\n\t\t\t$this->lastPitch = $this->pitch;\n\n\t\t\t$this->addMovement($this->x, $this->y + $this->getEyeHeight(), $this->z, $this->yaw, $this->pitch, $this->yaw);\n\t\t}\n\n\t\tif($diffMotion > 0.0025 or ($diffMotion > 0.0001 and $this->getMotion()->lengthSquared() <= 0.0001)){ //0.05 ** 2\n\t\t\t$this->lastMotionX = $this->motionX;\n\t\t\t$this->lastMotionY = $this->motionY;\n\t\t\t$this->lastMotionZ = $this->motionZ;\n\n\t\t\t$this->level->addEntityMotion($this->chunk->getX(), $this->chunk->getZ(), $this->id, $this->motionX, $this->motionY, $this->motionZ);\n\t\t}\n\t}\n\n\tpublic function addMovement($x, $y, $z, $yaw, $pitch, $headYaw = null){\n\t\t$this->level->addEntityMovement($this->chunk->getX(), $this->chunk->getZ(), $this->id, $x, $y, $z, $yaw, $pitch, $headYaw === null ? $yaw : $headYaw);\n\t}\n\n\t/**\n\t * @return Vector3\n\t */\n\tpublic function getDirectionVector(){\n\t\t$y = -sin(deg2rad($this->pitch));\n\t\t$xz = cos(deg2rad($this->pitch));\n\t\t$x = -$xz * sin(deg2rad($this->yaw));\n\t\t$z = $xz * cos(deg2rad($this->yaw));\n\n\t\treturn $this->temporalVector->setComponents($x, $y, $z)->normalize();\n\t}\n\n\tpublic function getDirectionPlane(){\n\t\treturn (new Vector2(-cos(deg2rad($this->yaw) - M_PI_2), -sin(deg2rad($this->yaw) - M_PI_2)))->normalize();\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!$this->isAlive()){\n\t\t\t++$this->deadTicks;\n\t\t\tif($this->deadTicks >= 10){\n\t\t\t\t$this->despawnFromAll();\n\t\t\t\tif(!$this->isPlayer){\n\t\t\t\t\t$this->close();\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $this->deadTicks < 10;\n\t\t}\n\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\n\t\tif($tickDiff <= 0){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->lastUpdate = $currentTick;\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = $this->entityBaseTick($tickDiff);\n\n\t\t$this->updateMovement();\n\n\t\t$this->timings->stopTiming();\n\n\t\t//if($this->isStatic())\n\t\treturn $hasUpdate;\n\t\t//return !($this instanceof Player);\n\t}\n\n\tpublic final function scheduleUpdate(){\n\t\t$this->level->updateEntities[$this->id] = $this;\n\t}\n\n\tpublic function isOnFire(){\n\t\treturn $this->fireTicks > 0;\n\t}\n\n\tpublic function setOnFire($seconds){\n\t\t$ticks = $seconds * 20;\n\t\tif($ticks > $this->fireTicks){\n\t\t\t$this->fireTicks = $ticks;\n\t\t}\n\t}\n\n\tpublic function isFireProof() : bool{\n\t\treturn false;\n\t}\n\n\tpublic function getDirection(){\n\t\t$rotation = ($this->yaw - 90) % 360;\n\t\tif($rotation < 0){\n\t\t\t$rotation += 360.0;\n\t\t}\n\t\tif((0 <= $rotation and $rotation < 45) or (315 <= $rotation and $rotation < 360)){\n\t\t\treturn 2; //North\n\t\t}elseif(45 <= $rotation and $rotation < 135){\n\t\t\treturn 3; //East\n\t\t}elseif(135 <= $rotation and $rotation < 225){\n\t\t\treturn 0; //South\n\t\t}elseif(225 <= $rotation and $rotation < 315){\n\t\t\treturn 1; //West\n\t\t}else{\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic function extinguish(){\n\t\t$this->fireTicks = 0;\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_ONFIRE, false);\n\t}\n\n\tpublic function canTriggerWalking(){\n\t\treturn true;\n\t}\n\n\tpublic function resetFallDistance(){\n\t\t$this->fallDistance = 0;\n\t}\n\n\tprotected function updateFallState($distanceThisTick, $onGround){\n\t\tif($onGround === true){\n\t\t\tif($this->fallDistance > 0){\n\t\t\t\tif($this instanceof Living){\n\t\t\t\t\t$this->fall($this->fallDistance);\n\t\t\t\t}\n\t\t\t\t$this->resetFallDistance();\n\t\t\t}\n\t\t}elseif($distanceThisTick < 0){\n\t\t\t$this->fallDistance -= $distanceThisTick;\n\t\t}\n\t}\n\n\tpublic function getBoundingBox(){\n\t\treturn $this->boundingBox;\n\t}\n\n\tpublic function fall($fallDistance){\n\t\tif($this instanceof Player and $this->isSpectator()){\n\t\t\treturn;\n\t\t}\n\t\tif($this->getLevel()->getServer()->destroyBlockParticle and $fallDistance > 3){\n\t\t\t$this->getLevel()->addParticle(new DestroyBlockParticle($this, $this->getLevel()->getBlock($this->floor()->subtract(0, 1, 0))));\n\t\t}\n\t\tif($this->isInsideOfWater()){\n\t\t\treturn;\n\t\t}\n\t\t$damage = floor($fallDistance - 3 - ($this->hasEffect(Effect::JUMP) ? $this->getEffect(Effect::JUMP)->getAmplifier() + 1 : 0));\n\n\t\t//Get the block directly beneath the player's feet, check if it is a slime block\n\t\tif($this->getLevel()->getBlock($this->floor()->subtract(0, 1, 0)) instanceof SlimeBlock){\n\t\t\t$damage = 0;\n\t\t}\n\t\tif($damage > 0){\n\t\t\t$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_FALL, $damage);\n\t\t\t$this->attack($ev->getFinalDamage(), $ev);\n\t\t}\n\t}\n\n\tpublic function handleLavaMovement(){ //TODO\n\n\t}\n\n\tpublic function getEyeHeight(){\n\t\treturn $this->eyeHeight;\n\t}\n\n\tpublic function moveFlying(){ //TODO\n\n\t}\n\n\tpublic function onCollideWithPlayer(Human $entityPlayer){\n\n\t}\n\n\tprotected function switchLevel(Level $targetLevel){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\tif($this->isValid()){\n\t\t\t$this->server->getPluginManager()->callEvent($ev = new EntityLevelChangeEvent($this, $this->level, $targetLevel));\n\t\t\tif($ev->isCancelled()){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$this->level->removeEntity($this);\n\t\t\tif($this->chunk !== null){\n\t\t\t\t$this->chunk->removeEntity($this);\n\t\t\t}\n\t\t\t$this->despawnFromAll();\n\t\t}\n\n\t\t$this->setLevel($targetLevel);\n\t\t$this->level->addEntity($this);\n\t\t$this->chunk = null;\n\n\t\treturn true;\n\t}\n\n\tpublic function getPosition(){\n\t\treturn new Position($this->x, $this->y, $this->z, $this->level);\n\t}\n\n\tpublic function getLocation(){\n\t\treturn new Location($this->x, $this->y, $this->z, $this->yaw, $this->pitch, $this->level);\n\t}\n\n\tpublic function isInsideOfPortal(){\n\t\t$blocks = $this->getBlocksAround();\n\n\t\tforeach($blocks as $block){\n\t\t\tif($block instanceof Portal){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function isInsideOfWater(){\n\t\t$block = $this->level->getBlock($this->temporalVector->setComponents(Math::floorFloat($this->x), Math::floorFloat($y = ($this->y + $this->getEyeHeight())), Math::floorFloat($this->z)));\n\n\t\tif($block instanceof Water){\n\t\t\t$f = ($block->y + 1) - ($block->getFluidHeightPercent() - 0.1111111);\n\t\t\treturn $y < $f;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function isInsideOfSolid(){\n\t\t$block = $this->level->getBlock($this->temporalVector->setComponents(Math::floorFloat($this->x), Math::floorFloat($y = ($this->y + $this->getEyeHeight())), Math::floorFloat($this->z)));\n\n\t\t$bb = $block->getBoundingBox();\n\n\t\tif($bb !== null and $block->isSolid() and !$block->isTransparent() and $bb->intersectsWith($this->getBoundingBox())){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function isInsideOfFire(){\n\t\tforeach($this->getBlocksAround() as $block){\n\t\t\tif($block instanceof Fire){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function fastMove($dx, $dy, $dz){\n\t\tif($dx == 0 and $dz == 0 and $dy == 0){\n\t\t\treturn true;\n\t\t}\n\n\t\tTimings::$entityMoveTimer->startTiming();\n\n\t\t/*$newBB = $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz);\n\n\t\t$list = $this->level->getCollisionCubes($this, $newBB, false);\n\n\t\tif(count($list) === 0){\n\t\t\t$this->boundingBox = $newBB;\n\t\t}*/\n\n\t\t$this->x = ($this->boundingBox->minX + $this->boundingBox->maxX) / 2;\n\t\t$this->y = $this->boundingBox->minY - $this->ySize;\n\t\t$this->z = ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2;\n\n\t\t$this->checkChunks();\n\n\t\tif(!$this->onGround or $dy != 0){\n\t\t\t$bb = clone $this->boundingBox;\n\t\t\t$bb->minY -= 0.75;\n\t\t\t$this->onGround = false;\n\t\t\tif(!$this->level->getBlock(new Vector3($this->x, $this->y - 1, $this->z))->isTransparent())\n\t\t\t\t$this->onGround = true;\n\t\t\t/*\n                        if(count($this->level->getCollisionBlocks($bb)) > 0){\n                            $this->onGround = true;\n                        }*/\n\t\t}\n\t\t$this->isCollided = $this->onGround;\n\t\t$this->updateFallState($dy, $this->onGround);\n\n\n\t\tTimings::$entityMoveTimer->stopTiming();\n\n\t\treturn true;\n\t}\n\n\tpublic function move($dx, $dy, $dz){\n\n\t\tif($dx == 0 and $dz == 0 and $dy == 0){\n\t\t\treturn true;\n\t\t}\n\n\t\tif($this->keepMovement){\n\t\t\t$this->boundingBox->offset($dx, $dy, $dz);\n\t\t\t$this->setPosition($this->temporalVector->setComponents(($this->boundingBox->minX + $this->boundingBox->maxX) / 2, $this->boundingBox->minY, ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2));\n\t\t\t$this->onGround = $this->isPlayer ? true : false;\n\t\t\treturn true;\n\t\t}else{\n\n\t\t\tTimings::$entityMoveTimer->startTiming();\n\n\t\t\t$this->ySize *= 0.4;\n\n\t\t\t/*\n\t\t\tif($this->isColliding){ //With cobweb?\n\t\t\t\t$this->isColliding = false;\n\t\t\t\t$dx *= 0.25;\n\t\t\t\t$dy *= 0.05;\n\t\t\t\t$dz *= 0.25;\n\t\t\t\t$this->motionX = 0;\n\t\t\t\t$this->motionY = 0;\n\t\t\t\t$this->motionZ = 0;\n\t\t\t}\n\t\t\t*/\n\n\t\t\t$movX = $dx;\n\t\t\t$movY = $dy;\n\t\t\t$movZ = $dz;\n\n\t\t\t$axisalignedbb = clone $this->boundingBox;\n\n\t\t\t/*$sneakFlag = $this->onGround and $this instanceof Player;\n\n\t\t\tif($sneakFlag){\n\t\t\t\tfor($mov = 0.05; $dx != 0.0 and count($this->level->getCollisionCubes($this, $this->boundingBox->getOffsetBoundingBox($dx, -1, 0))) === 0; $movX = $dx){\n\t\t\t\t\tif($dx < $mov and $dx >= -$mov){\n\t\t\t\t\t\t$dx = 0;\n\t\t\t\t\t}elseif($dx > 0){\n\t\t\t\t\t\t$dx -= $mov;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$dx += $mov;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor(; $dz != 0.0 and count($this->level->getCollisionCubes($this, $this->boundingBox->getOffsetBoundingBox(0, -1, $dz))) === 0; $movZ = $dz){\n\t\t\t\t\tif($dz < $mov and $dz >= -$mov){\n\t\t\t\t\t\t$dz = 0;\n\t\t\t\t\t}elseif($dz > 0){\n\t\t\t\t\t\t$dz -= $mov;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$dz += $mov;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//TODO: big messy loop\n\t\t\t}*/\n\n\t\t\t$list = $this->level->getCollisionCubes($this, $this->level->getTickRate() > 1 ? $this->boundingBox->getOffsetBoundingBox($dx, $dy, $dz) : $this->boundingBox->addCoord($dx, $dy, $dz), false);\n\n\t\t\tforeach($list as $bb){\n\t\t\t\t$dy = $bb->calculateYOffset($this->boundingBox, $dy);\n\t\t\t}\n\n\t\t\t$this->boundingBox->offset(0, $dy, 0);\n\n\t\t\t$fallingFlag = ($this->onGround or ($dy != $movY and $movY < 0));\n\n\t\t\tforeach($list as $bb){\n\t\t\t\t$dx = $bb->calculateXOffset($this->boundingBox, $dx);\n\t\t\t}\n\n\t\t\t$this->boundingBox->offset($dx, 0, 0);\n\n\t\t\tforeach($list as $bb){\n\t\t\t\t$dz = $bb->calculateZOffset($this->boundingBox, $dz);\n\t\t\t}\n\n\t\t\t$this->boundingBox->offset(0, 0, $dz);\n\n\n\t\t\tif($this->stepHeight > 0 and $fallingFlag and $this->ySize < 0.05 and ($movX != $dx or $movZ != $dz)){\n\t\t\t\t$cx = $dx;\n\t\t\t\t$cy = $dy;\n\t\t\t\t$cz = $dz;\n\t\t\t\t$dx = $movX;\n\t\t\t\t$dy = $this->stepHeight;\n\t\t\t\t$dz = $movZ;\n\n\t\t\t\t$axisalignedbb1 = clone $this->boundingBox;\n\n\t\t\t\t$this->boundingBox->setBB($axisalignedbb);\n\n\t\t\t\t$list = $this->level->getCollisionCubes($this, $this->boundingBox->addCoord($dx, $dy, $dz), false);\n\n\t\t\t\tforeach($list as $bb){\n\t\t\t\t\t$dy = $bb->calculateYOffset($this->boundingBox, $dy);\n\t\t\t\t}\n\n\t\t\t\t$this->boundingBox->offset(0, $dy, 0);\n\n\t\t\t\tforeach($list as $bb){\n\t\t\t\t\t$dx = $bb->calculateXOffset($this->boundingBox, $dx);\n\t\t\t\t}\n\n\t\t\t\t$this->boundingBox->offset($dx, 0, 0);\n\n\t\t\t\tforeach($list as $bb){\n\t\t\t\t\t$dz = $bb->calculateZOffset($this->boundingBox, $dz);\n\t\t\t\t}\n\n\t\t\t\t$this->boundingBox->offset(0, 0, $dz);\n\n\t\t\t\tif(($cx ** 2 + $cz ** 2) >= ($dx ** 2 + $dz ** 2)){\n\t\t\t\t\t$dx = $cx;\n\t\t\t\t\t$dy = $cy;\n\t\t\t\t\t$dz = $cz;\n\t\t\t\t\t$this->boundingBox->setBB($axisalignedbb1);\n\t\t\t\t}else{\n\t\t\t\t\t$this->ySize += 0.5;\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\t$this->x = ($this->boundingBox->minX + $this->boundingBox->maxX) / 2;\n\t\t\t$this->y = $this->boundingBox->minY - $this->ySize;\n\t\t\t$this->z = ($this->boundingBox->minZ + $this->boundingBox->maxZ) / 2;\n\n\t\t\t$this->checkChunks();\n\n\t\t\t$this->checkGroundState($movX, $movY, $movZ, $dx, $dy, $dz);\n\t\t\t$this->updateFallState($dy, $this->onGround);\n\n\t\t\tif($movX != $dx){\n\t\t\t\t$this->motionX = 0;\n\t\t\t}\n\n\t\t\tif($movY != $dy){\n\t\t\t\t$this->motionY = 0;\n\t\t\t}\n\n\t\t\tif($movZ != $dz){\n\t\t\t\t$this->motionZ = 0;\n\t\t\t}\n\n\n\t\t\t//TODO: vehicle collision events (first we need to spawn them!)\n\n\t\t\tTimings::$entityMoveTimer->stopTiming();\n\n\t\t\treturn true;\n\t\t}\n\t}\n\n\tprotected function checkGroundState($movX, $movY, $movZ, $dx, $dy, $dz){\n\t\t$this->isCollidedVertically = $movY != $dy;\n\t\t$this->isCollidedHorizontally = ($movX != $dx or $movZ != $dz);\n\t\t$this->isCollided = ($this->isCollidedHorizontally or $this->isCollidedVertically);\n\t\t$this->onGround = ($movY != $dy and $movY < 0);\n\t}\n\n\tpublic function getBlocksAround(){\n\t\tif($this->blocksAround === null){\n\t\t\t$minX = Math::floorFloat($this->boundingBox->minX);\n\t\t\t$minY = Math::floorFloat($this->boundingBox->minY);\n\t\t\t$minZ = Math::floorFloat($this->boundingBox->minZ);\n\t\t\t$maxX = Math::ceilFloat($this->boundingBox->maxX);\n\t\t\t$maxY = Math::ceilFloat($this->boundingBox->maxY);\n\t\t\t$maxZ = Math::ceilFloat($this->boundingBox->maxZ);\n\n\t\t\t$this->blocksAround = [];\n\n\t\t\tfor($z = $minZ; $z <= $maxZ; ++$z){\n\t\t\t\tfor($x = $minX; $x <= $maxX; ++$x){\n\t\t\t\t\tfor($y = $minY; $y <= $maxY; ++$y){\n\t\t\t\t\t\t$block = $this->level->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\t\t\t\t\t\tif($block->hasEntityCollision()){\n\t\t\t\t\t\t\t$this->blocksAround[Level::blockHash($block->x, $block->y, $block->z)] = $block;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $this->blocksAround;\n\t}\n\n\tprotected function checkBlockCollision(){\n\t\t$vector = new Vector3(0, 0, 0);\n\n\t\tforeach($blocksaround = $this->getBlocksAround() as $block){\n\t\t\t$block->onEntityCollide($this);\n\t\t\tif(!$this->isPlayer){\n\t\t\t\tif($block instanceof PressurePlate){\n\t\t\t\t\t$this->activatedPressurePlates[Level::blockHash($block->x, $block->y, $block->z)] = $block;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$block->addVelocityToEntity($this, $vector);\n\t\t}\n\n\t\tif(!$this->isPlayer){\n\t\t\t/** @var \\pocketmine\\block\\PressurePlate $block * */\n\t\t\tforeach($this->activatedPressurePlates as $key => $block){\n\t\t\t\tif(!isset($blocksaround[$key])) $block->checkActivation();\n\t\t\t}\n\t\t}\n\n\t\tif($vector->lengthSquared() > 0){\n\t\t\t$vector = $vector->normalize();\n\t\t\t$d = 0.014;\n\t\t\t$this->motionX += $vector->x * $d;\n\t\t\t$this->motionY += $vector->y * $d;\n\t\t\t$this->motionZ += $vector->z * $d;\n\t\t}\n\t}\n\n\tpublic function setPositionAndRotation(Vector3 $pos, $yaw, $pitch){\n\t\tif($this->setPosition($pos) === true){\n\t\t\t$this->setRotation($yaw, $pitch);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function setRotation($yaw, $pitch){\n\t\t$this->yaw = $yaw;\n\t\t$this->pitch = $pitch;\n\t\t$this->scheduleUpdate();\n\t}\n\n\tprotected function checkChunks(){\n\t\tif($this->chunk === null or ($this->chunk->getX() !== ($this->x >> 4) or $this->chunk->getZ() !== ($this->z >> 4))){\n\t\t\tif($this->chunk !== null){\n\t\t\t\t$this->chunk->removeEntity($this);\n\t\t\t}\n\t\t\t$this->chunk = $this->level->getChunk($this->x >> 4, $this->z >> 4, true);\n\n\t\t\tif(!$this->justCreated){\n\t\t\t\t$newChunk = $this->level->getChunkPlayers($this->x >> 4, $this->z >> 4);\n\t\t\t\tforeach($this->hasSpawned as $player){\n\t\t\t\t\tif(!isset($newChunk[$player->getLoaderId()])){\n\t\t\t\t\t\t$this->despawnFrom($player);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tunset($newChunk[$player->getLoaderId()]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tforeach($newChunk as $player){\n\t\t\t\t\t$this->spawnTo($player);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($this->chunk === null){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$this->chunk->addEntity($this);\n\t\t}\n\t}\n\n\tpublic function setLocation(Location $pos){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->setPositionAndRotation($pos, $pos->yaw, $pos->pitch);\n\n\t\treturn true;\n\t}\n\n\tpublic function setPosition(Vector3 $pos){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\tif($pos instanceof Position and $pos->level !== null and $pos->level !== $this->level){\n\t\t\tif($this->switchLevel($pos->getLevel()) === false){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t$this->x = $pos->x;\n\t\t$this->y = $pos->y;\n\t\t$this->z = $pos->z;\n\n\t\t$radius = $this->width / 2;\n\t\t$this->boundingBox->setBounds($pos->x - $radius, $pos->y, $pos->z - $radius, $pos->x + $radius, $pos->y + $this->height, $pos->z + $radius);\n\n\t\t$this->checkChunks();\n\n\t\treturn true;\n\t}\n\n\tpublic function getMotion(){\n\t\treturn new Vector3($this->motionX, $this->motionY, $this->motionZ);\n\t}\n\n\tpublic function setMotion(Vector3 $motion){\n\t\tif(!$this->justCreated){\n\t\t\t$this->server->getPluginManager()->callEvent($ev = new EntityMotionEvent($this, $motion));\n\t\t\tif($ev->isCancelled()){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t$this->motionX = $motion->x;\n\t\t$this->motionY = $motion->y;\n\t\t$this->motionZ = $motion->z;\n\n\t\tif(!$this->justCreated){\n\t\t\t$this->updateMovement();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function isOnGround(){\n\t\treturn $this->onGround === true;\n\t}\n\n\tpublic function kill(){\n\t\t$this->health = 0;\n\t\t$this->removeAllEffects();\n\t\t$this->scheduleUpdate();\n\n\t\tif($this->getLevel()->getServer()->expEnabled){\n\t\t\t$exp = mt_rand($this->getDropExpMin(), $this->getDropExpMax());\n\t\t\tif($exp > 0) $this->getLevel()->spawnXPOrb($this, $exp);\n\t\t}\n\t}\n\n\t/**\n\t * @param Vector3|Position|Location $pos\n\t * @param float                     $yaw\n\t * @param float                     $pitch\n\t *\n\t * @return bool\n\t */\n\tpublic function teleport(Vector3 $pos, $yaw = null, $pitch = null){\n\t\tif($pos instanceof Location){\n\t\t\t$yaw = $yaw === null ? $pos->yaw : $yaw;\n\t\t\t$pitch = $pitch === null ? $pos->pitch : $pitch;\n\t\t}\n\t\t$from = Position::fromObject($this, $this->level);\n\t\t$to = Position::fromObject($pos, $pos instanceof Position ? $pos->getLevel() : $this->level);\n\t\t$this->server->getPluginManager()->callEvent($ev = new EntityTeleportEvent($this, $from, $to));\n\t\tif($ev->isCancelled()){\n\t\t\treturn false;\n\t\t}\n\t\t$this->ySize = 0;\n\t\t$pos = $ev->getTo();\n\n\t\t$this->setMotion($this->temporalVector->setComponents(0, 0, 0));\n\t\tif($this->setPositionAndRotation($pos, $yaw === null ? $this->yaw : $yaw, $pitch === null ? $this->pitch : $pitch) !== false){\n\t\t\t$this->resetFallDistance();\n\t\t\t$this->onGround = true;\n\n\t\t\t$this->lastX = $this->x;\n\t\t\t$this->lastY = $this->y;\n\t\t\t$this->lastZ = $this->z;\n\n\t\t\t$this->lastYaw = $this->yaw;\n\t\t\t$this->lastPitch = $this->pitch;\n\n\t\t\t$this->updateMovement();\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function respawnToAll(){\n\t\tforeach($this->hasSpawned as $key => $player){\n\t\t\tunset($this->hasSpawned[$key]);\n\t\t\t$this->spawnTo($player);\n\t\t}\n\t}\n\n\tpublic function spawnToAll(){\n\t\tif($this->chunk === null or $this->closed){\n\t\t\treturn;\n\t\t}\n\t\tforeach($this->level->getChunkPlayers($this->chunk->getX(), $this->chunk->getZ()) as $player){\n\t\t\tif($player->isOnline()){\n\t\t\t\t$this->spawnTo($player);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function despawnFromAll(){\n\t\tforeach($this->hasSpawned as $player){\n\t\t\t$this->despawnFrom($player);\n\t\t}\n\t}\n\n\tpublic function close(){\n\t\tif(!$this->closed){\n\t\t\t$this->server->getPluginManager()->callEvent(new EntityDespawnEvent($this));\n\t\t\t$this->closed = true;\n\t\t\t$this->removeEffect(Effect::HEALTH_BOOST);\n\t\t\t$this->despawnFromAll();\n\t\t\tif($this->linkedType != 0){\n\t\t\t\t$this->linkedEntity->setLinked(0, $this);\n\t\t\t}\n\t\t\tif($this->chunk !== null){\n\t\t\t\t$this->chunk->removeEntity($this);\n\t\t\t}\n\t\t\tif($this->level !== null){\n\t\t\t\t$this->level->removeEntity($this);\n\t\t\t}\n\t\t}\n\n\t\t$this->activatedPressurePlates = [];\n\n\t\tif($this->attributeMap != null){\n\t\t\t$this->attributeMap = null;\n\t\t}\n\t}\n\n\t/**\n\t * @param int   $id\n\t * @param int   $type\n\t * @param mixed $value\n\t *\n\t * @return bool\n\t */\n\tpublic function setDataProperty($id, $type, $value){\n\t\tif($this->getDataProperty($id) !== $value){\n\t\t\t$this->dataProperties[$id] = [$type, $value];\n\n\t\t\t$this->sendData($this->hasSpawned, [$id => $this->dataProperties[$id]]);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function linkEntity(Entity $entity){\n\t\treturn $this->setLinked(1, $entity);\n\t}\n\n\tpublic function sendLinkedData(){\n\t\tif($this->linkedEntity instanceof Entity){\n\t\t\t$this->setLinked($this->linkedType, $this->linkedEntity);\n\t\t}\n\t}\n\n\tpublic function setLinked($type = 0, Entity $entity){\n\t\tif($type != 0 and $entity === null){\n\t\t\treturn false;\n\t\t}\n\t\tif($entity === $this){\n\t\t\treturn false;\n\t\t}\n\t\tswitch($type){\n\t\t\tcase 0:\n\t\t\t\tif($this->linkedType == 0){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t$this->linkedType = 0;\n\t\t\t\t$pk = new SetEntityLinkPacket();\n\t\t\t\t$pk->from = $entity->getId();\n\t\t\t\t$pk->to = $this->getId();\n\t\t\t\t$pk->type = 3;\n\t\t\t\t$this->server->broadcastPacket($this->level->getPlayers(), $pk);\n\t\t\t\tif($this instanceof Player){\n\t\t\t\t\t$pk = new SetEntityLinkPacket();\n\t\t\t\t\t$pk->from = $entity->getId();\n\t\t\t\t\t$pk->to = 0;\n\t\t\t\t\t$pk->type = 3;\n\t\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t}\n\t\t\t\tif($this->linkedEntity->getLinkedType()){\n\t\t\t\t\t$this->linkedEntity->setLinked(0, $this);\n\t\t\t\t}\n\t\t\t\t$this->linkedEntity = null;\n\t\t\t\treturn true;\n\t\t\tcase 1:\n\t\t\t\tif(!$entity->isAlive()){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$this->linkedEntity = $entity;\n\t\t\t\t$this->linkedType = 1;\n\t\t\t\t$entity->linkedEntity = $this;\n\t\t\t\t$entity->linkedType = 1;\n\t\t\t\t$pk = new SetEntityLinkPacket();\n\t\t\t\t$pk->from = $entity->getId();\n\t\t\t\t$pk->to = $this->getId();\n\t\t\t\t$pk->type = 2;\n\t\t\t\t$this->server->broadcastPacket($this->level->getPlayers(), $pk);\n\t\t\t\tif($this instanceof Player){\n\t\t\t\t\t$pk = new SetEntityLinkPacket();\n\t\t\t\t\t$pk->from = $entity->getId();\n\t\t\t\t\t$pk->to = 0;\n\t\t\t\t\t$pk->type = 2;\n\t\t\t\t\t$this->dataPacket($pk);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\tcase 2:\n\t\t\t\tif(!$entity->isAlive()){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif($entity->getLinkedEntity() !== $this){\n\t\t\t\t\treturn $entity->linkEntity($this);\n\t\t\t\t}\n\t\t\t\t$this->linkedEntity = $entity;\n\t\t\t\t$this->linkedType = 2;\n\t\t\t\treturn true;\n\t\t\tdefault:\n\t\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic function getLinkedEntity(){\n\t\treturn $this->linkedEntity;\n\t}\n\n\tpublic function getLinkedType(){\n\t\treturn $this->linkedType;\n\t}\n\n\t/**\n\t * @param int $id\n\t *\n\t * @return mixed\n\t */\n\tpublic function getDataProperty($id){\n\t\treturn isset($this->dataProperties[$id]) ? $this->dataProperties[$id][1] : null;\n\t}\n\n\t/**\n\t * @param int $id\n\t *\n\t * @return int\n\t */\n\tpublic function getDataPropertyType($id){\n\t\treturn isset($this->dataProperties[$id]) ? $this->dataProperties[$id][0] : null;\n\t}\n\n\t/**\n\t * @param      $propertyId\n\t * @param      $id\n\t * @param bool $value\n\t * @param int  $type\n\t */\n\tpublic function setDataFlag($propertyId, $id, $value = true, $type = self::DATA_TYPE_LONG){\n\t\tif($this->getDataFlag($propertyId, $id) !== $value){\n\t\t\t$flags = (int) $this->getDataProperty($propertyId);\n\t\t\t$flags ^= 1 << $id;\n\t\t\t$this->setDataProperty($propertyId, $type, $flags);\n\t\t}\n\t}\n\n\t/**\n\t * @param int $propertyId\n\t * @param int $id\n\t *\n\t * @return bool\n\t */\n\tpublic function getDataFlag($propertyId, $id){\n\t\treturn (((int) $this->getDataProperty($propertyId)) & (1 << $id)) > 0;\n\t}\n\n\tpublic function __destruct(){\n\t\t$this->close();\n\t}\n\n\tpublic function setMetadata($metadataKey, MetadataValue $metadataValue){\n\t\t$this->server->getEntityMetadata()->setMetadata($this, $metadataKey, $metadataValue);\n\t}\n\n\tpublic function getMetadata($metadataKey){\n\t\treturn $this->server->getEntityMetadata()->getMetadata($this, $metadataKey);\n\t}\n\n\tpublic function hasMetadata($metadataKey){\n\t\treturn $this->server->getEntityMetadata()->hasMetadata($this, $metadataKey);\n\t}\n\n\tpublic function removeMetadata($metadataKey, Plugin $plugin){\n\t\t$this->server->getEntityMetadata()->removeMetadata($this, $metadataKey, $plugin);\n\t}\n\n\tpublic function __toString(){\n\t\treturn (new \\ReflectionClass($this))->getShortName() . \"(\" . $this->getId() . \")\";\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Explosive.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface Explosive{\n\n\tpublic function explode();\n}"
  },
  {
    "path": "src/pocketmine/entity/FallingSand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\block\\Anvil;\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Liquid;\nuse pocketmine\\block\\SnowLayer;\nuse pocketmine\\event\\entity\\EntityBlockChangeEvent;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\n\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\level\\sound\\AnvilFallSound;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass FallingSand extends Entity{\n\tconst NETWORK_ID = 66;\n\n\tconst DATA_BLOCK_INFO = 20;\n\n\tpublic $width = 0.98;\n\tpublic $length = 0.98;\n\tpublic $height = 0.98;\n\n\tprotected $gravity = 0.04;\n\tprotected $drag = 0.02;\n\tprotected $blockId = 0;\n\tprotected $damage;\n\n\tpublic $canCollide = false;\n\n\tprotected function initEntity(){\n\t\tparent::initEntity();\n\t\tif(isset($this->namedtag->TileID)){\n\t\t\t$this->blockId = $this->namedtag[\"TileID\"];\n\t\t}elseif(isset($this->namedtag->Tile)){\n\t\t\t$this->blockId = $this->namedtag[\"Tile\"];\n\t\t\t$this->namedtag[\"TileID\"] = new IntTag(\"TileID\", $this->blockId);\n\t\t}\n\n\t\tif(isset($this->namedtag->Data)){\n\t\t\t$this->damage = $this->namedtag[\"Data\"];\n\t\t}\n\n\t\tif($this->blockId === 0){\n\t\t\t$this->close();\n\t\t\treturn;\n\t\t}\n\n\t\t$this->setDataProperty(self::DATA_BLOCK_INFO, self::DATA_TYPE_INT, $this->getBlock() | ($this->getDamage() << 8));\n\t}\n\n\tpublic function canCollideWith(Entity $entity){\n\t\treturn false;\n\t}\n\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tif($source->getCause() === EntityDamageEvent::CAUSE_VOID){\n\t\t\tparent::attack($damage, $source);\n\t\t}\n\t}\n\n\tpublic function onUpdate($currentTick){\n\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\n\t\tif($tickDiff <= 0 and !$this->justCreated){\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->lastUpdate = $currentTick;\n\n\t\t$height = $this->fallDistance;\n\n\t\t$hasUpdate = $this->entityBaseTick($tickDiff);\n\n\t\tif($this->isAlive()){\n\t\t\t$pos = (new Vector3($this->x - 0.5, $this->y, $this->z - 0.5))->round();\n\n\t\t\tif($this->ticksLived === 1){\n\t\t\t\t$block = $this->level->getBlock($pos);\n\t\t\t\tif($block->getId() !== $this->blockId){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\t$this->level->setBlock($pos, Block::get(0), true);\n\t\t\t}\n\n\t\t\t$this->motionY -= $this->gravity;\n\n\t\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\n\n\t\t\t$friction = 1 - $this->drag;\n\n\t\t\t$this->motionX *= $friction;\n\t\t\t$this->motionY *= 1 - $this->drag;\n\t\t\t$this->motionZ *= $friction;\n\n\t\t\t$pos = (new Vector3($this->x - 0.5, $this->y, $this->z - 0.5))->round();\n\n\t\t\tif($this->onGround){\n\t\t\t\t$this->kill();\n\t\t\t\t$block = $this->level->getBlock($pos);\n\t\t\t\tif($block->getId() > 0 and !$block->isSolid() and !($block instanceof Liquid)){\n\t\t\t\t\t$this->getLevel()->dropItem($this, ItemItem::get($this->getBlock(), $this->getDamage(), 1));\n\t\t\t\t}else{\n\t\t\t\t\tif($block instanceof SnowLayer){\n\t\t\t\t\t\t$oldDamage = $block->getDamage();\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new EntityBlockChangeEvent($this, $block, Block::get($this->getBlock(), $this->getDamage() + $oldDamage)));\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new EntityBlockChangeEvent($this, $block, Block::get($this->getBlock(), $this->getDamage())));\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->getLevel()->setBlock($pos, $ev->getTo(), true);\n\t\t\t\t\t\tif($ev->getTo() instanceof Anvil){\n\t\t\t\t\t\t\t$sound = new AnvilFallSound($this);\n\t\t\t\t\t\t\t$this->getLevel()->addSound($sound);\n\t\t\t\t\t\t\tforeach($this->level->getNearbyEntities($this->boundingBox->grow(0.1, 0.1, 0.1), $this) as $entity){\n\t\t\t\t\t\t\t\t$entity->scheduleUpdate();\n\t\t\t\t\t\t\t\tif(!$entity->isAlive()){\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif($entity instanceof Living){\n\t\t\t\t\t\t\t\t\t$damage = ($height - 1) * 2;\n\t\t\t\t\t\t\t\t\tif($damage > 40) $damage = 40;\n\t\t\t\t\t\t\t\t\t$ev = new EntityDamageByEntityEvent($this, $entity, EntityDamageByEntityEvent::CAUSE_FALL, $damage, 0.1);\n\t\t\t\t\t\t\t\t\t$entity->attack($damage, $ev);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$hasUpdate = true;\n\t\t\t}\n\n\t\t\t$this->updateMovement();\n\t\t}\n\n\t\treturn $hasUpdate or !$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\n\t}\n\n\tpublic function getBlock(){\n\t\treturn $this->blockId;\n\t}\n\n\tpublic function getDamage(){\n\t\treturn $this->damage;\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->TileID = new IntTag(\"TileID\", $this->blockId);\n\t\t$this->namedtag->Data = new ByteTag(\"Data\", $this->damage);\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = FallingSand::NETWORK_ID;\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/FishingHook.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\event\\player\\PlayerFishEvent;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\Player;\r\nuse pocketmine\\item\\Item as ItemItem;\r\nuse pocketmine\\network\\protocol\\EntityEventPacket;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Server;\r\n\r\nclass FishingHook extends Projectile{\r\n\tconst NETWORK_ID = 77;\r\n\r\n\tpublic $width = 0.25;\r\n\tpublic $length = 0.25;\r\n\tpublic $height = 0.25;\r\n\r\n\tprotected $gravity = 0.1;\r\n\tprotected $drag = 0.05;\r\n\r\n\tpublic $data = 0;\r\n\tpublic $attractTimer = 100;\r\n\tpublic $coughtTimer = 0;\r\n\tpublic $damageRod = false;\r\n\r\n\tpublic function initEntity(){\r\n\t\tparent::initEntity();\r\n\r\n\t\tif(isset($this->namedtag->Data)){\r\n\t\t\t$this->data = $this->namedtag[\"Data\"];\r\n\t\t}\r\n\r\n\t\t// $this->setDataProperty(FallingSand::DATA_BLOCK_INFO, self::DATA_TYPE_INT, $this->getData());\r\n\t}\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\r\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\r\n\t}\r\n\r\n\tpublic function setData($id){\r\n\t\t$this->data = $id;\r\n\t}\r\n\r\n\tpublic function getData(){\r\n\t\treturn $this->data;\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$this->timings->startTiming();\r\n\r\n\t\t$hasUpdate = parent::onUpdate($currentTick);\r\n\r\n\t\tif($this->isCollidedVertically && $this->isInsideOfWater()){\r\n\t\t\t$this->motionX = 0;\r\n\t\t\t$this->motionY += 0.01;\r\n\t\t\t$this->motionZ = 0;\r\n\t\t\t$this->motionChanged = true;\r\n\t\t\t$hasUpdate = true;\r\n\t\t}elseif($this->isCollided && $this->keepMovement === true){\r\n\t\t\t$this->motionX = 0;\r\n\t\t\t$this->motionY = 0;\r\n\t\t\t$this->motionZ = 0;\r\n\t\t\t$this->motionChanged = true;\r\n\t\t\t$this->keepMovement = false;\r\n\t\t\t$hasUpdate = true;\r\n\t\t}\r\n\t\tif($this->attractTimer === 0 && mt_rand(0, 100) <= 30){ // chance, that a fish bites\r\n\t\t\t$this->coughtTimer = mt_rand(5, 10) * 20; // random delay to catch fish\r\n\t\t\t$this->attractTimer = mt_rand(30, 100) * 20; // reset timer\r\n\t\t\t$this->attractFish();\r\n\t\t\tif($this->shootingEntity instanceof Player) $this->shootingEntity->sendTip(\"A fish bites!\");\r\n\t\t}elseif($this->attractTimer > 0){\r\n\t\t\t$this->attractTimer--;\r\n\t\t}\r\n\t\tif($this->coughtTimer > 0){\r\n\t\t\t$this->coughtTimer--;\r\n\t\t\t$this->fishBites();\r\n\t\t}\r\n\r\n\t\t$this->timings->stopTiming();\r\n\r\n\t\treturn $hasUpdate;\r\n\t}\r\n\r\n\tpublic function fishBites(){\r\n\t\tif($this->shootingEntity instanceof Player){\r\n\t\t\t$pk = new EntityEventPacket();\r\n\t\t\t$pk->eid = $this->shootingEntity->getId();//$this or $this->shootingEntity\r\n\t\t\t$pk->event = EntityEventPacket::FISH_HOOK_HOOK;\r\n\t\t\tServer::getInstance()->broadcastPacket($this->shootingEntity->hasSpawned, $pk);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function attractFish(){\r\n\t\tif($this->shootingEntity instanceof Player){\r\n\t\t\t$pk = new EntityEventPacket();\r\n\t\t\t$pk->eid = $this->shootingEntity->getId();//$this or $this->shootingEntity\r\n\t\t\t$pk->event = EntityEventPacket::FISH_HOOK_BUBBLE;\r\n            Server::getInstance()->broadcastPacket($this->shootingEntity->hasSpawned, $pk);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function reelLine(){\r\n\t\t$this->damageRod = false;\r\n\r\n\t\tif($this->shootingEntity instanceof Player && $this->coughtTimer > 0){\r\n\t\t\t$fishes = [ItemItem::RAW_FISH, ItemItem::RAW_SALMON, ItemItem::CLOWN_FISH, ItemItem::PUFFER_FISH];\r\n\t\t\t$fish = array_rand($fishes, 1);\r\n\t\t\t$item = ItemItem::get($fishes[$fish]);\r\n\t\t\t$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new PlayerFishEvent($this->shootingEntity, $item, $this));\r\n\t\t\tif(!$ev->isCancelled()){\r\n\t\t\t\t$this->shootingEntity->getInventory()->addItem($item);\r\n\t\t\t\t$this->shootingEntity->addExperience(mt_rand(1, 6));\r\n\t\t\t\t$this->damageRod = true;\r\n\t\t\t}\r\n\t\t}\r\n\r\n\t\tif($this->shootingEntity instanceof Player){\r\n\t\t\t$this->shootingEntity->unlinkHookFromPlayer();\r\n\t\t}\r\n\r\n\t\tif(!$this->closed){\r\n\t\t\t$this->kill();\r\n\t\t\t$this->close();\r\n\t\t}\r\n\r\n\t\treturn $this->damageRod;\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->type = FishingHook::NETWORK_ID;\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->yaw = $this->yaw;\r\n\t\t$pk->pitch = $this->pitch;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/entity/FlyingAnimal.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\math\\Vector3;\n\nabstract class FlyingAnimal extends Creature implements Ageable{\n\n    protected $gravity = 0;\n    protected $drag = 0.02;\n\n    /** @var Vector3 */\n    public $flyDirection = null;\n    public $flySpeed = 0.5;\n    public $highestY = 128;\n\n    private $switchDirectionTicker = 0;\n    public $switchDirectionTicks = 300;\n\n    public function onUpdate($currentTick){\n        if($this->closed !== false){\n            return false;\n        }\n        if ($this->willMove(100)) {\n            if(++$this->switchDirectionTicker === $this->switchDirectionTicks){\n                $this->switchDirectionTicker = 0;\n                if(mt_rand(0, 100) < 50){\n                    $this->flyDirection = null;\n                }\n            }\n\n            $this->lastUpdate = $currentTick;\n\n            $this->timings->startTiming();\n\n            if($this->isAlive()){\n\n                if($this->y > $this->highestY and $this->flyDirection !== null){\n                    $this->flyDirection->y = -0.5;\n                }\n\n                $inAir = !$this->isInsideOfSolid() and !$this->isInsideOfWater();\n                if(!$inAir){\n                    $this->flyDirection = null;\n                }\n                if($this->flyDirection instanceof Vector3){\n                    //var_dump($this->flyDirection);\n                    $this->setMotion($this->flyDirection->multiply($this->flySpeed));\n                }else{\n                    $this->flyDirection = $this->generateRandomDirection();\n                    $this->flySpeed = mt_rand(50, 100) / 500;\n                    $this->setMotion($this->flyDirection);\n                }\n\n                //$expectedPos = new Vector3($this->x + $this->motionX, $this->y + $this->motionY, $this->z + $this->motionZ);\n\n                //$motion = $this->flyDirection->multiply($this->flySpeed);\n                $this->move($this->motionX, $this->motionY, $this->motionZ);\n                $this->updateMovement();\n                //$this->getLevel()->addEntityMotion($this->chunk->getX(), $this->chunk->getZ(), $this->getId(), $motion->x, $motion->y, $motion->z);\n\n                //echo \"EID = {$this->getId()}, motionX = $this->motionX, motionY = $this->motionY, motionZ = $this->motionZ\\n\";\n                /*\n\n                if($expectedPos->distanceSquared($this) > 0){\n                    $this->flyDirection = $this->generateRandomDirection();\n                    $this->flySpeed = mt_rand(50, 100) / 500;\n                }\n\n                $friction = 1 - $this->drag;\n\n                $this->motionX *= $friction;\n                $this->motionY *= 1 - $this->drag;\n                $this->motionZ *= $friction;\n*/\n                $f = sqrt(($this->motionX ** 2) + ($this->motionZ ** 2));\n                $this->yaw = (-atan2($this->motionX, $this->motionZ) * 180 / M_PI);\n                $this->pitch = (-atan2($f, $this->motionY) * 180 / M_PI);\n\n                if($this->onGround and $this->flyDirection instanceof Vector3){\n                    $this->flyDirection->y *= -1;\n                }\n\n\n            }\n        }\n        parent::onUpdate($currentTick);\n        //parent::entityBaseTick();\n        $this->timings->stopTiming();\n\n        return !$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\n    }\n\n    private function generateRandomDirection(){\n        return new Vector3(mt_rand(-1000, 1000) / 1000, mt_rand(-500, 500) / 1000, mt_rand(-1000, 1000) / 1000);\n    }\n\n\tpublic function initEntity(){\n\t\tparent::initEntity();\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BABY, false);\n\t}\n\n\tpublic function isBaby(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BABY);\n\t}\n\n    public function attack($damage, EntityDamageEvent $source){\n        if($source->isCancelled()){\n            return;\n        }\n        if ($source->getCause() == EntityDamageEvent::CAUSE_FALL) {\n            $source->setCancelled();\n            return;\n        }\n        parent::attack($damage, $source);\n    }\n\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Ghast.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass Ghast extends FlyingAnimal{\n\tconst NETWORK_ID = 41;\n\n\tpublic $width = 6;\n\tpublic $length = 6;\n\tpublic $height = 6;\n\t\n\tpublic function getName(){\n\t\treturn \"Ghast\";\n\t}\n\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(10);\n\t\tparent::initEntity();\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Ghast::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Hanging.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nabstract class Hanging extends Entity implements Attachable{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Human.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\event\\entity\\EntityRegainHealthEvent;\nuse pocketmine\\event\\player\\PlayerExhaustEvent;\nuse pocketmine\\event\\player\\PlayerExperienceChangeEvent;\nuse pocketmine\\inventory\\EnderChestInventory;\nuse pocketmine\\inventory\\FloatingInventory;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\inventory\\InventoryType;\nuse pocketmine\\inventory\\PlayerInventory;\nuse pocketmine\\inventory\\SimpleTransactionQueue;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\math\\Math;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\network\\protocol\\AddPlayerPacket;\nuse pocketmine\\network\\protocol\\RemoveEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\UUID;\n\nclass Human extends Creature implements ProjectileSource, InventoryHolder{\n\t\n\tconst DATA_PLAYER_FLAG_SLEEP = 1;\n\tconst DATA_PLAYER_FLAG_DEAD = 2; //TODO: CHECK\n\n\tconst DATA_PLAYER_FLAGS = 27;\n\n\tconst DATA_PLAYER_BED_POSITION = 29;\n\n\t/** @var PlayerInventory */\n\tprotected $inventory;\n\t\n\t/** @var EnderChestInventory */\n\tprotected $enderChestInventory;\n\n\t/** @var FloatingInventory */\n\tprotected $floatingInventory;\n\n\t/** @var SimpleTransactionQueue */\n\tprotected $transactionQueue = null;\n\n\t/** @var UUID */\n\tprotected $uuid;\n\tprotected $rawUUID;\n\n\tpublic $width = 0.6;\n\tpublic $length = 0.6;\n\tpublic $height = 1.8;\n\tpublic $eyeHeight = 1.62;\n\n\tprotected $skinId;\n\tprotected $skin;\n\n\tprotected $foodTickTimer = 0;\n\n\tprotected $totalXp = 0;\n\tprotected $xpSeed;\n\tprotected $xpCooldown = 0;\n\n\tpublic function getSkinData(){\n\t\treturn $this->skin;\n\t}\n\n\tpublic function getSkinId(){\n\t\treturn $this->skinId;\n\t}\n\n\t/**\n\t * @return UUID|null\n\t */\n\tpublic function getUniqueId(){\n\t\treturn $this->uuid;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getRawUniqueId(){\n\t\treturn $this->rawUUID;\n\t}\n\n\t/**\n\t * @param string $str\n\t * @param string $skinId\n\t */\n\tpublic function setSkin($str, $skinId){\n\t\t$this->skin = $str;\n\t\t$this->skinId = $skinId;\n\t}\n\n\tpublic function getFood() : float{\n\t\treturn $this->attributeMap->getAttribute(Attribute::HUNGER)->getValue();\n\t}\n\n\t/**\n\t * WARNING: This method does not check if full and may throw an exception if out of bounds.\n\t * Use {@link Human::addFood()} for this purpose\n\t *\n\t * @param float $new\n\t *\n\t * @throws \\InvalidArgumentException\n\t */\n\tpublic function setFood(float $new){\n\t\t$attr = $this->attributeMap->getAttribute(Attribute::HUNGER);\n\t\t$old = $attr->getValue();\n\t\t$attr->setValue($new);\n\t\t// ranges: 18-20 (regen), 7-17 (none), 1-6 (no sprint), 0 (health depletion)\n\t\tforeach([17, 6, 0] as $bound){\n\t\t\tif(($old > $bound) !== ($new > $bound)){\n\t\t\t\t$reset = true;\n\t\t\t}\n\t\t}\n\t\tif(isset($reset)){\n\t\t\t$this->foodTickTimer = 0;\n\t\t}\n\n\t}\n\n\tpublic function getMaxFood() : float{\n\t\treturn $this->attributeMap->getAttribute(Attribute::HUNGER)->getMaxValue();\n\t}\n\n\tpublic function addFood(float $amount){\n\t\t$attr = $this->attributeMap->getAttribute(Attribute::HUNGER);\n\t\t$amount += $attr->getValue();\n\t\t$amount = max(min($amount, $attr->getMaxValue()), $attr->getMinValue());\n\t\t$this->setFood($amount);\n\t}\n\n\tpublic function getSaturation() : float{\n\t\treturn $this->attributeMap->getAttribute(Attribute::SATURATION)->getValue();\n\t}\n\n\t/**\n\t * WARNING: This method does not check if saturated and may throw an exception if out of bounds.\n\t * Use {@link Human::addSaturation()} for this purpose\n\t *\n\t * @param float $saturation\n\t *\n\t * @throws \\InvalidArgumentException\n\t */\n\tpublic function setSaturation(float $saturation){\n\t\t$this->attributeMap->getAttribute(Attribute::SATURATION)->setValue($saturation);\n\t}\n\n\tpublic function addSaturation(float $amount){\n\t\t$attr = $this->attributeMap->getAttribute(Attribute::SATURATION);\n\t\t$attr->setValue($attr->getValue() + $amount, true);\n\t}\n\n\tpublic function getExhaustion() : float{\n\t\treturn $this->attributeMap->getAttribute(Attribute::EXHAUSTION)->getValue();\n\t}\n\n\t/**\n\t * WARNING: This method does not check if exhausted and does not consume saturation/food.\n\t * Use {@link Human::exhaust()} for this purpose.\n\t *\n\t * @param float $exhaustion\n\t */\n\tpublic function setExhaustion(float $exhaustion){\n\t\t$this->attributeMap->getAttribute(Attribute::EXHAUSTION)->setValue($exhaustion);\n\t}\n\n\t/**\n\t * Increases a human's exhaustion level.\n\t *\n\t * @param float $amount\n\t * @param int   $cause\n\t *\n\t * @return float the amount of exhaustion level increased\n\t */\n\tpublic function exhaust(float $amount, int $cause = PlayerExhaustEvent::CAUSE_CUSTOM) : float{\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerExhaustEvent($this, $amount, $cause));\n\t\tif($ev->isCancelled()){\n\t\t\treturn 0.0;\n\t\t}\n\n\t\t$exhaustion = $this->getExhaustion();\n\t\t$exhaustion += $ev->getAmount();\n\n\t\twhile($exhaustion >= 4.0){\n\t\t\t$exhaustion -= 4.0;\n\n\t\t\t$saturation = $this->getSaturation();\n\t\t\tif($saturation > 0){\n\t\t\t\t$saturation = max(0, $saturation - 1.0);\n\t\t\t\t$this->setSaturation($saturation);\n\t\t\t}else{\n\t\t\t\t$food = $this->getFood();\n\t\t\t\tif($food > 0){\n\t\t\t\t\t$food--;\n\t\t\t\t\t$this->setFood($food);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->setExhaustion($exhaustion);\n\n\t\treturn $ev->getAmount();\n\t}\n\n\tpublic function getXpLevel() : int{\n\t\treturn (int) $this->attributeMap->getAttribute(Attribute::EXPERIENCE_LEVEL)->getValue();\n\t}\n\n\tpublic function setXpLevel(int $level) : bool{\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerExperienceChangeEvent($this, $level, $this->getXpProgress()));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$this->attributeMap->getAttribute(Attribute::EXPERIENCE_LEVEL)->setValue($ev->getExpLevel());\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function addXpLevel(int $level) : bool{\n\t\treturn $this->setXpLevel($this->getXpLevel() + $level);\n\t}\n\n\tpublic function takeXpLevel(int $level) : bool{\n\t\treturn $this->setXpLevel($this->getXpLevel() - $level);\n\t}\n\n\tpublic function getXpProgress() : float{\n\t\treturn $this->attributeMap->getAttribute(Attribute::EXPERIENCE)->getValue();\n\t}\n\n\tpublic function setXpProgress(float $progress) : bool{\n\t\t$this->attributeMap->getAttribute(Attribute::EXPERIENCE)->setValue($progress);\n\t\treturn true;\n\t}\n\n\tpublic function getTotalXp() : int{\n\t\treturn $this->totalXp;\n\t}\n\n\t/**\n\t * Changes the total exp of a player\n\t *\n\t * @param int $xp\n\t * @param bool $syncLevel This will reset the level to be in sync with the total. Usually you don't want to do this,\n\t *                        because it'll mess up use of xp in anvils and enchanting tables.\n\t *\n\t * @return bool\n\t */\n\tpublic function setTotalXp(int $xp, bool $syncLevel = false) : bool{\n\t\t$xp &= 0x7fffffff;\n\t\tif($xp === $this->totalXp){\n\t\t\treturn false;\n\t\t}\n\t\tif(!$syncLevel){\n\t\t\t$level = $this->getXpLevel();\n\t\t\t$diff = $xp - $this->totalXp + $this->getFilledXp();\n\t\t\tif($diff > 0){ //adding xp\n\t\t\t\twhile($diff > ($v = self::getLevelXpRequirement($level))){\n\t\t\t\t\t$diff -= $v;\n\t\t\t\t\tif(++$level >= 21863){\n\t\t\t\t\t\t$diff = $v; //fill exp bar\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{ //taking xp\n\t\t\t\twhile($diff < ($v = self::getLevelXpRequirement($level - 1))){\n\t\t\t\t\t$diff += $v;\n\t\t\t\t\tif(--$level <= 0){\n\t\t\t\t\t\t$diff = 0;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$progress = ($diff / $v);\n\t\t}else{\n\t\t\t$values = self::getLevelFromXp($xp);\n\t\t\t$level = $values[0];\n\t\t\t$progress = $values[1];\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new PlayerExperienceChangeEvent($this, $level, $progress));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$this->totalXp = $xp;\n\t\t\t$this->setXpLevel($ev->getExpLevel());\n\t\t\t$this->setXpProgress($ev->getProgress());\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function addXp(int $xp, bool $syncLevel = false) : bool{\n\t\treturn $this->setTotalXp($this->totalXp + $xp, $syncLevel);\n\t}\n\n\tpublic function takeXp(int $xp, bool $syncLevel = false) : bool{\n\t\treturn $this->setTotalXp($this->totalXp - $xp, $syncLevel);\n\t}\n\n\tpublic function getRemainderXp() : int{\n\t\treturn self::getLevelXpRequirement($this->getXpLevel()) - $this->getFilledXp();\n\t}\n\n\tpublic function getFilledXp() : int{\n\t\treturn self::getLevelXpRequirement($this->getXpLevel()) * $this->getXpProgress();\n\t}\n\n\tpublic function recalculateXpProgress() : float{\n\t\treturn $this->setXpProgress($this->getRemainderXp() / self::getLevelXpRequirement($this->getXpLevel()));\n\t}\n\n\tpublic function getXpSeed() : int{\n\t\t//TODO: use this for randomizing enchantments in enchanting tables\n\t\treturn $this->xpSeed;\n\t}\n\n\tpublic function resetXpCooldown(){\n\t\t$this->xpCooldown = microtime(true);\n\t}\n\n\tpublic function canPickupXp() : bool{\n\t\treturn microtime(true) - $this->xpCooldown > 0.5;\n\t}\n\n\t/**\n\t * Returns the total amount of exp required to reach the specified level.\n\t *\n\t * @param int $level\n\t *\n\t * @return int\n\t */\n\tpublic static function getTotalXpRequirement(int $level) : int{\n\t\tif($level <= 16){\n\t\t\treturn ($level ** 2) + (6 * $level);\n\t\t}elseif($level <= 31){\n\t\t\treturn (2.5 * ($level ** 2)) - (40.5 * $level) + 360;\n\t\t}elseif($level <= 21863){\n\t\t\treturn (4.5 * ($level ** 2)) - (162.5 * $level) + 2220;\n\t\t}\n\t\treturn PHP_INT_MAX; //prevent float returns for invalid levels on 32-bit systems\n\t}\n\n\t/**\n\t * Returns the amount of exp required to complete the specified level.\n\t *\n\t * @param int $level\n\t *\n\t * @return int\n\t */\n\tpublic static function getLevelXpRequirement(int $level) : int{\n\t\tif($level <= 16){\n\t\t\treturn (2 * $level) + 7;\n\t\t}elseif($level <= 31){\n\t\t\treturn (5 * $level) - 38;\n\t\t}elseif($level <= 21863){\n\t\t\treturn (9 * $level) - 158;\n\t\t}\n\t\treturn PHP_INT_MAX;\n\t}\n\n\t/**\n\t * Converts a quantity of exp into a level and a progress percentage\n\t *\n\t * @param int $xp\n\t *\n\t * @return int[]\n\t */\n\tpublic static function getLevelFromXp(int $xp) : array{\n\t\t$xp &= 0x7fffffff;\n\n\t\t/** These values are correct up to and including level 16 */\n\t\t$a = 1;\n\t\t$b = 6;\n\t\t$c = -$xp;\n\t\tif($xp > self::getTotalXpRequirement(16)){\n\t\t\t/** Modify the coefficients to fit the relevant equation */\n\t\t\tif($xp <= self::getTotalXpRequirement(31)){\n\t\t\t\t/** Levels 16-31 */\n\t\t\t\t$a = 2.5;\n\t\t\t\t$b = -40.5;\n\t\t\t\t$c += 360;\n\t\t\t}else{\n\t\t\t\t/** Level 32+ */\n\t\t\t\t$a = 4.5;\n\t\t\t\t$b = -162.5;\n\t\t\t\t$c += 2220;\n\t\t\t}\n\t\t}\n\n\t\t$answer = max(Math::solveQuadratic($a, $b, $c)); //Use largest result value\n\t\t$level = floor($answer);\n\t\t$progress = $answer - $level;\n\t\treturn [$level, $progress];\n\t}\n\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\t\n\tpublic function getEnderChestInventory(){\n\t\treturn $this->enderChestInventory;\n\t}\n\n\tpublic function getFloatingInventory(){\n\t\treturn $this->floatingInventory;\n\t}\n\n\tpublic function getTransactionQueue(){\n\t\t//Is creating the transaction queue ondemand a good idea? I think only if it's destroyed afterwards. hmm...\n\t\tif($this->transactionQueue === null){\n\t\t\t//Potential for crashes here if a plugin attempts to use this, say for an NPC plugin or something...\n\t\t\t$this->transactionQueue = new SimpleTransactionQueue($this);\n\t\t}\n\t\treturn $this->transactionQueue;\n\t}\n\n\tprotected function initEntity(){\n\t\t$this->setDataFlag(self::DATA_PLAYER_FLAGS, self::DATA_PLAYER_FLAG_SLEEP, false, self::DATA_TYPE_BYTE);\n\t\t$this->setDataProperty(self::DATA_PLAYER_BED_POSITION, self::DATA_TYPE_POS, [0, 0, 0]);\n\n\t\t$inventoryContents = ($this->namedtag->Inventory ?? null);\n\t\t$this->inventory = new PlayerInventory($this, $inventoryContents);\n\t\t$this->enderChestInventory = new EnderChestInventory($this, ($this->namedtag->EnderChestInventory ?? null));\n\n\t\t//Virtual inventory for desktop GUI crafting and anti-cheat transaction processing\n\t\t$this->floatingInventory = new FloatingInventory($this);\n\n\t\tif($this instanceof Player){\n\t\t\t$this->addWindow($this->inventory, 0);\n\t\t}else{\n\t\t\tif(isset($this->namedtag->NameTag)){\n\t\t\t\t$this->setNameTag($this->namedtag[\"NameTag\"]);\n\t\t\t}\n\n\t\t\tif(isset($this->namedtag->Skin) and $this->namedtag->Skin instanceof CompoundTag){\n\t\t\t\t$this->setSkin($this->namedtag->Skin[\"Data\"], $this->namedtag->Skin[\"Name\"]);\n\t\t\t}\n\n\t\t\t$this->uuid = UUID::fromData($this->getId(), $this->getSkinData(), $this->getNameTag());\n\t\t}\n\n\n\t\tparent::initEntity();\n\n\t\tif(!isset($this->namedtag->foodLevel) or !($this->namedtag->foodLevel instanceof IntTag)){\n\t\t\t$this->namedtag->foodLevel = new IntTag(\"foodLevel\", $this->getFood());\n\t\t}else{\n\t\t\t$this->setFood($this->namedtag[\"foodLevel\"]);\n\t\t}\n\n\t\tif(!isset($this->namedtag->foodExhaustionLevel) or !($this->namedtag->foodExhaustionLevel instanceof IntTag)){\n\t\t\t$this->namedtag->foodExhaustionLevel = new FloatTag(\"foodExhaustionLevel\", $this->getExhaustion());\n\t\t}else{\n\t\t\t$this->setExhaustion($this->namedtag[\"foodExhaustionLevel\"]);\n\t\t}\n\n\t\tif(!isset($this->namedtag->foodSaturationLevel) or !($this->namedtag->foodSaturationLevel instanceof IntTag)){\n\t\t\t$this->namedtag->foodSaturationLevel = new FloatTag(\"foodSaturationLevel\", $this->getSaturation());\n\t\t}else{\n\t\t\t$this->setSaturation($this->namedtag[\"foodSaturationLevel\"]);\n\t\t}\n\n\t\tif(!isset($this->namedtag->foodTickTimer) or !($this->namedtag->foodTickTimer instanceof IntTag)){\n\t\t\t$this->namedtag->foodTickTimer = new IntTag(\"foodTickTimer\", $this->foodTickTimer);\n\t\t}else{\n\t\t\t$this->foodTickTimer = $this->namedtag[\"foodTickTimer\"];\n\t\t}\n\n\t\tif(!isset($this->namedtag->XpLevel) or !($this->namedtag->XpLevel instanceof IntTag)){\n\t\t\t$this->namedtag->XpLevel = new IntTag(\"XpLevel\", 0);\n\t\t}\n\t\t$this->setXpLevel($this->namedtag[\"XpLevel\"]);\n\n\t\tif(!isset($this->namedtag->XpP) or !($this->namedtag->XpP instanceof FloatTag)){\n\t\t\t$this->namedtag->XpP = new FloatTag(\"XpP\", 0);\n\t\t}\n\t\t$this->setXpProgress($this->namedtag[\"XpP\"]);\n\n\t\tif(!isset($this->namedtag->XpTotal) or !($this->namedtag->XpTotal instanceof IntTag)){\n\t\t\t$this->namedtag->XpTotal = new IntTag(\"XpTotal\", 0);\n\t\t}\n\t\t$this->totalXp = $this->namedtag[\"XpTotal\"];\n\n\t\tif(!isset($this->namedtag->XpSeed) or !($this->namedtag->XpSeed instanceof IntTag)){\n\t\t\t$this->namedtag->XpSeed = new IntTag(\"XpSeed\", mt_rand(PHP_INT_MIN, PHP_INT_MAX));\n\t\t}\n\t\t$this->xpSeed = $this->namedtag[\"XpSeed\"];\n\t}\n\n\tpublic function getAbsorption() : int{\n\t\treturn $this->attributeMap->getAttribute(Attribute::ABSORPTION)->getValue();\n\t}\n\n\tpublic function setAbsorption(int $absorption){\n\t\t$this->attributeMap->getAttribute(Attribute::ABSORPTION)->setValue($absorption);\n\t}\n\n\tprotected function addAttributes(){\n\t\tparent::addAttributes();\n\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::SATURATION));\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::EXHAUSTION));\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::HUNGER));\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::EXPERIENCE_LEVEL));\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::EXPERIENCE));\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::HEALTH));\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::MOVEMENT_SPEED));\n\t\t$this->attributeMap->addAttribute(Attribute::getAttribute(Attribute::ABSORPTION));\n\t}\n\n\tpublic function entityBaseTick($tickDiff = 1, $EnchantL = 0){\n\t\tif($this->getInventory() instanceof PlayerInventory){\n\t\t\t$EnchantL = $this->getInventory()->getHelmet()->getEnchantmentLevel(Enchantment::TYPE_WATER_BREATHING);\n\t\t}\n\t\t$hasUpdate = parent::entityBaseTick($tickDiff, $EnchantL);\n\n\t\tif($this->server->foodEnabled){\n\t\t\t$food = $this->getFood();\n\t\t\t$health = $this->getHealth();\n\t\t\tif($food >= 18){\n\t\t\t\t$this->foodTickTimer++;\n\t\t\t\tif($this->foodTickTimer >= 80 and $health < $this->getMaxHealth()){\n\t\t\t\t\t$this->heal(1, new EntityRegainHealthEvent($this, 1, EntityRegainHealthEvent::CAUSE_SATURATION));\n\t\t\t\t\t$this->exhaust(3.0, PlayerExhaustEvent::CAUSE_HEALTH_REGEN);\n\t\t\t\t\t$this->foodTickTimer = 0;\n\n\t\t\t\t}\n\t\t\t}elseif($food === 0){\n\t\t\t\t$this->foodTickTimer++;\n\t\t\t\tif($this->foodTickTimer >= 80){\n\t\t\t\t\t$diff = $this->server->getDifficulty();\n\t\t\t\t\t$can = false;\n\t\t\t\t\tif($diff === 1){\n\t\t\t\t\t\t$can = $health > 10;\n\t\t\t\t\t}elseif($diff === 2){\n\t\t\t\t\t\t$can = $health > 1;\n\t\t\t\t\t}elseif($diff === 3){\n\t\t\t\t\t\t$can = true;\n\t\t\t\t\t}\n\t\t\t\t\tif($can){\n\t\t\t\t\t\t$this->attack(1, new EntityDamageEvent($this, EntityDamageEvent::CAUSE_STARVATION, 1));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($food <= 6){\n\t\t\t\tif($this->isSprinting()){\n\t\t\t\t\t$this->setSprinting(false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $hasUpdate;\n\t}\n\n\tpublic function getName(){\n\t\treturn $this->getNameTag();\n\t}\n\n\tpublic function getDrops(){\n\t\t$drops = [];\n\t\tif($this->inventory !== null){\n\t\t\tforeach($this->inventory->getContents() as $item){\n\t\t\t\t$drops[] = $item;\n\t\t\t}\n\t\t}\n\n\t\treturn $drops;\n\t}\n\n\tpublic function saveNBT(){\n\t\tparent::saveNBT();\n\t\t$this->namedtag->Inventory = new ListTag(\"Inventory\", []);\n\t\t$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);\n\t\tif($this->inventory !== null){\n\n\t\t\t//Hotbar\n\t\t\tfor($slot = 0; $slot < $this->inventory->getHotbarSize(); ++$slot){\n\t\t\t\t$inventorySlotIndex = $this->inventory->getHotbarSlotIndex($slot);\n\t\t\t\t$item = $this->inventory->getItem($inventorySlotIndex);\n\t\t\t\t$tag = $item->nbtSerialize($slot);\n\t\t\t\t$tag->TrueSlot = new ByteTag(\"TrueSlot\", $inventorySlotIndex);\n\t\t\t\t$this->namedtag->Inventory[$slot] = $tag;\n\t\t\t}\n\n\t\t\t//Normal inventory\n\t\t\t$slotCount = $this->inventory->getSize() + $this->inventory->getHotbarSize();\n\t\t\tfor($slot = $this->inventory->getHotbarSize(); $slot < $slotCount; ++$slot){\n\t\t\t\t$item = $this->inventory->getItem($slot - $this->inventory->getHotbarSize());\n\t\t\t\t//As NBT, real inventory slots are slots 9-44, NOT 0-35\n\t\t\t\t$this->namedtag->Inventory[$slot] = $item->nbtSerialize($slot);\n\t\t\t}\n\n\t\t\t//Armour\n\t\t\tfor($slot = 100; $slot < 104; ++$slot){\n\t\t\t\t$item = $this->inventory->getItem($this->inventory->getSize() + $slot - 100);\n\t\t\t\tif($item instanceof ItemItem and $item->getId() !== ItemItem::AIR){\n\t\t\t\t\t$this->namedtag->Inventory[$slot] = $item->nbtSerialize($slot);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t$this->namedtag->EnderChestInventory = new ListTag(\"EnderChestInventory\", []);\n\t\t$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);\n\t\tif($this->enderChestInventory !== null){\n\t\t\tfor($slot = 0; $slot < $this->enderChestInventory->getSize(); $slot++){\n\t\t\t\tif(($item = $this->enderChestInventory->getItem($slot)) instanceof ItemItem){\n\t\t\t\t\t$this->namedtag->EnderChestInventory[$slot] = $item->nbtSerialize($slot);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(strlen($this->getSkinData()) > 0){\n\t\t\t$this->namedtag->Skin = new CompoundTag(\"Skin\", [\n\t\t\t\t\"Data\" => new StringTag(\"Data\", $this->getSkinData()),\n\t\t\t\t\"Name\" => new StringTag(\"Name\", $this->getSkinId())\n\t\t\t]);\n\t\t}\n\n\t\t//Xp\n\t\t$this->namedtag->XpLevel = new IntTag(\"XpLevel\", $this->getXpLevel());\n\t\t$this->namedtag->XpTotal = new IntTag(\"XpTotal\", $this->getTotalXp());\n\t\t$this->namedtag->XpP = new FloatTag(\"XpP\", $this->getXpProgress());\n\t\t$this->namedtag->XpSeed = new IntTag(\"XpSeed\", $this->getXpSeed());\n\n\t\t//Food\n\t\t$this->namedtag->foodLevel = new IntTag(\"foodLevel\", $this->getFood());\n\t\t$this->namedtag->foodExhaustionLevel = new FloatTag(\"foodExhaustionLevel\", $this->getExhaustion());\n\t\t$this->namedtag->foodSaturationLevel = new FloatTag(\"foodSaturationLevel\", $this->getSaturation());\n\t\t$this->namedtag->foodTickTimer = new IntTag(\"foodTickTimer\", $this->foodTickTimer);\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\tif(strlen($this->skin) < 64 * 32 * 4){\n\t\t\t$e = new \\InvalidStateException((new \\ReflectionClass($this))->getShortName() . \" must have a valid skin set\");\n\t\t\t$this->server->getLogger()->logException($e);\n\t\t\t$this->close();\n\t\t}elseif($player !== $this and !isset($this->hasSpawned[$player->getLoaderId()])){\n\t\t\t$this->hasSpawned[$player->getLoaderId()] = $player;\n\n\t\t\tif(!($this instanceof Player)){\n\t\t\t\t$this->server->updatePlayerListData($this->getUniqueId(), $this->getId(), $this->getName(), $this->skinId, $this->skin, [$player]);\n\t\t\t}\n\n\t\t\t$pk = new AddPlayerPacket();\n\t\t\t$pk->uuid = $this->getUniqueId();\n\t\t\t$pk->username = $this->getName();\n\t\t\t$pk->eid = $this->getId();\n\t\t\t$pk->x = $this->x;\n\t\t\t$pk->y = $this->y;\n\t\t\t$pk->z = $this->z;\n\t\t\t$pk->speedX = $this->motionX;\n\t\t\t$pk->speedY = $this->motionY;\n\t\t\t$pk->speedZ = $this->motionZ;\n\t\t\t$pk->yaw = $this->yaw;\n\t\t\t$pk->pitch = $this->pitch;\n\t\t\t$pk->item = $this->getInventory()->getItemInHand();\n\t\t\t$pk->metadata = $this->dataProperties;\n\t\t\t$player->dataPacket($pk);\n\n\t\t\t$this->sendLinkedData();\n\n\t\t\t$this->inventory->sendArmorContents($player);\n\n\t\t\tif(!($this instanceof Player)){\n\t\t\t\t$this->server->removePlayerListData($this->getUniqueId(), [$player]);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function despawnFrom(Player $player){\n\t\tif(isset($this->hasSpawned[$player->getLoaderId()])){\n\n\t\t\t$pk = new RemoveEntityPacket();\n\t\t\t$pk->eid = $this->getId();\n\t\t\t$player->dataPacket($pk);\n\t\t\tunset($this->hasSpawned[$player->getLoaderId()]);\n\t\t}\n\t}\n\n\tpublic function close(){\n\t\tif(!$this->closed){\n\t\t\tif($this->getFloatingInventory() instanceof FloatingInventory){\n\t\t\t\tforeach($this->getFloatingInventory()->getContents() as $craftingItem){\n\t\t\t\t\t$this->level->dropItem($this, $craftingItem);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->server->getLogger()->debug(\"Attempted to drop a null crafting inventory\\n\");\n\t\t\t}\n\t\t\tif(!($this instanceof Player) or $this->loggedIn){\n\t\t\t\tforeach($this->inventory->getViewers() as $viewer){\n\t\t\t\t\t$viewer->removeWindow($this->inventory);\n\t\t\t\t}\n\t\t\t}\n\t\t\tparent::close();\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Husk.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\Player;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\n\nclass Husk extends Zombie{\n\tconst NETWORK_ID = 47;\n\t\n\tpublic function getName(){\n\t\treturn \"Husk\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Husk::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tEntity::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/InstantEffect.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\entity;\n\nclass InstantEffect extends Effect{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/IronGolem.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass IronGolem extends Animal{\n\tconst NETWORK_ID = 20;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 2.8;\n\t\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(100);\n\t\tparent::initEntity();\n\t}\n\t\n\tpublic function getName() {\n\t\treturn \"Iron Golem\";\n\t}\n\t\n\tpublic function spawnTo(Player $player) {\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = self::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\n\tpublic function getDrops(){\n\t\t//Not affected by Looting.\n\t\t$drops = array(ItemItem::get(ItemItem::IRON_INGOT, 0, mt_rand(3, 5)));\n\t\t$drops[] = ItemItem::get(ItemItem::POPPY, 0, mt_rand(0, 2));\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Item.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\event\\entity\\ItemDespawnEvent;\nuse pocketmine\\event\\entity\\ItemSpawnEvent;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\network\\protocol\\AddItemEntityPacket;\nuse pocketmine\\Player;\n\nclass Item extends Entity{\n\tconst NETWORK_ID = 64;\n\n\tprotected $owner = null;\n\tprotected $thrower = null;\n\tprotected $pickupDelay = 0;\n\t/** @var ItemItem */\n\tprotected $item;\n\n\tpublic $width = 0.25;\n\tpublic $length = 0.25;\n\tpublic $height = 0.25;\n\tprotected $gravity = 0.04;\n\tprotected $drag = 0.02;\n\n\tpublic $canCollide = false;\n\n\tprotected function initEntity(){\n\t\tparent::initEntity();\n\n\t\t$this->setMaxHealth(5);\n\t\t$this->setHealth($this->namedtag[\"Health\"]);\n\t\tif(isset($this->namedtag->Age)){\n\t\t\t$this->age = $this->namedtag[\"Age\"];\n\t\t}\n\t\tif(isset($this->namedtag->PickupDelay)){\n\t\t\t$this->pickupDelay = $this->namedtag[\"PickupDelay\"];\n\t\t}\n\t\tif(isset($this->namedtag->Owner)){\n\t\t\t$this->owner = $this->namedtag[\"Owner\"];\n\t\t}\n\t\tif(isset($this->namedtag->Thrower)){\n\t\t\t$this->thrower = $this->namedtag[\"Thrower\"];\n\t\t}\n\t\tif(!isset($this->namedtag->Item)){\n\t\t\t$this->close();\n\t\t\treturn;\n\t\t}\n\n\t\tassert($this->namedtag->Item instanceof CompoundTag);\n\n\t\t$this->item = ItemItem::nbtDeserialize($this->namedtag->Item);\n\n\t\t$this->server->getPluginManager()->callEvent(new ItemSpawnEvent($this));\n\t}\n\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tif(\n\t\t\t$source->getCause() === EntityDamageEvent::CAUSE_VOID or\n\t\t\t$source->getCause() === EntityDamageEvent::CAUSE_FIRE_TICK or\n\t\t\t$source->getCause() === EntityDamageEvent::CAUSE_ENTITY_EXPLOSION or\n\t\t\t$source->getCause() === EntityDamageEvent::CAUSE_BLOCK_EXPLOSION\n\t\t){\n\t\t\tparent::attack($damage, $source);\n\t\t}\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$this->age++;\n\t\t\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\n\t\tif($tickDiff <= 0 and !$this->justCreated){\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->lastUpdate = $currentTick;\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = $this->entityBaseTick($tickDiff);\n\n\t\tif($this->isAlive()){\n\n\t\t\tif($this->pickupDelay > 0 and $this->pickupDelay < 32767){ //Infinite delay\n\t\t\t\t$this->pickupDelay -= $tickDiff;\n\t\t\t\tif($this->pickupDelay < 0){\n\t\t\t\t\t$this->pickupDelay = 0;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->motionY -= $this->gravity;\n\n\t\t\tif($this->checkObstruction($this->x, $this->y, $this->z)){\n\t\t\t\t$hasUpdate = true;\n\t\t\t}\n\n\t\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\n\n\t\t\t$friction = 1 - $this->drag;\n\n\t\t\tif($this->onGround and (abs($this->motionX) > 0.00001 or abs($this->motionZ) > 0.00001)){\n\t\t\t\t$friction = $this->getLevel()->getBlock($this->temporalVector->setComponents((int) floor($this->x), (int) floor($this->y - 1), (int) floor($this->z) - 1))->getFrictionFactor() * $friction;\n\t\t\t}\n\n\t\t\t$this->motionX *= $friction;\n\t\t\t$this->motionY *= 1 - $this->drag;\n\t\t\t$this->motionZ *= $friction;\n\n\t\t\tif($this->onGround){\n\t\t\t\t$this->motionY *= -0.5;\n\t\t\t}\n\n\t\t\tif($currentTick % 5 ==0)\n\t\t\t\t$this->updateMovement();\n\n\t\t\tif($this->age > 2000){\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new ItemDespawnEvent($this));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t$this->age = 0;\n\t\t\t\t}else{\n\t\t\t\t\t$this->kill();\n\t\t\t\t\t$hasUpdate = true;\n\t\t\t\t}\n\t\t\t}\n\n\t\t}\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate or !$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\n\t}\n\n\tpublic function saveNBT(){\n\t\tparent::saveNBT();\n\t\t$this->namedtag->Item = $this->item->nbtSerialize(-1, \"Item\");\n\t\t$this->namedtag->Health = new ShortTag(\"Health\", $this->getHealth());\n\t\t$this->namedtag->Age = new ShortTag(\"Age\", $this->age);\n\t\t$this->namedtag->PickupDelay = new ShortTag(\"PickupDelay\", $this->pickupDelay);\n\t\tif($this->owner !== null){\n\t\t\t$this->namedtag->Owner = new StringTag(\"Owner\", $this->owner);\n\t\t}\n\t\tif($this->thrower !== null){\n\t\t\t$this->namedtag->Thrower = new StringTag(\"Thrower\", $this->thrower);\n\t\t}\n\t}\n\n\t/**\n\t * @return ItemItem\n\t */\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n\n\tpublic function canCollideWith(Entity $entity){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getPickupDelay(){\n\t\treturn $this->pickupDelay;\n\t}\n\n\t/**\n\t * @param int $delay\n\t */\n\tpublic function setPickupDelay($delay){\n\t\t$this->pickupDelay = $delay;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getOwner(){\n\t\treturn $this->owner;\n\t}\n\n\t/**\n\t * @param string $owner\n\t */\n\tpublic function setOwner($owner){\n\t\t$this->owner = $owner;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getThrower(){\n\t\treturn $this->thrower;\n\t}\n\n\t/**\n\t * @param string $thrower\n\t */\n\tpublic function setThrower($thrower){\n\t\t$this->thrower = $thrower;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddItemEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->item = $this->getItem();\n\t\t$player->dataPacket($pk);\n\n\t\t$this->sendData($player);\n\n\t\tparent::spawnTo($player);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/LavaSlime.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass LavaSlime extends Living{\n\tconst NETWORK_ID = 42;\n\n\tconst DATA_SLIME_SIZE = 16;\n\n\tpublic $dropExp = [1, 4];\n\t\n\tpublic function getName(){\n\t\treturn \"LavaSlime\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = LavaSlime::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Lightning.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\block\\Liquid;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\network\\protocol\\ExplodePacket;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\Player;\n\nclass Lightning extends Animal{\n\tconst NETWORK_ID = 93;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.8;\n\n\tpublic function getName(){\n\t\treturn \"Lightning\";\n\t}\n\n\tpublic function initEntity(){\n\t\tparent::initEntity();\n\t\t$this->setMaxHealth(2);\n\t\t$this->setHealth(2);\n\t}\n\n\tpublic function onUpdate($tick){\n\t\tparent::onUpdate($tick);\n\t\tif($this->age > 20){\n\t\t\t$this->kill();\n\t\t\t$this->close();\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = self::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\t$pk = new ExplodePacket();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->radius = 10;\n\t\t$pk->records = [];\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\n\tpublic function spawnToAll(){\n\t\tparent::spawnToAll();\n\n\t\tif($this->getLevel()->getServer()->lightningFire){\n\t\t\t$fire = ItemItem::get(ItemItem::FIRE)->getBlock();\n\t\t\t$oldBlock = $this->getLevel()->getBlock($this);\n\t\t\tif($oldBlock instanceof Liquid){\n\n\t\t\t}elseif($oldBlock->isSolid()){\n\t\t\t\t$v3 = new Vector3($this->x, $this->y + 1, $this->z);\n\t\t\t}else{\n\t\t\t\t$v3 = new Vector3($this->x, $this->y, $this->z);\n\t\t\t}\n\t\t\tif(isset($v3)) $this->getLevel()->setBlock($v3, $fire);\n\n\t\t\tforeach($this->level->getNearbyEntities($this->boundingBox->grow(4, 3, 4), $this) as $entity){\n\t\t\t\tif($entity instanceof Player){\n\t\t\t\t\t$damage = mt_rand(8, 20);\n\t\t\t\t\t$ev = new EntityDamageByEntityEvent($this, $entity, EntityDamageByEntityEvent::CAUSE_LIGHTNING, $damage);\n\t\t\t\t\tif($entity->attack($ev->getFinalDamage(), $ev) === true){\n\t\t\t\t\t\t$ev->useArmors();\n\t\t\t\t\t}\n\t\t\t\t\t$entity->setOnFire(mt_rand(3, 8));\n\t\t\t\t}\n\n\t\t\t\tif($entity instanceof Creeper){\n\t\t\t\t\t$entity->setPowered(true, $this);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Living.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\entity\\EntityDamageByChildEntityEvent;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\event\\entity\\EntityDeathEvent;\nuse pocketmine\\event\\entity\\EntityRegainHealthEvent;\nuse pocketmine\\event\\Timings;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\EntityEventPacket;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\BlockIterator;\n\nabstract class Living extends Entity implements Damageable{\n\n\tprotected $gravity = 0.08;\n\tprotected $drag = 0.02;\n\n\tprotected $attackTime = 0;\n\t\n\tprotected $invisible = false;\n\n\tprotected function initEntity(){\n\t\tparent::initEntity();\n\n\t\tif(isset($this->namedtag->HealF)){\n\t\t\t$this->namedtag->Health = new ShortTag(\"Health\", (int) $this->namedtag[\"HealF\"]);\n\t\t\tunset($this->namedtag->HealF);\n\t\t}\n\n\t\tif(!isset($this->namedtag->Health) or !($this->namedtag->Health instanceof ShortTag)){\n\t\t\t$this->namedtag->Health = new ShortTag(\"Health\", $this->getMaxHealth());\n\t\t}\n\t\t\n\t\tif($this->namedtag[\"Health\"] <= 0)\n\t\t\t$this->setHealth(20);\n\t\telse $this->setHealth($this->namedtag[\"Health\"]);\n\t}\n\n\tpublic function setHealth($amount){\n\t\t$wasAlive = $this->isAlive();\n\t\tparent::setHealth($amount);\n\t\tif($this->isAlive() and !$wasAlive){\n\t\t\t$pk = new EntityEventPacket();\n\t\t\t$pk->eid = $this->getId();\n\t\t\t$pk->event = EntityEventPacket::RESPAWN;\n\t\t\t$this->server->broadcastPacket($this->hasSpawned, $pk);\n\t\t}\n\t}\n\n\tpublic function saveNBT(){\n\t\tparent::saveNBT();\n\t\t$this->namedtag->Health = new ShortTag(\"Health\", $this->getHealth());\n\t}\n\n\tpublic abstract function getName();\n\n\tpublic function hasLineOfSight(Entity $entity){\n\t\t//TODO: head height\n\t\treturn true;\n\t\t//return $this->getLevel()->rayTraceBlocks(Vector3::createVector($this->x, $this->y + $this->height, $this->z), Vector3::createVector($entity->x, $entity->y + $entity->height, $entity->z)) === null;\n\t}\n\n\tpublic function heal($amount, EntityRegainHealthEvent $source){\n\t\tparent::heal($amount, $source);\n\t\tif($source->isCancelled()){\n\t\t\treturn;\n\t\t}\n\n\t\t$this->attackTime = 0;\n\t}\n\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tif($this->attackTime > 0 or $this->noDamageTicks > 0){\n\t\t\t$lastCause = $this->getLastDamageCause();\n\t\t\tif($lastCause !== null and $lastCause->getDamage() >= $damage){\n                $source->setCancelled();\n\t\t\t}\n\t\t}\n\n        parent::attack($damage, $source);\n\n        if($source->isCancelled()){\n            return;\n        }\n\n\t\tif($source instanceof EntityDamageByEntityEvent){\n\t\t\t$e = $source->getDamager();\n\t\t\tif($source instanceof EntityDamageByChildEntityEvent){\n\t\t\t\t$e = $source->getChild();\n\t\t\t}\n\n\t\t\tif($e->isOnFire() > 0 and !($e instanceof Player)){\n\t\t\t\t$this->setOnFire(2 * $this->server->getDifficulty());\n\t\t\t}\n\n\t\t\t$deltaX = $this->x - $e->x;\n\t\t\t$deltaZ = $this->z - $e->z;\n\t\t\t$this->knockBack($e, $damage, $deltaX, $deltaZ, $source->getKnockBack());\n\t\t\tif($e instanceof Husk){\n\t\t\t\t$this->addEffect(Effect::getEffect(Effect::HUNGER)->setDuration(7 * 20 * $this->server->getDifficulty()));\n\t\t\t}\n\t\t}\n\n\t\t$pk = new EntityEventPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->event = $this->getHealth() <= 0 ? EntityEventPacket::DEATH_ANIMATION : EntityEventPacket::HURT_ANIMATION; //Ouch!\n\t\t$this->server->broadcastPacket($this->hasSpawned, $pk);\n\n\t\t$this->attackTime = 10; //0.5 seconds cooldown\n\t}\n\n\tpublic function knockBack(Entity $attacker, $damage, $x, $z, $base = 0.4){\n\t\t$f = sqrt($x * $x + $z * $z);\n\t\tif($f <= 0){\n\t\t\treturn;\n\t\t}\n\n\t\t$f = 1 / $f;\n\n\t\t$motion = new Vector3($this->motionX, $this->motionY, $this->motionZ);\n\n\t\t$motion->x /= 2;\n\t\t$motion->y /= 2;\n\t\t$motion->z /= 2;\n\t\t$motion->x += $x * $f * $base;\n\t\t$motion->y += $base;\n\t\t$motion->z += $z * $f * $base;\n\n\t\tif($motion->y > $base){\n\t\t\t$motion->y = $base;\n\t\t}\n\n\t\t$this->setMotion($motion);\n\t}\n\n\tpublic function kill(){\n\t\tif(!$this->isAlive()){\n\t\t\treturn;\n\t\t}\n\t\tparent::kill();\n\t\t$this->server->getPluginManager()->callEvent($ev = new EntityDeathEvent($this, $this->getDrops()));\n\t\tforeach($ev->getDrops() as $item){\n\t\t\t$this->getLevel()->dropItem($this, $item);\n\t\t}\n\t}\n\n\tpublic function entityBaseTick($tickDiff = 1, $EnchantL = 0){\n\t\tTimings::$timerLivingEntityBaseTick->startTiming();\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BREATHING, !$this->isInsideOfWater());\n\n\t\t$hasUpdate = parent::entityBaseTick($tickDiff);\n\n\t\tif($this->isAlive()){\n\t\t\tif($this->isInsideOfSolid()){\n\t\t\t\t$hasUpdate = true;\n\t\t\t\t$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 1);\n\t\t\t\t$this->attack($ev->getFinalDamage(), $ev);\n\t\t\t}\n\n\t\t\tif(!$this->hasEffect(Effect::WATER_BREATHING) and $this->isInsideOfWater()){\n\t\t\t\tif($this instanceof WaterAnimal){\n\t\t\t\t\t$this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 400);\n\t\t\t\t}else{\n\t\t\t\t\t$hasUpdate = true;\n\t\t\t\t\t$airTicks = $this->getDataProperty(self::DATA_AIR) - $tickDiff * (4 - $EnchantL);\n\t\t\t\t\tif($airTicks <= -80){\n\t\t\t\t\t\t$airTicks = 0;\n\n\t\t\t\t\t\t$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_DROWNING, 2);\n\t\t\t\t\t\t$this->attack($ev->getFinalDamage(), $ev);\n\t\t\t\t\t}\n\t\t\t\t\t$this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $airTicks);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif($this instanceof WaterAnimal){\n\t\t\t\t\t$hasUpdate = true;\n\t\t\t\t\t$airTicks = $this->getDataProperty(self::DATA_AIR) - $tickDiff * (4 - $EnchantL);\n\t\t\t\t\tif($airTicks <= -80){\n\t\t\t\t\t\t$airTicks = 0;\n\n\t\t\t\t\t\t$ev = new EntityDamageEvent($this, EntityDamageEvent::CAUSE_SUFFOCATION, 2);\n\t\t\t\t\t\t$this->attack($ev->getFinalDamage(), $ev);\n\t\t\t\t\t}\n\t\t\t\t\t$this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, $airTicks);\n\t\t\t\t}else{\n\t\t\t\t\t$this->setDataProperty(self::DATA_AIR, self::DATA_TYPE_SHORT, 400);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($this->attackTime > 0){\n\t\t\t$this->attackTime -= $tickDiff;\n\t\t}\n\n\t\tTimings::$timerLivingEntityBaseTick->stopTiming();\n\n\t\treturn $hasUpdate;\n\t}\n\n\t/**\n\t * @return ItemItem[]\n\t */\n\tpublic function getDrops(){\n\t\treturn [];\n\t}\n\n\t/**\n\t * @param int   $maxDistance\n\t * @param int   $maxLength\n\t * @param array $transparent\n\t *\n\t * @return Block[]\n\t */\n\tpublic function getLineOfSight($maxDistance, $maxLength = 0, array $transparent = []){\n\t\tif($maxDistance > 120){\n\t\t\t$maxDistance = 120;\n\t\t}\n\n\t\tif(count($transparent) === 0){\n\t\t\t$transparent = null;\n\t\t}\n\n\t\t$blocks = [];\n\t\t$nextIndex = 0;\n\n\t\t$itr = new BlockIterator($this->level, $this->getPosition(), $this->getDirectionVector(), $this->getEyeHeight(), $maxDistance);\n\n\t\twhile($itr->valid()){\n\t\t\t$itr->next();\n\t\t\t$block = $itr->current();\n\t\t\t$blocks[$nextIndex++] = $block;\n\n\t\t\tif($maxLength !== 0 and count($blocks) > $maxLength){\n\t\t\t\tarray_shift($blocks);\n\t\t\t\t--$nextIndex;\n\t\t\t}\n\n\t\t\t$id = $block->getId();\n\n\t\t\tif($transparent === null){\n\t\t\t\tif($id !== 0){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif(!isset($transparent[$id])){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $blocks;\n\t}\n\n\t/**\n\t * @param int   $maxDistance\n\t * @param array $transparent\n\t *\n\t * @return Block\n\t */\n\tpublic function getTargetBlock($maxDistance, array $transparent = []){\n\t\ttry{\n\t\t\t$block = $this->getLineOfSight($maxDistance, 1, $transparent)[0];\n\t\t\tif($block instanceof Block){\n\t\t\t\treturn $block;\n\t\t\t}\n\t\t}catch (\\ArrayOutOfBoundsException $e){\n\n\t\t}\n\n\t\treturn null;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Minecart.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Rail;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\network\\protocol\\EntityEventPacket;\nuse pocketmine\\math\\Math;\nuse pocketmine\\math\\Vector3;\n\nclass Minecart extends Vehicle{\n\tconst NETWORK_ID = 84;\n\n\tconst TYPE_NORMAL = 1;\n\tconst TYPE_CHEST = 2;\n\tconst TYPE_HOPPER = 3;\n\tconst TYPE_TNT = 4;\n\n\tconst STATE_INITIAL = 0;\n\tconst STATE_ON_RAIL = 1;\n\tconst STATE_OFF_RAIL = 2;\n\n\tpublic $height = 0.7;\n\tpublic $width = 0.98;\n\n\tpublic $drag = 0.1;\n\tpublic $gravity = 0.5;\n\n\tpublic $isMoving = false;\n\tpublic $moveSpeed = 0.4;\n\n\tprivate $state = Minecart::STATE_INITIAL;\n\tprivate $direction = -1;\n\tprivate $moveVector = [];\n\tprivate $requestedPosition = null;\n\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(1);\n\t\t$this->setHealth($this->getMaxHealth());\n\t\t$this->moveVector[Entity::NORTH] = new Vector3(-1, 0, 0);\n\t\t$this->moveVector[Entity::SOUTH] = new Vector3(1, 0, 0);\n\t\t$this->moveVector[Entity::EAST] = new Vector3(0, 0, -1);\n\t\t$this->moveVector[Entity::WEST] = new Vector3(0, 0, 1);\n\t\tparent::initEntity();\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Minecart\";\n\t}\n\n\tpublic function getType() : int{\n\t\treturn self::TYPE_NORMAL;\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed !== false){\n\t\t\treturn false;\n\t\t}\n\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\n\t\tif($tickDiff <= 1){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->lastUpdate = $currentTick;\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = false;\n\t\t//parent::onUpdate($currentTick);\n\n\t\tif($this->isAlive()){\n\t\t\t$p = $this->getLinkedEntity();\n\t\t\tif($p instanceof Player){\n\t\t\t\tif($this->state === Minecart::STATE_INITIAL){\n\t\t\t\t\t$this->checkIfOnRail();\n\t\t\t\t}elseif($this->state === Minecart::STATE_ON_RAIL){\n\t\t\t\t\t$hasUpdate = $this->forwardOnRail($p);\n\t\t\t\t\t$this->updateMovement();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->timings->stopTiming ();\n\n\t\treturn $hasUpdate or ! $this->onGround or abs ( $this->motionX ) > 0.00001 or abs ( $this->motionY ) > 0.00001 or abs ( $this->motionZ ) > 0.00001;\n\t}\n\n\n\t/**\n\t * Check if minecart is currently on a rail and if so center the cart.\n\t */\n\tprivate function checkIfOnRail() {\n\t\tfor ($y = -1; $y !== 2 and $this->state === Minecart::STATE_INITIAL; $y++) {\n\t\t\t$positionToCheck = $this->temporalVector->setComponents($this->x, $this->y + $y, $this->z);\n\t\t\t$block = $this->level->getBlock($positionToCheck);\n\t\t\tif($this->isRail($block)){\n\t\t\t\t$minecartPosition = $positionToCheck->floor()->add(0.5, 0, 0.5);\n\t\t\t\t$this->setPosition($minecartPosition);    // Move minecart to center of rail\n\t\t\t\t$this->state = Minecart::STATE_ON_RAIL;\n\t\t\t}\n\t\t}\n\t\tif($this->state !== Minecart::STATE_ON_RAIL){\n\t\t\t$this->state = Minecart::STATE_OFF_RAIL;\n\t\t}\n\t}\n\n\tprivate function isRail($rail) {\n\t\treturn ($rail !== null and in_array($rail->getId(), [Block::RAIL, Block::ACTIVATOR_RAIL, Block::DETECTOR_RAIL, Block::POWERED_RAIL]));\n\t}\n\n\tprivate function getCurrentRail() {\n\t\t$block = $this->getLevel()->getBlock($this);\n\t\tif($this->isRail($block)){\n\t\t\treturn $block;\n\t\t}\n\t\t// Rail could be one block below descending down\n\t\t$down = $this->temporalVector->setComponents($this->x, $this->y - 1, $this->z);\n\t\t$block = $this->getLevel()->getBlock($down);\n\t\tif($this->isRail($block)){\n\t\t\treturn $block;\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * Attempt to move forward on rail given the direction the cart is already moving, or if not moving based\n\t * on the direction the player is looking.\n\t * @param Player $player Player riding the minecart.\n\t * @return boolean True if minecart moved, false otherwise.\n\t */\n\tprivate function forwardOnRail(Player $player) {\n\t\tif($this->direction === -1){\n\t\t\t$candidateDirection = $player->getDirection();\n\t\t}else{\n\t\t\t$candidateDirection = $this->direction;\n\t\t}\n\t\t$rail = $this->getCurrentRail();\n\t\tif ($rail !== null) {\n\t\t\t$railType = $rail->getDamage ();\n\t\t\t$nextDirection = $this->getDirectionToMove($railType, $candidateDirection);\n\t\t\tif ($nextDirection !== -1) {\n\t\t\t\t$this->direction = $nextDirection;\n\t\t\t\t$moved = $this->checkForVertical($railType, $nextDirection);\n\t\t\t\tif(!$moved){\n\t\t\t\t\treturn $this->moveIfRail();\n\t\t\t\t}else{\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->direction = -1;  // Was not able to determine direction to move, so wait for player to look in valid direction\n\t\t\t}\n\t\t}else{\n\t\t\t// Not able to find rail\n\t\t\t$this->state = Minecart::STATE_INITIAL;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Determine the direction the minecart should move based on the candidate direction (current direction\n\t * minecart is moving, or the direction the player is looking) and the type of rail that the minecart is\n\t * on.\n\t * @param RailType $railType Type of rail the minecart is on.\n\t * @param Direction $candidateDirection Direction minecart already moving, or direction player looking.\n\t * @return Direction The direction the minecart should move.\n\t */\n\tprivate function getDirectionToMove($railType, $candidateDirection) {\n\t\tswitch($railType){\n\t\t\tcase Rail::STRAIGHT_NORTH_SOUTH:\n\t\t\tcase Rail::SLOPED_ASCENDING_NORTH:\n\t\t\tcase Rail::SLOPED_ASCENDING_SOUTH:\n\t\t\t\tswitch($candidateDirection){\n\t\t\t\t\tcase Entity::NORTH:\n\t\t\t\t\tcase Entity::SOUTH:\n\t\t\t\t\t\treturn $candidateDirection;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::STRAIGHT_EAST_WEST:\n\t\t\tcase Rail::SLOPED_ASCENDING_EAST:\n\t\t\tcase Rail::SLOPED_ASCENDING_WEST:\n\t\t\t\tswitch($candidateDirection){\n\t\t\t\t\tcase Entity::WEST:\n\t\t\t\t\tcase Entity::EAST:\n\t\t\t\t\t\treturn $candidateDirection;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::CURVED_SOUTH_EAST:\n\t\t\t\tswitch($candidateDirection){\n\t\t\t\t\tcase Entity::SOUTH:\n\t\t\t\t\tcase Entity::EAST:\n\t\t\t\t\t\treturn $candidateDirection;\n\t\t\t\t\tcase Entity::NORTH:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::EAST);\n\t\t\t\t\tcase Entity::WEST:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::SOUTH);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::CURVED_SOUTH_WEST:\n\t\t\t\tswitch($candidateDirection){\n\t\t\t\t\tcase Entity::SOUTH:\n\t\t\t\t\tcase Entity::WEST:\n\t\t\t\t\t\treturn $candidateDirection;\n\t\t\t\t\tcase Entity::NORTH:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::WEST);\n\t\t\t\t\tcase Entity::EAST:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::SOUTH);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::CURVED_NORTH_WEST:\n\t\t\t\tswitch ($candidateDirection) {\n\t\t\t\t\tcase Entity::NORTH:\n\t\t\t\t\tcase Entity::WEST:\n\t\t\t\t\t\treturn $candidateDirection;\n\t\t\t\t\tcase Entity::SOUTH:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::WEST);\n\t\t\t\t\tcase Entity::EAST:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::NORTH);\n\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::CURVED_NORTH_EAST:\n\t\t\t\tswitch ($candidateDirection) {\n\t\t\t\t\tcase Entity::NORTH:\n\t\t\t\t\tcase Entity::EAST:\n\t\t\t\t\t\treturn $candidateDirection;\n\t\t\t\t\tcase Entity::SOUTH:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::EAST);\n\t\t\t\t\tcase Entity::WEST:\n\t\t\t\t\t\treturn $this->checkForTurn($candidateDirection, Entity::NORTH);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\treturn -1;\n\t}\n\n\t/**\n\t * Need to alter direction on curves halfway through the turn and reset the minecart to be in the middle of\n\t * the rail again so as not to collide with nearby blocks.\n\t * @param Direction $currentDirection Direction minecart currently moving\n\t * @param Direction $newDirection Direction minecart should turn once has hit the halfway point.\n\t * @return Direction Either the current direction or the new direction depending on haw far across the rail the\n\t * minecart is.\n\t */\n\tprivate function checkForTurn($currentDirection, $newDirection) {\n\t\tswitch($currentDirection) {\n\t\t\tcase Entity::NORTH:\n\t\t\t\t$diff = $this->x - $this->getFloorX();\n\t\t\t\tif ($diff !== 0 and $diff <= .5) {\n\t\t\t\t\t$dx = ($this->getFloorX() + .5) - $this->x;\n\t\t\t\t\t$this->move($dx, 0, 0);\n\t\t\t\t\treturn $newDirection;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Entity::SOUTH:\n\t\t\t\t$diff = $this->x - $this->getFloorX();\n\t\t\t\tif ($diff !== 0 and $diff >= .5) {\n\t\t\t\t\t$dx = ($this->getFloorX() + .5) - $this->x;\n\t\t\t\t\t$this->move($dx, 0, 0);\n\t\t\t\t\treturn $newDirection;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Entity::EAST:\n\t\t\t\t$diff = $this->z - $this->getFloorZ();\n\t\t\t\tif ($diff !== 0 and $diff <= .5) {\n\t\t\t\t\t$dz = ($this->getFloorZ() + .5) - $this->z;\n\t\t\t\t\t$this->move(0, 0, $dz);\n\t\t\t\t\treturn $newDirection;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Entity::WEST:\n\t\t\t\t$diff = $this->z - $this->getFloorZ();\n\t\t\t\tif ($diff !== 0 and $diff >= .5) {\n\t\t\t\t\t$dz = $dz = ($this->getFloorZ() + .5) - $this->z;\n\t\t\t\t\t$this->move(0, 0, $dz);\n\t\t\t\t\treturn $newDirection;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $currentDirection;\n\t}\n\n\tprivate function checkForVertical($railType, $currentDirection) {\n\t\tswitch ($railType) {\n\t\t\tcase Rail::SLOPED_ASCENDING_NORTH:\n\t\t\t\tswitch($currentDirection){\n\t\t\t\t\tcase Entity::NORTH:\n\t\t\t\t\t\t// Headed north up\n\t\t\t\t\t\t$diff = $this->x - $this->getFloorX();\n\t\t\t\t\t\tif ($diff !== 0 and $diff <= .5) {\n\t\t\t\t\t\t\t$dx = ($this->getFloorX() - .1) - $this->x;\n\t\t\t\t\t\t\t$this->move($dx, 1, 0);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase ENTITY::SOUTH:\n\t\t\t\t\t\t// Headed south down\n\t\t\t\t\t\t$diff = $this->x - $this->getFloorX();\n\t\t\t\t\t\tif ($diff !== 0 and $diff >= .5) {\n\t\t\t\t\t\t\t$dx = ($this->getFloorX() + 1 ) - $this->x;\n\t\t\t\t\t\t\t$this->move($dx, -1, 0);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::SLOPED_ASCENDING_SOUTH:\n\t\t\t\tswitch($currentDirection){\n\t\t\t\t\tcase Entity::SOUTH:\n\t\t\t\t\t\t// Headed south up\n\t\t\t\t\t\t$diff = $this->x - $this->getFloorX();\n\t\t\t\t\t\tif ($diff !== 0 and $diff >= .5) {\n\t\t\t\t\t\t\t$dx = ($this->getFloorX() + 1 ) - $this->x;\n\t\t\t\t\t\t\t$this->move($dx, 1, 0);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Entity::NORTH:\n\t\t\t\t\t\t// Headed north down\n\t\t\t\t\t\t$diff = $this->x - $this->getFloorX();\n\t\t\t\t\t\tif ($diff !== 0 and $diff <= .5) {\n\t\t\t\t\t\t\t$dx = ($this->getFloorX() - .1) - $this->x;\n\t\t\t\t\t\t\t$this->move($dx, -1, 0);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::SLOPED_ASCENDING_EAST:\n\t\t\t\tswitch($currentDirection){\n\t\t\t\t\tcase Entity::EAST:\n\t\t\t\t\t\t// Headed east up\n\t\t\t\t\t\t$diff = $this->z - $this->getFloorZ();\n\t\t\t\t\t\tif ($diff !== 0 and $diff <= .5) {\n\t\t\t\t\t\t\t$dz = ($this->getFloorZ() - .1) - $this->z;\n\t\t\t\t\t\t\t$this->move(0, 1, $dz);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Entity::WEST:\n\t\t\t\t\t\t// Headed west down\n\t\t\t\t\t\t$diff = $this->z - $this->getFloorZ();\n\t\t\t\t\t\tif ($diff !== 0 and $diff >= .5) {\n\t\t\t\t\t\t\t$dz = ($this->getFloorZ() + 1) - $this->z;\n\t\t\t\t\t\t\t$this->move(0, -1, $dz);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Rail::SLOPED_ASCENDING_WEST:\n\t\t\t\tswitch($currentDirection){\n\t\t\t\t\tcase Entity::WEST:\n\t\t\t\t\t\t// Headed west up\n\t\t\t\t\t\t$diff = $this->z - $this->getFloorZ();\n\t\t\t\t\t\tif ($diff !== 0 and $diff >= .5) {\n\t\t\t\t\t\t\t$dz = ($this->getFloorZ() + 1) - $this->z;\n\t\t\t\t\t\t\t$this->move(0, 1, $dz);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Entity::EAST:\n\t\t\t\t\t\t// Headed east down\n\t\t\t\t\t\t$diff = $this->z - $this->getFloorZ();\n\t\t\t\t\t\tif ($diff !== 0 and $diff <= .5) {\n\t\t\t\t\t\t\t$dz = ($this->getFloorZ() - .1) - $this->z;\n\t\t\t\t\t\t\t$this->move(0, -1, $dz);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Move the minecart as long as it will still be moving on to another piece of rail.\n\t * @return boolean True if the minecart moved.\n\t */\n\tprivate function moveIfRail(){\n\t\t$nextMoveVector = $this->moveVector[$this->direction];\n\t\t$nextMoveVector = $nextMoveVector->multiply($this->moveSpeed);\n\t\t$newVector = $this->add($nextMoveVector->x, $nextMoveVector->y, $nextMoveVector->z);\n\t\t$possibleRail = $this->getCurrentRail();\n\t\tif(in_array($possibleRail->getId(), [Block::RAIL, Block::ACTIVATOR_RAIL, Block::DETECTOR_RAIL, Block::POWERED_RAIL])) {\n\t\t\t$this->moveUsingVector($newVector);\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Invoke the normal move code, but first need to convert the desired position vector into the\n\t * delta values from the current position.\n\t * @param Vector3 $desiredPosition\n\t */\n\tprivate function moveUsingVector(Vector3 $desiredPosition){\n\t\t$dx = $desiredPosition->x - $this->x;\n\t\t$dy = $desiredPosition->y - $this->y;\n\t\t$dz = $desiredPosition->z - $this->z;\n\t\t$this->move($dx, $dy, $dz);\n\t}\n\n\n\t/**\n\t * @return Rail\n\t */\n\tpublic function getNearestRail(){\n\t\t$minX = Math::floorFloat($this->boundingBox->minX);\n\t\t$minY = Math::floorFloat($this->boundingBox->minY);\n\t\t$minZ = Math::floorFloat($this->boundingBox->minZ);\n\t\t$maxX = Math::ceilFloat($this->boundingBox->maxX);\n\t\t$maxY = Math::ceilFloat($this->boundingBox->maxY);\n\t\t$maxZ = Math::ceilFloat($this->boundingBox->maxZ);\n\n\t\t$rails = [];\n\n\t\tfor($z = $minZ; $z <= $maxZ; ++$z){\n\t\t\tfor($x = $minX; $x <= $maxX; ++$x){\n\t\t\t\tfor($y = $minY; $y <= $maxY; ++$y){\n\t\t\t\t\t$block = $this->level->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\t\t\t\t\tif(in_array($block->getId(), [Block::RAIL, Block::ACTIVATOR_RAIL, Block::DETECTOR_RAIL, Block::POWERED_RAIL])) $rails[] = $block;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$minDistance = PHP_INT_MAX;\n\t\t$nearestRail = null;\n\t\tforeach($rails as $rail){\n\t\t\t$dis = $this->distance($rail);\n\t\t\tif($dis < $minDistance){\n\t\t\t\t$nearestRail = $rail;\n\t\t\t\t$minDistance = $dis;\n\t\t\t}\n\t\t}\n\t\treturn $nearestRail;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Minecart::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = 0;\n\t\t$pk->speedY = 0;\n\t\t$pk->speedZ = 0;\n\t\t$pk->yaw = 0;\n\t\t$pk->pitch = 0;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\n\t/*public function attack($damage, EntityDamageEvent $source){\n\t\tparent::attack($damage, $source);\n\n\t\tif(!$source->isCancelled()){\n\t\t\t$pk = new EntityEventPacket();\n\t\t\t$pk->eid = $this->id;\n\t\t\t$pk->event = EntityEventPacket::HURT_ANIMATION;\n\t\t\tforeach($this->getLevel()->getPlayers() as $player){\n\t\t\t\t$player->dataPacket($pk);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getSaveId(){\n\t\t$class = new \\ReflectionClass(static::class);\n\t\treturn $class->getShortName();\n\t}*/\n}\n"
  },
  {
    "path": "src/pocketmine/entity/MinecartChest.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass MinecartChest extends Minecart{\n\tconst NETWORK_ID = 98;\n\n\tpublic function getName(){\n\t\treturn \"Minecart Chest\";\n\t}\n\n\tpublic function getType() : int{\n\t\treturn self::TYPE_CHEST;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = MinecartChest::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = 0;\n\t\t$pk->speedY = 0;\n\t\t$pk->speedZ = 0;\n\t\t$pk->yaw = 0;\n\t\t$pk->pitch = 0;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tEntity::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/MinecartHopper.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass MinecartHopper extends Minecart{\n\tconst NETWORK_ID = 96;\n\n\tpublic function getName(){\n\t\treturn \"Minecart Hopper\";\n\t}\n\n\tpublic function getType() : int{\n\t\treturn self::TYPE_HOPPER;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = MinecartHopper::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = 0;\n\t\t$pk->speedY = 0;\n\t\t$pk->speedZ = 0;\n\t\t$pk->yaw = 0;\n\t\t$pk->pitch = 0;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tEntity::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/MinecartTNT.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass MinecartTNT extends Minecart{\n\tconst NETWORK_ID = 97;\n\n\tpublic function getName(){\n\t\treturn \"Minecart TNT\";\n\t}\n\n\tpublic function getType() : int{\n\t\treturn self::TYPE_TNT;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = MinecartTNT::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = 0;\n\t\t$pk->speedY = 0;\n\t\t$pk->speedZ = 0;\n\t\t$pk->yaw = 0;\n\t\t$pk->pitch = 0;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tEntity::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Monster.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nabstract class Monster extends Creature{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Mooshroom.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Mooshroom extends Animal{\n\tconst NETWORK_ID = 16;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.8;\n\t\n\tpublic function getName(){\n\t\treturn \"Mooshroom\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Mooshroom::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t$lootingL = 0;\n\t\t$cause = $this->lastDamageCause;\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\n\t\t}\n\t\t$drops = array(ItemItem::get(ItemItem::RAW_BEEF, 0, mt_rand(1, 3 + $lootingL)));\n\t\t$drops[] = ItemItem::get(ItemItem::LEATHER, 0, mt_rand(0, 2 + $lootingL));\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/NPC.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface NPC{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Ocelot.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\nbt\\tag\\ByteTag;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\Player;\r\n\r\nclass Ocelot extends Animal{\r\n\tconst NETWORK_ID = 22;\r\n\r\n\tconst DATA_CAT_TYPE = 18;\r\n\r\n\tconst TYPE_WILD = 0;\r\n\tconst TYPE_TUXEDO = 1;\r\n\tconst TYPE_TABBY = 2;\r\n\tconst TYPE_SIAMESE = 3;\r\n\r\n\tpublic $width = 0.312;\r\n\tpublic $length = 2.188;\r\n\tpublic $height = 0.75;\r\n\r\n\tpublic $dropExp = [1, 3];\r\n\t\r\n\tpublic function getName(){\r\n\t\treturn \"Ocelot\";\r\n\t}\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\r\n\t\tif(!isset($nbt->CatType)){\r\n\t\t\t$nbt->CatType = new ByteTag(\"CatType\", mt_rand(0, 3));\r\n\t\t}\r\n\t\tparent::__construct($chunk, $nbt);\r\n\r\n\t\t$this->setDataProperty(self::DATA_CAT_TYPE, self::DATA_TYPE_BYTE, $this->getCatType());\r\n\t}\r\n\r\n\tpublic function setCatType(int $type){\r\n\t\t$this->namedtag->CatType = new ByteTag(\"CatType\", $type);\r\n\t}\r\n\r\n\tpublic function getCatType() : int{\r\n\t\treturn (int) $this->namedtag[\"CatType\"];\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->type = self::NETWORK_ID;\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->yaw = $this->yaw;\r\n\t\t$pk->pitch = $this->pitch;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}"
  },
  {
    "path": "src/pocketmine/entity/Painting.php",
    "content": "<?php\n/*\n * This file is translated from the Nukkit Project\n * which is written by MagicDroidX\n * @link https://github.com/Nukkit/Nukkit\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\network\\protocol\\AddPaintingPacket;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\Player;\nuse pocketmine\\level\\particle\\DestroyBlockParticle;\nuse pocketmine\\block\\Block;\n\nclass Painting extends Hanging{\n\tconst NETWORK_ID = 83;\n\n\tprivate $motive;\n\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(1);\n\t\tparent::initEntity();\n\n\t\tif(isset($this->namedtag->Motive)){\n\t\t\t$this->motive = $this->namedtag[\"Motive\"];\n\t\t}else $this->close();\n\t}\n\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tparent::attack($damage, $source);\n\t\tif($source->isCancelled()) return false;\n\t\t$this->level->addParticle(new DestroyBlockParticle($this->add(0.5), Block::get(Block::LADDER)));\n\t\t$this->kill();\n\t\treturn true;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddPaintingPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->direction = $this->getDirection();\n\t\t$pk->title = $this->motive;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\n\tprotected function updateMovement(){\n\t\t//Nothing to update, paintings cannot move.\n\t}\n\n\tpublic function getDrops(){\n\t\treturn [ItemItem::get(ItemItem::PAINTING, 0, 1)];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Pig.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Pig extends Animal{\n\tconst NETWORK_ID = 12;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.9;\n\n\tpublic $dropExp = [1, 3];\n\t\n\tpublic function getName(){\n\t\treturn \"Pig\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Pig::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t$lootingL = 0;\n\t\t$cause = $this->lastDamageCause;\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\n\t\t}\n\t\t$drops = array(ItemItem::get(ItemItem::RAW_PORKCHOP, 0, mt_rand(1, 3 + $lootingL)));\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/PigZombie.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\network\\protocol\\MobEquipmentPacket;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\Player;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\item\\enchantment\\Enchantment;\n\nclass PigZombie extends Monster{\n\tconst NETWORK_ID = 36;\n\n\tpublic $width = 0.6;\n\tpublic $length = 0.6;\n\tpublic $height = 1.8;\n\n\tpublic $drag = 0.2;\n\tpublic $gravity = 0.3;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"PigZombie\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = PigZombie::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t\t\n\t\t$pk = new MobEquipmentPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->item = new ItemItem(283);\n\t\t$pk->slot = 0;\n\t\t$pk->selectedSlot = 0;\n\n\t\t$player->dataPacket($pk);\n\t}\n\n\tpublic function getDrops(){\n\t\t$cause = $this->lastDamageCause;\n\t\t$drops = [];\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\n\t\t\tif(mt_rand(1, 200) <= (5 + 2 * $lootingL)){\n\t\t\t\t$drops[] = ItemItem::get(ItemItem::GOLD_INGOT, 0, 1);\n\t\t\t}\n\t\t\t$drops[] = ItemItem::get(ItemItem::GOLD_NUGGET, 0, mt_rand(0, 1 + $lootingL));\n\t\t\t$drops[] = ItemItem::get(ItemItem::ROTTEN_FLESH, 0, mt_rand(0, 1 + $lootingL));\n\t\t}\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/PolarBear.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\network\\protocol\\MobEquipmentPacket;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\Player;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\item\\enchantment\\Enchantment;\n\nclass PolarBear extends Monster{\n\tconst NETWORK_ID = 28;\n\n\tpublic $width = 1.3;\n\tpublic $length = 0.6;//unknown\n\tpublic $height = 1.4;\n\n\tpublic $drag = 0.2;\n\tpublic $gravity = 0.3;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\t$this->setMaxHealth(30);\n\t\treturn \"Polar Bear\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = PolarBear::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\n\tpublic function getDrops(){\n\t\t$cause = $this->lastDamageCause;\n\t\t$drops = [];\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$drops = [];\n\t\t\tif (mt_rand(1, 4) === 1) {\n\t\t\t\t$drops[] = ItemItem::get(ItemItem::RAW_SALMON, 0, mt_rand(0, 2));//yes.. 0,2\n\t\t\t} else {\n\t\t\t\t$drops[] = ItemItem::get(ItemItem::RAW_FISH, 0, mt_rand(0, 2));//yes.. 0,2\n\t\t\t}\n\t\t}\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/PrimedTNT.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____            _        _   __  __ _                  __  __ ____  \r\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \r\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\r\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \r\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author PocketMine Team\r\n * @link http://www.pocketmine.net/\r\n * \r\n *\r\n*/\r\n\r\nnamespace pocketmine\\entity;\r\n\r\n\r\nuse pocketmine\\event\\entity\\EntityDamageEvent;\r\n\r\nuse pocketmine\\event\\entity\\ExplosionPrimeEvent;\r\nuse pocketmine\\level\\Explosion;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\ByteTag;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\network\\Network;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Player;\r\n\r\nclass PrimedTNT extends Entity implements Explosive{\r\n\tconst NETWORK_ID = 65;\r\n\r\n\tpublic $width = 0.98;\r\n\tpublic $length = 0.98;\r\n\tpublic $height = 0.98;\r\n\r\n\tprotected $gravity = 0.04;\r\n\tprotected $drag = 0.02;\r\n\r\n\tprotected $fuse;\r\n\r\n\tpublic $canCollide = false;\r\n\r\n\tprivate $dropItem = true;\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, bool $dropItem = true){\r\n\t\tparent::__construct($chunk, $nbt);\r\n\t\t$this->dropItem = $dropItem;\r\n\t}\r\n\r\n\r\n\tpublic function attack($damage, EntityDamageEvent $source){\r\n\t\tif($source->getCause() === EntityDamageEvent::CAUSE_VOID){\r\n\t\t\tparent::attack($damage, $source);\r\n\t\t}\r\n\t}\r\n\r\n\tprotected function initEntity(){\r\n\t\tparent::initEntity();\r\n\r\n\t\tif(isset($this->namedtag->Fuse)){\r\n\t\t\t$this->fuse = $this->namedtag[\"Fuse\"];\r\n\t\t}else{\r\n\t\t\t$this->fuse = 80;\r\n\t\t}\r\n\t}\r\n\r\n\r\n\tpublic function canCollideWith(Entity $entity){\r\n\t\treturn false;\r\n\t}\r\n\r\n\tpublic function saveNBT(){\r\n\t\tparent::saveNBT();\r\n\t\t$this->namedtag->Fuse = new ByteTag(\"Fuse\", $this->fuse);\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$this->timings->startTiming();\r\n\r\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\r\n\t\tif($tickDiff <= 0 and !$this->justCreated){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t$this->lastUpdate = $currentTick;\r\n\r\n\t\t$hasUpdate = $this->entityBaseTick($tickDiff);\r\n\r\n\t\tif($this->isAlive()){\r\n\r\n\t\t\t$this->motionY -= $this->gravity;\r\n\r\n\t\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\r\n\r\n\t\t\t$friction = 1 - $this->drag;\r\n\r\n\t\t\t$this->motionX *= $friction;\r\n\t\t\t$this->motionY *= $friction;\r\n\t\t\t$this->motionZ *= $friction;\r\n\r\n\t\t\t$this->updateMovement();\r\n\r\n\t\t\tif($this->onGround){\r\n\t\t\t\t$this->motionY *= -0.5;\r\n\t\t\t\t$this->motionX *= 0.7;\r\n\t\t\t\t$this->motionZ *= 0.7;\r\n\t\t\t}\r\n\r\n\t\t\t$this->fuse -= $tickDiff;\r\n\r\n\t\t\tif($this->fuse <= 0){\r\n\t\t\t\t$this->kill();\r\n\t\t\t\t$this->explode();\r\n\t\t\t}\r\n\r\n\t\t}\r\n\r\n\r\n\t\treturn $hasUpdate or $this->fuse >= 0 or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\r\n\t}\r\n\r\n\tpublic function explode(){\r\n\t\t$this->server->getPluginManager()->callEvent($ev = new ExplosionPrimeEvent($this, 4, $this->dropItem));\r\n\r\n\t\tif(!$ev->isCancelled()){\r\n\t\t\t$explosion = new Explosion($this, $ev->getForce(), $this, $ev->dropItem());\r\n\t\t\tif($ev->isBlockBreaking()){\r\n\t\t\t\t$explosion->explodeA();\r\n\t\t\t}\r\n\t\t\t$explosion->explodeB();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->type = PrimedTNT::NETWORK_ID;\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}"
  },
  {
    "path": "src/pocketmine/entity/Projectile.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____            _        _   __  __ _                  __  __ ____  \r\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \r\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\r\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \r\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author PocketMine Team\r\n * @link http://www.pocketmine.net/\r\n * \r\n *\r\n*/\r\n\r\nnamespace pocketmine\\entity;\r\n\r\n\r\nuse pocketmine\\event\\entity\\EntityCombustByEntityEvent;\r\nuse pocketmine\\event\\entity\\EntityDamageByChildEntityEvent;\r\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\r\nuse pocketmine\\event\\entity\\EntityDamageEvent;\r\n\r\nuse pocketmine\\event\\entity\\ProjectileHitEvent;\r\nuse pocketmine\\item\\Potion;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\level\\MovingObjectPosition;\r\nuse pocketmine\\math\\Vector3;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\nbt\\tag\\ShortTag;\r\n\r\nabstract class Projectile extends Entity{\r\n\r\n\tconst DATA_SHOOTER_ID = 17;\r\n\r\n\t/** @var Entity */\r\n\tpublic $shootingEntity = null;\r\n\tprotected $damage = 0;\r\n\r\n\tpublic $hadCollision = false;\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\r\n\t\t$this->shootingEntity = $shootingEntity;\r\n\t\tif($shootingEntity !== null){\r\n\t\t\t$this->setDataProperty(self::DATA_SHOOTER_ID, self::DATA_TYPE_LONG, $shootingEntity->getId());\r\n\t\t}\r\n\t\tparent::__construct($chunk, $nbt);\r\n\t}\r\n\r\n\tpublic function attack($damage, EntityDamageEvent $source){\r\n\t\tif($source->getCause() === EntityDamageEvent::CAUSE_VOID){\r\n\t\t\tparent::attack($damage, $source);\r\n\t\t}\r\n\t}\r\n\r\n\tprotected function initEntity(){\r\n\t\tparent::initEntity();\r\n\r\n\t\t$this->setMaxHealth(1);\r\n\t\t$this->setHealth(1);\r\n\t\tif(isset($this->namedtag->Age)){\r\n\t\t\t$this->age = $this->namedtag[\"Age\"];\r\n\t\t}\r\n\r\n\t}\r\n\r\n\tpublic function canCollideWith(Entity $entity){\r\n\t\treturn $entity instanceof Living and !$this->onGround;\r\n\t}\r\n\r\n\tpublic function saveNBT(){\r\n\t\tparent::saveNBT();\r\n\t\t$this->namedtag->Age = new ShortTag(\"Age\", $this->age);\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\r\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\r\n\t\tif($tickDiff <= 0 and !$this->justCreated){\r\n\t\t\treturn true;\r\n\t\t}\r\n\t\t$this->lastUpdate = $currentTick;\r\n\r\n\t\t$hasUpdate = $this->entityBaseTick($tickDiff);\r\n\r\n\t\tif($this->isAlive()){\r\n\r\n\t\t\t$movingObjectPosition = null;\r\n\r\n\t\t\tif(!$this->isCollided){\r\n\t\t\t\t$this->motionY -= $this->gravity;\r\n\t\t\t}\r\n\r\n\t\t\t$moveVector = new Vector3($this->x + $this->motionX, $this->y + $this->motionY, $this->z + $this->motionZ);\r\n\r\n\t\t\t$list = $this->getLevel()->getCollidingEntities($this->boundingBox->addCoord($this->motionX, $this->motionY, $this->motionZ)->expand(1, 1, 1), $this);\r\n\r\n\t\t\t$nearDistance = PHP_INT_MAX;\r\n\t\t\t$nearEntity = null;\r\n\r\n\t\t\tforeach($list as $entity){\r\n\t\t\t\tif(/*!$entity->canCollideWith($this) or */\r\n\t\t\t\t($entity === $this->shootingEntity and $this->ticksLived < 5)\r\n\t\t\t\t){\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$axisalignedbb = $entity->boundingBox->grow(0.3, 0.3, 0.3);\r\n\t\t\t\t$ob = $axisalignedbb->calculateIntercept($this, $moveVector);\r\n\r\n\t\t\t\tif($ob === null){\r\n\t\t\t\t\tcontinue;\r\n\t\t\t\t}\r\n\r\n\t\t\t\t$distance = $this->distanceSquared($ob->hitVector);\r\n\r\n\t\t\t\tif($distance < $nearDistance){\r\n\t\t\t\t\t$nearDistance = $distance;\r\n\t\t\t\t\t$nearEntity = $entity;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tif($nearEntity !== null){\r\n\t\t\t\t$movingObjectPosition = MovingObjectPosition::fromEntity($nearEntity);\r\n\t\t\t}\r\n\r\n\t\t\tif($movingObjectPosition !== null){\r\n\t\t\t\tif($movingObjectPosition->entityHit !== null){\r\n\r\n\t\t\t\t\t$this->server->getPluginManager()->callEvent(new ProjectileHitEvent($this));\r\n\r\n\t\t\t\t\t$motion = sqrt($this->motionX ** 2 + $this->motionY ** 2 + $this->motionZ ** 2);\r\n\t\t\t\t\t$damage = ceil($motion * $this->damage);\r\n\r\n\t\t\t\t\tif($this instanceof Arrow and $this->isCritical()){\r\n\t\t\t\t\t\t$damage += mt_rand(0, (int) ($damage / 2) + 1);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif($this->shootingEntity === null){\r\n\t\t\t\t\t\t$ev = new EntityDamageByEntityEvent($this, $movingObjectPosition->entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage);\r\n\t\t\t\t\t}else{\r\n\t\t\t\t\t\t$ev = new EntityDamageByChildEntityEvent($this->shootingEntity, $this, $movingObjectPosition->entityHit, EntityDamageEvent::CAUSE_PROJECTILE, $damage);\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\tif($movingObjectPosition->entityHit->attack($ev->getFinalDamage(), $ev) === true){\r\n\t\t\t\t\t\tif($this instanceof Arrow and $this->getPotionId() != 0){\r\n\t\t\t\t\t\t\tforeach(Potion::getEffectsById($this->getPotionId() - 1) as $effect){\r\n\t\t\t\t\t\t\t\t$movingObjectPosition->entityHit->addEffect($effect->setDuration($effect->getDuration() / 8));\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\t$ev->useArmors();\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$this->hadCollision = true;\r\n\r\n\t\t\t\t\tif($this->fireTicks > 0){\r\n\t\t\t\t\t\t$ev = new EntityCombustByEntityEvent($this, $movingObjectPosition->entityHit, 5);\r\n\t\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev);\r\n\t\t\t\t\t\tif(!$ev->isCancelled()){\r\n\t\t\t\t\t\t\t$movingObjectPosition->entityHit->setOnFire($ev->getDuration());\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t\t$this->kill();\r\n\t\t\t\t\treturn true;\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\r\n\r\n\t\t\tif($this->isCollided and !$this->hadCollision){\r\n\t\t\t\t$this->hadCollision = true;\r\n\r\n\t\t\t\t$this->motionX = 0;\r\n\t\t\t\t$this->motionY = 0;\r\n\t\t\t\t$this->motionZ = 0;\r\n\r\n\t\t\t\t$this->server->getPluginManager()->callEvent(new ProjectileHitEvent($this));\r\n\t\t\t}elseif(!$this->isCollided and $this->hadCollision){\r\n\t\t\t\t$this->hadCollision = false;\r\n\t\t\t}\r\n\r\n\t\t\tif(!$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001){\r\n\t\t\t\t$f = sqrt(($this->motionX ** 2) + ($this->motionZ ** 2));\r\n\t\t\t\t$this->yaw = (atan2($this->motionX, $this->motionZ) * 180 / M_PI);\r\n\t\t\t\t$this->pitch = (atan2($this->motionY, $f) * 180 / M_PI);\r\n\t\t\t\t$hasUpdate = true;\r\n\t\t\t}\r\n\r\n\t\t\t$this->updateMovement();\r\n\r\n\t\t}\r\n\r\n\t\treturn $hasUpdate;\r\n\t}\r\n\r\n}"
  },
  {
    "path": "src/pocketmine/entity/ProjectileSource.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface ProjectileSource{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Rabbit.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\item\\enchantment\\Enchantment;\r\nuse pocketmine\\event\\entity\\EntityDamageEvent;\r\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\r\nuse pocketmine\\item\\Item as ItemItem;\r\nuse pocketmine\\nbt\\tag\\ByteTag;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\Player;\r\n\r\nclass Rabbit extends Animal{\r\n\tconst NETWORK_ID = 18;\r\n\r\n\tconst DATA_RABBIT_TYPE = 18;\r\n\tconst DATA_JUMP_TYPE = 19;\r\n\r\n\tconst TYPE_BROWN = 0;\r\n\tconst TYPE_WHITE = 1;\r\n\tconst TYPE_BLACK = 2;\r\n\tconst TYPE_BLACK_WHITE = 3;\r\n\tconst TYPE_GOLD = 4;\r\n\tconst TYPE_SALT_PEPPER = 5;\r\n\tconst TYPE_KILLER_BUNNY = 99;\r\n\r\n\tpublic $height = 0.5;\r\n\tpublic $width = 0.5;\r\n\tpublic $length = 0.5;\r\n\r\n\tpublic $dropExp = [1, 3];\r\n\r\n\tpublic function initEntity(){\r\n\t\t$this->setMaxHealth(3);\r\n\t\tparent::initEntity();\r\n\t}\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\r\n\t\tif(!isset($nbt->RabbitType)){\r\n\t\t\t$nbt->RabbitType = new ByteTag(\"RabbitType\", $this->getRandomRabbitType());\r\n\t\t}\r\n\t\tparent::__construct($chunk, $nbt);\r\n\r\n\t\t$this->setDataProperty(self::DATA_RABBIT_TYPE, self::DATA_TYPE_BYTE, $this->getRabbitType());\r\n\t}\r\n\r\n\tpublic function getRandomRabbitType() : int{\r\n\t\t$arr = [0, 1, 2, 3, 4, 5, 99];\r\n\t\treturn $arr[mt_rand(0, count($arr) - 1)];\r\n\t}\r\n\r\n\tpublic function setRabbitType(int $type){\r\n\t\t$this->namedtag->RabbitType = new ByteTag(\"RabbitType\", $type);\r\n\t}\r\n\r\n\tpublic function getRabbitType() : int{\r\n\t\treturn (int) $this->namedtag[\"RabbitType\"];\r\n\t}\r\n\r\n\tpublic function getName(){\r\n\t\treturn \"Rabbit\";\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->type = Rabbit::NETWORK_ID;\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->yaw = $this->yaw;\r\n\t\t$pk->pitch = $this->pitch;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n\r\n\tpublic function getDrops(){\r\n\t\t$lootingL = 0;\r\n\t\t$cause = $this->lastDamageCause;\r\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\r\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\r\n\t\t}\r\n\t\t$drops = [ItemItem::get(ItemItem::RABBIT_HIDE, 0, mt_rand(0, 1))];\r\n\t\tif($this->getLastDamageCause() === EntityDamageEvent::CAUSE_FIRE){\r\n\t\t\t$drops[] = ItemItem::get(ItemItem::COOKED_RABBIT, 0, mt_rand(0, 1));\r\n\t\t}else{\r\n\t\t\t$drops[] = ItemItem::get(ItemItem::RAW_RABBIT, 0, mt_rand(0, 1));\r\n\t\t}\r\n\t\t//Rare drop\r\n\t\tif(mt_rand(1, 200) <= (5 + 2 * $lootingL)){\r\n\t\t\t$drops[] = ItemItem::get(ItemItem::RABBIT_FOOT, 0, 1);\r\n\t\t}\r\n\t\treturn $drops;\r\n\t}\r\n\r\n\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/entity/Rideable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface Rideable{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Sheep.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\block\\Wool;\r\nuse pocketmine\\nbt\\tag\\ByteTag;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Player;\r\nuse pocketmine\\item\\Item as ItemItem;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\n\r\nclass Sheep extends Animal implements Colorable{\r\n\tconst NETWORK_ID = 13;\r\n\r\n\tconst DATA_COLOR_INFO = 16;\r\n\r\n\tpublic $width = 0.625;\r\n\tpublic $length = 1.4375;\r\n\tpublic $height = 1.8;\r\n\t\r\n\tpublic function getName(){\r\n\t\treturn \"Sheep\";\r\n\t}\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\r\n\t\tif(!isset($nbt->Color)){\r\n\t\t\t$nbt->Color = new ByteTag(\"Color\", self::getRandomColor());\r\n\t\t}\r\n\t\tparent::__construct($chunk, $nbt);\r\n\r\n\t\t$this->setDataProperty(self::DATA_COLOR_INFO, self::DATA_TYPE_BYTE, $this->getColor());\r\n\t}\r\n\r\n\tpublic static function getRandomColor() : int{\r\n\t\t$rand = \"\";\r\n\t\t$rand .= str_repeat(Wool::WHITE . \" \", 20);\r\n\t\t$rand .= str_repeat(Wool::ORANGE . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::MAGENTA . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::LIGHT_BLUE . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::YELLOW . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::GRAY . \" \", 10);\r\n\t\t$rand .= str_repeat(Wool::LIGHT_GRAY . \" \", 10);\r\n\t\t$rand .= str_repeat(Wool::CYAN . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::PURPLE . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::BLUE . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::BROWN . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::GREEN . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::RED . \" \", 5);\r\n\t\t$rand .= str_repeat(Wool::BLACK . \" \", 10);\r\n\t\t$arr = explode(\" \", $rand);\r\n\t\treturn intval($arr[mt_rand(0, count($arr) - 1)]);\r\n\t}\r\n\r\n\tpublic function getColor() : int{\r\n\t\treturn (int) $this->namedtag[\"Color\"];\r\n\t}\r\n\r\n\tpublic function setColor(int $color){\r\n\t\t$this->namedtag->Color = new ByteTag(\"Color\", $color);\r\n\t}\r\n\t\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->type = Sheep::NETWORK_ID;\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->yaw = $this->yaw;\r\n\t\t$pk->pitch = $this->pitch;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n\t\r\n\tpublic function getDrops(){\r\n\t\t$drops = [\r\n\t\t\tItemItem::get(ItemItem::WOOL, $this->getColor(), 1)\r\n\t\t];\r\n\t\treturn $drops;\r\n\t}\r\n}"
  },
  {
    "path": "src/pocketmine/entity/Shulker.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Shulker extends Monster{\n\tconst NETWORK_ID = 54;\n\n\tpublic $width = 0.5;\n\tpublic $length = 0.9;\n\tpublic $height = 1.0;\n\n\tpublic $dropExp = [1, 4];\n\t\n\tpublic function getName(){\n\t\treturn \"Shulker\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Shulker::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t$drops = [];\n\t\tif ($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player) {\n\t\t\tif (mt_rand(0, 1) === 1) $drops[] = ItemItem::get(ItemItem::SHULKER_SHELL, 0, 1);\n\t\t}\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/ShulkerBullet.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass ShulkerBullet extends Projectile{\n\tconst NETWORK_ID = 76;\n\n\tpublic $width = 0.25;\n\tpublic $length = 0.25;\n\tpublic $height = 0.25;\n\n\tprotected $gravity = 0.03;\n\tprotected $drag = 0.01;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = parent::onUpdate($currentTick);\n\n\t\tif($this->age > 1200 or $this->isCollided){\n\t\t\t$this->kill();\n\t\t\t$hasUpdate = true;\n\t\t}\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = ShulkerBullet::NETWORK_ID;\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Silverfish.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass Silverfish extends Monster{\n\tconst NETWORK_ID = 39;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Silverfish\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Silverfish::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Skeleton.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\network\\protocol\\MobEquipmentPacket;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Skeleton extends Monster implements ProjectileSource{\n\tconst NETWORK_ID = 34;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Skeleton\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Skeleton::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t\t\n\t\t$pk = new MobEquipmentPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->item = new ItemItem(ItemItem::BOW);\n\t\t$pk->slot = 0;\n\t\t$pk->selectedSlot = 0;\n\n\t\t$player->dataPacket($pk);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Slime.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Slime extends Living{\n\tconst NETWORK_ID = 37;\n\n\tconst DATA_SLIME_SIZE = 16;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 5;\n\n\tpublic $dropExp = [1, 4];\n\t\n\tpublic function getName(){\n\t\treturn \"Slime\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Slime::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t$drops = array(ItemItem::get(ItemItem::SLIMEBALL, 0, 1));\n\t\tif ($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player) {\n\t\t\tif (\\mt_rand(0, 199) < 5) {\n\t\t\t\tswitch (\\mt_rand(0, 2)) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::IRON_INGOT, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::CARROT, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::POTATO, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/SnowGolem.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass SnowGolem extends Animal{\n\tconst NETWORK_ID = 21;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.8;\n\t\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(4);\n\t\tparent::initEntity();\n\t}\n\t\n\tpublic function getName() {\n\t\treturn \"Snow Golem\";\n\t}\n\t\n\tpublic function spawnTo(Player $player) {\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = self::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Snowball.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass Snowball extends Projectile{\n\tconst NETWORK_ID = 81;\n\n\tpublic $width = 0.25;\n\tpublic $length = 0.25;\n\tpublic $height = 0.25;\n\n\tprotected $gravity = 0.03;\n\tprotected $drag = 0.01;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = parent::onUpdate($currentTick);\n\n\t\tif($this->age > 1200 or $this->isCollided){\n\t\t\t$this->kill();\n\t\t\t$hasUpdate = true;\n\t\t}\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = Snowball::NETWORK_ID;\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Spider.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Spider extends Monster{\n\tconst NETWORK_ID = 35;\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.9;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Spider\";\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Spider::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t$drops = array(ItemItem::get(ItemItem::STRING, 0, 1));\n\t\tif ($this->lastDamageCause instanceof EntityDamageByEntityEvent and $this->lastDamageCause->getEntity() instanceof Player) {\n\t\t\tif (mt_rand(0, 199) < 5) {\n\t\t\t\tswitch (mt_rand(0, 2)) {\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::IRON_INGOT, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::CARROT, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::POTATO, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn $drops;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Squid.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\network\\protocol\\EntityEventPacket;\nuse pocketmine\\Player;\n\nclass Squid extends WaterAnimal implements Ageable{\n\tconst NETWORK_ID = 17;\n\n\tpublic $width = 0.95;\n\tpublic $length = 0.95;\n\tpublic $height = 0.95;\n\n\tpublic $dropExp = [1, 3];\n\n\t/** @var Vector3 */\n\tpublic $swimDirection = null;\n\tpublic $swimSpeed = 0.1;\n\n\tprivate $switchDirectionTicker = 0;\n\n\tpublic function initEntity(){\n\t\tparent::initEntity();\n\t\t$this->setMaxHealth(5);\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Squid\";\n\t}\n\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tparent::attack($damage, $source);\n\t\tif($source->isCancelled()){\n\t\t\treturn;\n\t\t}\n\n\t\tif($source instanceof EntityDamageByEntityEvent){\n\t\t\t$this->swimSpeed = mt_rand(150, 350) / 2000;\n\t\t\t$e = $source->getDamager();\n\t\t\t$this->swimDirection = (new Vector3($this->x - $e->x, $this->y - $e->y, $this->z - $e->z))->normalize();\n\n\t\t\t$pk = new EntityEventPacket();\n\t\t\t$pk->eid = $this->getId();\n\t\t\t$pk->event = EntityEventPacket::SQUID_INK_CLOUD;\n\t\t\t$this->server->broadcastPacket($this->hasSpawned, $pk);\n\t\t}\n\t}\n\n\tprivate function generateRandomDirection(){\n\t\treturn new Vector3(mt_rand(-1000, 1000) / 1000, mt_rand(-500, 500) / 1000, mt_rand(-1000, 1000) / 1000);\n\t}\n\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed !== false){\n\t\t\treturn false;\n\t\t}\n\n\t\tif(++$this->switchDirectionTicker === 100){\n\t\t\t$this->switchDirectionTicker = 0;\n\t\t\tif(mt_rand(0, 100) < 50){\n\t\t\t\t$this->swimDirection = null;\n\t\t\t}\n\t\t}\n\n\t\t$this->lastUpdate = $currentTick;\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = parent::onUpdate($currentTick);\n\n\t\tif($this->isAlive()){\n\n\t\t\tif($this->y > 62 and $this->swimDirection !== null){\n\t\t\t\t$this->swimDirection->y = -0.5;\n\t\t\t}\n\n\t\t\t$inWater = $this->isInsideOfWater();\n\t\t\tif(!$inWater){\n\t\t\t\t$this->motionY -= $this->gravity;\n\t\t\t\t$this->swimDirection = null;\n\t\t\t}elseif($this->swimDirection !== null){\n\t\t\t\tif($this->motionX ** 2 + $this->motionY ** 2 + $this->motionZ ** 2 <= $this->swimDirection->lengthSquared()){\n\t\t\t\t\t$this->motionX = $this->swimDirection->x * $this->swimSpeed;\n\t\t\t\t\t$this->motionY = $this->swimDirection->y * $this->swimSpeed;\n\t\t\t\t\t$this->motionZ = $this->swimDirection->z * $this->swimSpeed;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->swimDirection = $this->generateRandomDirection();\n\t\t\t\t$this->swimSpeed = mt_rand(50, 100) / 2000;\n\t\t\t}\n\n\t\t\t$expectedPos = new Vector3($this->x + $this->motionX, $this->y + $this->motionY, $this->z + $this->motionZ);\n\n\t\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\n\n\t\t\tif($expectedPos->distanceSquared($this) > 0){\n\t\t\t\t$this->swimDirection = $this->generateRandomDirection();\n\t\t\t\t$this->swimSpeed = mt_rand(50, 100) / 2000;\n\t\t\t}\n\n\t\t\t$friction = 1 - $this->drag;\n\n\t\t\t$this->motionX *= $friction;\n\t\t\t$this->motionY *= 1 - $this->drag;\n\t\t\t$this->motionZ *= $friction;\n\n\t\t\t$f = sqrt(($this->motionX ** 2) + ($this->motionZ ** 2));\n\t\t\t$this->yaw = (-atan2($this->motionX, $this->motionZ) * 180 / M_PI);\n\t\t\t$this->pitch = (-atan2($f, $this->motionY) * 180 / M_PI);\n\n\t\t\tif($this->onGround){\n\t\t\t\t$this->motionY *= -0.5;\n\t\t\t}\n\n\t\t}\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate or !$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\n\t}\n\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Squid::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\n\tpublic function getDrops(){\n\t\t$lootingL = 0;\n\t\t$cause = $this->lastDamageCause;\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\n\t\t}\n\t\treturn [\n\t\t\tItemItem::get(ItemItem::DYE, 0, mt_rand(1, 3 + $lootingL))\n\t\t];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Stray.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\network\\protocol\\MobEquipmentPacket;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass Stray extends Skeleton{\n\tconst NETWORK_ID = 46;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Stray\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Stray::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tEntity::spawnTo($player);\n\t\t\n\t\t$pk = new MobEquipmentPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->item = new ItemItem(ItemItem::BOW);\n\t\t$pk->slot = 0;\n\t\t$pk->selectedSlot = 0;\n\n\t\t$player->dataPacket($pk);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Tameable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\ninterface Tameable{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/ThrownExpBottle.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\n\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\level\\particle\\SpellParticle;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Player;\r\n\r\nclass ThrownExpBottle extends Projectile{\r\n\tconst NETWORK_ID = 68;\r\n\r\n\tpublic $width = 0.25;\r\n\tpublic $length = 0.25;\r\n\tpublic $height = 0.25;\r\n\r\n\tprotected $gravity = 0.1;\r\n\tprotected $drag = 0.15;\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\r\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$this->timings->startTiming();\r\n\r\n\t\t$hasUpdate = parent::onUpdate($currentTick);\r\n\r\n\t\t$this->age++;\r\n\r\n\t\tif($this->age > 1200 or $this->isCollided){\r\n\t\t\t$this->kill();\r\n\t\t\t$this->close();\r\n\t\t\t$this->getLevel()->addParticle(new SpellParticle($this, 46, 82, 153));\r\n\t\t\tif($this->getLevel()->getServer()->expEnabled){\r\n\t\t\t\t$this->getLevel()->spawnXPOrb($this->add(0, -0.2, 0), mt_rand(1, 4));\r\n\t\t\t\t$this->getLevel()->spawnXPOrb($this->add(-0.1, -0.2, 0), mt_rand(1, 4));\r\n\t\t\t\t$this->getLevel()->spawnXPOrb($this->add(0, -0.2, -0.1), mt_rand(1, 4));\r\n\t\t\t}\r\n\t\t\t$hasUpdate = true;\r\n\t\t}\r\n\r\n\t\t$this->timings->stopTiming();\r\n\r\n\t\treturn $hasUpdate;\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->type = ThrownExpBottle::NETWORK_ID;\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}"
  },
  {
    "path": "src/pocketmine/entity/ThrownPotion.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  _____   _____   __   _   _   _____  __    __  _____\r\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\r\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\r\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\r\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\r\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author iTX Technologies\r\n * @link https://itxtech.org\r\n *\r\n */\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\level\\particle\\SpellParticle;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\nbt\\tag\\ShortTag;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Player;\r\nuse pocketmine\\item\\Potion;\r\n\r\nclass ThrownPotion extends Projectile{\r\n\tconst NETWORK_ID = 86;\r\n\r\n\tconst DATA_POTION_ID = 16;\r\n\r\n\tpublic $width = 0.25;\r\n\tpublic $length = 0.25;\r\n\tpublic $height = 0.25;\r\n\r\n\tprotected $gravity = 0.1;\r\n\tprotected $drag = 0.05;\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt, Entity $shootingEntity = null){\r\n\t\tif(!isset($nbt->PotionId)){\r\n\t\t\t$nbt->PotionId = new ShortTag(\"PotionId\", Potion::AWKWARD);\r\n\t\t}\r\n\r\n\t\tparent::__construct($chunk, $nbt, $shootingEntity);\r\n\r\n\t\tunset($this->dataProperties[self::DATA_SHOOTER_ID]);\r\n\t\t$this->setDataProperty(self::DATA_POTION_ID, self::DATA_TYPE_SHORT, $this->getPotionId());\r\n\t}\r\n\r\n\tpublic function getPotionId() : int{\r\n\t\treturn (int) $this->namedtag[\"PotionId\"];\r\n\t}\r\n\r\n\tpublic function kill(){\r\n\t\tif($this->isAlive()) {\r\n\t\t\t$color = Potion::getColor($this->getPotionId());\r\n\t\t\t$this->getLevel()->addParticle(new SpellParticle($this, $color[0], $color[1], $color[2]));\r\n\t\t\t$players = $this->getViewers();\r\n\t\t\tforeach($players as $p) {\r\n\t\t\t\tif($p->distance($this) <= 6) {\r\n\t\t\t\t\tforeach(Potion::getEffectsById($this->getPotionId()) as $effect) {\r\n\t\t\t\t\t\t$p->addEffect($effect);\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\tparent::kill();\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function onUpdate($currentTick){\r\n\t\tif($this->closed){\r\n\t\t\treturn false;\r\n\t\t}\r\n\r\n\t\t$this->timings->startTiming();\r\n\r\n\t\t$hasUpdate = parent::onUpdate($currentTick);\r\n\r\n\t\t$this->age++;\r\n\r\n\t\tif($this->age > 1200 or $this->isCollided){\r\n\t\t\t$this->kill();\r\n\t\t\t$this->close();\r\n\t\t\t$hasUpdate = true;\r\n\t\t}\r\n\r\n\t\t$this->timings->stopTiming();\r\n\r\n\t\treturn $hasUpdate;\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->type = ThrownPotion::NETWORK_ID;\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n}"
  },
  {
    "path": "src/pocketmine/entity/Vehicle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nabstract class Vehicle extends Entity implements Rideable{\n\n}"
  },
  {
    "path": "src/pocketmine/entity/Villager.php",
    "content": "<?php\r\n\r\n/*\r\n *\r\n *  ____            _        _   __  __ _                  __  __ ____  \r\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \r\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\r\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \r\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \r\n *\r\n * This program is free software: you can redistribute it and/or modify\r\n * it under the terms of the GNU Lesser General Public License as published by\r\n * the Free Software Foundation, either version 3 of the License, or\r\n * (at your option) any later version.\r\n *\r\n * @author PocketMine Team\r\n * @link http://www.pocketmine.net/\r\n * \r\n *\r\n*/\r\n\r\nnamespace pocketmine\\entity;\r\n\r\nuse pocketmine\\nbt\\tag\\ByteTag;\r\nuse pocketmine\\nbt\\tag\\IntTag;\r\nuse pocketmine\\level\\format\\Chunk;\r\nuse pocketmine\\nbt\\tag\\CompoundTag;\r\nuse pocketmine\\network\\protocol\\AddEntityPacket;\r\nuse pocketmine\\Player;\r\n\r\nclass Villager extends Creature implements NPC, Ageable{\r\n\tconst PROFESSION_FARMER = 0;\r\n\tconst PROFESSION_LIBRARIAN = 1;\r\n\tconst PROFESSION_PRIEST = 2;\r\n\tconst PROFESSION_BLACKSMITH = 3;\r\n\tconst PROFESSION_BUTCHER = 4;\r\n\t//const PROFESSION_GENERIC = 5;\r\n\r\n\tconst NETWORK_ID = 15;\r\n\r\n\tconst DATA_PROFESSION_ID = 16;\r\n\r\n\tpublic $width = 0.6;\r\n\tpublic $length = 0.6;\r\n\tpublic $height = 1.8;\r\n\r\n\tpublic function getName(){\r\n\t\treturn \"Villager\";\r\n\t}\r\n\r\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\r\n\t\tif(!isset($nbt->Profession)){\r\n\t\t\t$nbt->Profession = new ByteTag(\"Profession\", mt_rand(0, 4));\r\n\t\t}\r\n\r\n\t\tparent::__construct($chunk, $nbt);\r\n\r\n\t\t$this->setDataProperty(self::DATA_PROFESSION_ID, self::DATA_TYPE_BYTE, $this->getProfession());\r\n\t}\r\n\r\n\tprotected function initEntity(){\r\n\t\tparent::initEntity();\r\n\t\tif(!isset($this->namedtag->Profession)){\r\n\t\t\t$this->setProfession(self::PROFESSION_FARMER);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic function spawnTo(Player $player){\r\n\t\t$pk = new AddEntityPacket();\r\n\t\t$pk->eid = $this->getId();\r\n\t\t$pk->type = Villager::NETWORK_ID;\r\n\t\t$pk->x = $this->x;\r\n\t\t$pk->y = $this->y;\r\n\t\t$pk->z = $this->z;\r\n\t\t$pk->speedX = $this->motionX;\r\n\t\t$pk->speedY = $this->motionY;\r\n\t\t$pk->speedZ = $this->motionZ;\r\n\t\t$pk->yaw = $this->yaw;\r\n\t\t$pk->pitch = $this->pitch;\r\n\t\t$pk->metadata = $this->dataProperties;\r\n\t\t$player->dataPacket($pk);\r\n\r\n\t\tparent::spawnTo($player);\r\n\t}\r\n\r\n\t/**\r\n\t * Sets the villager profession\r\n\t *\r\n\t * @param int $profession\r\n\t */\r\n\tpublic function setProfession(int $profession){\r\n\t\t$this->namedtag->Profession = new ByteTag(\"Profession\", $profession);\r\n\t}\r\n\r\n\tpublic function getProfession() : int{\r\n\t\t$pro = (int) $this->namedtag[\"Profession\"];\r\n\t\treturn min(4, max(0, $pro));\r\n\t}\r\n\r\n\tpublic function isBaby(){\r\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BABY);\r\n\t}\r\n}\r\n"
  },
  {
    "path": "src/pocketmine/entity/WaterAnimal.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\nabstract class WaterAnimal extends Creature implements Ageable{\n\n\tpublic function isBaby(){\n\t\treturn $this->getDataFlag(self::DATA_FLAGS, self::DATA_FLAG_BABY);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Witch.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\Player;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\n\nclass Witch extends Monster{\n\tconst NETWORK_ID = 45;\n\t\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Witch\";\n\t}\n\t\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(26);\n\t\tparent::initEntity();\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Witch::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\t\tparent::spawnTo($player);\n\t}\n\t\n\tpublic function getDrops(){\n\t\t//TODO\n\t\treturn [];\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/WitherSkeleton.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\network\\protocol\\MobEquipmentPacket;\nuse pocketmine\\item\\Item as ItemItem;\n\nclass WitherSkeleton extends Monster implements ProjectileSource{\n\tconst NETWORK_ID = 48;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic function getName(){\n\t\treturn \"Wither Skeleton\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = WitherSkeleton::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t\t\n\t\t$pk = new MobEquipmentPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->item = new ItemItem(ItemItem::STONE_SWORD);\n\t\t$pk->slot = 0;\n\t\t$pk->selectedSlot = 0;\n\n\t\t$player->dataPacket($pk);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/Wolf.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass Wolf extends Animal{\n\tconst NETWORK_ID = 14;\n\n\tpublic $width = 0.3;\n\tpublic $length = 0.9;\n\tpublic $height = 1.8;\n\n\tpublic $dropExp = [1, 3];\n\t\n\tpublic function getName(){\n\t\treturn \"Wolf\";\n\t}\n\t\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Wolf::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/entity/XPOrb.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\event\\player\\PlayerPickupExpOrbEvent;\nuse pocketmine\\level\\sound\\ExpPickupSound;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\n\nclass XPOrb extends Entity{\n\tconst NETWORK_ID = 69;\n\n\tpublic $width = 0.25;\n\tpublic $length = 0.25;\n\tpublic $height = 0.25;\n\n\tprotected $gravity = 0.04;\n\tprotected $drag = 0;\n\t\n\tprotected $experience = 0;\n\t\n\tprotected $range = 6;\n\n\tpublic function initEntity(){\n\t\tparent::initEntity();\n\t\tif(isset($this->namedtag->Experience)){\n\t\t\t$this->experience = $this->namedtag[\"Experience\"];\n\t\t}else $this->close();\n\t}\n\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\t$tickDiff = $currentTick - $this->lastUpdate;\n\t\t\n\t\t$this->lastUpdate = $currentTick;\n\t\t\n\t\t$this->timings->startTiming();\n\t\t\n\t\t$hasUpdate = $this->entityBaseTick($tickDiff);\n\n\t\t$this->age++;\n\n\t\tif($this->age > 1200){\n\t\t\t$this->kill();\n\t\t\t$this->close();\n\t\t\t$hasUpdate = true;\n\t\t}\n\t\t\n\t\t$minDistance = PHP_INT_MAX;\n\t\t$target = null;\n\t\tforeach($this->getViewers() as $p){\n\t\t\tif(!$p->isSpectator() and $p->isAlive()){\n\t\t\t\tif(($dist = $p->distance($this)) < $minDistance and $dist < $this->range){\n\t\t\t\t\t$target = $p;\n\t\t\t\t\t$minDistance = $dist;\n\t\t\t\t}\n\t\t\t} \n\t\t}\n\t\t\n\t\tif($target !== null){\n\t\t\t$moveSpeed = 0.7;\n\t\t\t$motX = ($target->getX() - $this->x) / 8;\n\t\t\t$motY = ($target->getY() + $target->getEyeHeight() - $this->y) / 8;\n\t\t\t$motZ = ($target->getZ() - $this->z) / 8;\n\t\t\t$motSqrt = sqrt($motX * $motX + $motY * $motY + $motZ * $motZ);\n\t\t\t$motC = 1 - $motSqrt;\n\t\t\n\t\t\tif($motC > 0){\n\t\t\t\t$motC *= $motC;\n\t\t\t\t$this->motionX = $motX / $motSqrt * $motC * $moveSpeed;\n\t\t\t\t$this->motionY = $motY / $motSqrt * $motC * $moveSpeed;\n\t\t\t\t$this->motionZ = $motZ / $motSqrt * $motC * $moveSpeed;\n\t\t\t}\n\n\t\t\t$this->motionY -= $this->gravity;\n\n\t\t\tif($this->checkObstruction($this->x, $this->y, $this->z)){\n\t\t\t\t$hasUpdate = true;\n\t\t\t}\n\n\t\t\tif($this->isInsideOfSolid()){\n\t\t\t\t$this->setPosition($target);\n\t\t\t}\n\n\t\t\tif($minDistance <= 1.3){\n\t\t\t\tif($this->getLevel()->getServer()->expEnabled and $target->canPickupXp()){\n\t\t\t\t\t$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new PlayerPickupExpOrbEvent($target, $this->getExperience()));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->kill();\n\t\t\t\t\t\t$this->close();\n\t\t\t\t\t\tif($this->getExperience() > 0){\n\t\t\t\t\t\t\t$this->level->addSound(new ExpPickupSound($target, mt_rand(0, 1000)));\n\t\t\t\t\t\t\t$target->addXp($this->getExperience());\n\t\t\t\t\t\t\t$target->resetXpCooldown();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\n\t\t\n\t\t$this->updateMovement();\n\t\t\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate or !$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\n\t}\n\n\tpublic function canCollideWith(Entity $entity){\n\t\treturn false;\n\t}\n\t\n\tpublic function setExperience($exp){\n\t\t$this->experience = $exp;\n\t}\n\t\n\tpublic function getExperience(){\n\t\treturn $this->experience;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$this->setDataFlag(self::DATA_FLAGS, self::DATA_FLAG_NO_AI, true);\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = XPOrb::NETWORK_ID;\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/Zombie.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\entity;\n\n\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\item\\Item as ItemItem;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\n\nclass Zombie extends Monster{\n\tconst NETWORK_ID = 32;\n\n\tpublic $width = 0.6;\n\tpublic $length = 0.6;\n\tpublic $height = 1.8;\n\n\tpublic $dropExp = [5, 5];\n\t\n\tpublic $drag = 0.2;\n\tpublic $gravity = 0.3;\n\t\n\tprivate $moveDirection = null; //移动方向\n\tprivate $moveSpeed = 0.2; //移动速度\n\tprivate $hated = false; //仇恨的玩家\n\tprivate $tempTicker = 0;\n\tprivate $tempTicking = false; //走出困境计时器\n\tprivate $moveTicker = 0; //运动计时器\n\tprivate $hate_r = 16; //仇恨半径\n\tprivate $attack_r = 1.5; //攻击半径\n\tprivate $fire_r = 1.3; //点燃半径\n\tprivate $hateTicker = 0; //仇恨计时器\n\n\tpublic function getName(){\n\t\treturn \"Zombie\";\n\t}\n\t\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(20);\n\t\tparent::initEntity();\n\t}\n\t\n\tpublic function attack($damage, EntityDamageEvent $source){\n\t\tparent::attack($damage, $source);\n\t\t\n\t\tif($source instanceof EntityDamageByEntityEvent){\n\t\t\t$e = $source->getDamager();\n\t\t\t\n\t\t\t$deltaX = $this->x - $e->x;\n\t\t\t$deltaZ = $this->z - $e->z;\n\t\t\t$this->knockBack($e, $damage, $deltaX / 100, $deltaZ / 100, $source->getKnockBack());\n\t\t}\n\t}\n\n\t\n\tprivate function generateRandomDirection(){\n\t\treturn new Vector3(mt_rand(-1000, 1000) / 1000, 0, mt_rand(-1000, 1000) / 1000);\n\t}\n\t\n\t/*\n\t * 返回一个一位小数\n\t*/\n\tprivate function toFloat($num){\n\t\twhile(((abs($num) > 1) or (abs($num) < 0.1)) and (abs($num) > 0)) {\n\t\t\tif(abs($num) > 1) $num /= 10;\n\t\t\tif(abs($num) < 0.1) $num *= 10;\n\t\t}\n\t\treturn $num;\n\t}\n\t\n\tprivate function generateDirection(Vector3 $pos){\n\t\treturn new Vector3($this->toFloat($pos->x - $this->x), 0, $this->toFloat($pos->z - $this->z));\n\t}\n\t\n\tprivate function getNearestPlayer(){\n\t\t$dis = PHP_INT_MAX;\n\t\t$player = false;\n\t\tforeach($this->getViewers() as $p){\n\t\t\tif($p->distance($this) < $dis){\n\t\t\t\t$dis = $p->distance($this);\n\t\t\t\t$player = $p;\n\t\t\t}\n\t\t}\n\t\treturn (($dis <= $this->hate_r) ? $p : false);\n\t}\n\t\n\tprivate function getVelY(){\n\t\t$expectedPos = (new Vector3($this->x + $this->moveDirection->x * $this->moveSpeed, $this->y + $this->motionY, $this->z + $this->moveDirection->z * $this->moveSpeed))->round();\n\t\t$block0 = $this->getLevel()->getBlock($expectedPos);\n\t\t$block1 = $this->getLevel()->getBlock($expectedPos->add(0, 1, 0));\n\t\tif($block1->getId() != 0) return 1.2;\n\t\treturn 0;\n\t}\n\t\n\tpublic function onUpdate($currentTick){\n\t\tif($this->closed !== false){\n\t\t\treturn false;\n\t\t}\n\t\t\n\t\treturn parent::onUpdate($currentTick); //Abort AI?\n\t\t\n\t\t$this->lastUpdate = $currentTick;\n\n\t\t$this->timings->startTiming();\n\n\t\t$hasUpdate = parent::onUpdate($currentTick);\n\n\t\tif($this->isAlive()){\n\t\t\t/* Don't use time directly\n\t\t\t * Instead, get remainder of current time divided by 24,000\n\t\t\t * This tells us the time of day, which is what we really need\n\t\t\t */\n\t\t\t$timeOfDay = abs($this->getLevel()->getTime() % 24000);\n\t\t\tif(0 < $timeOfDay and $timeOfDay < 13000) $this->setOnFire(2); //僵尸起火\n\t\t\t\n\t\t\t$p = $this->getNearestPlayer();//找到最近的可以被仇恨的玩家\n\t\t\tif(!$p) {\n\t\t\t\t$this->hated = false;\n\t\t\t\tif(++$this->moveTicker >= 100) {\n\t\t\t\t\t$this->moveDirection = $this->generateRandomDirection();\n\t\t\t\t\t$this->moveTicker = 0;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->hated = $p;\n\t\t\t\tif($p->distance($this) <= $this->fire_r) $p->setOnFire(2); //点燃玩家\n\t\t\t\tif(!$this->tempTicking){\n\t\t\t\t\tif(++$this->hateTicker >= 10 or $this->moveDirection == null) { //每0.5秒获取僵尸前进的新方向\n\t\t\t\t\t\t$this->moveDirection = $this->generateDirection($p);\n\t\t\t\t\t\t$this->hateTicker = 0;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\t\n\t\t\tif($this->tempTicking) { //帮助僵尸寻找新的方向走出困境\n\t\t\t\tif(++$this->tempTicker >= 20) {\n\t\t\t\t\t$this->tempTicking = false;\n\t\t\t\t\t$this->tempTicker = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tif($this->hated instanceof Player){ //攻击玩家\n\t\t\t\tif($this->hated->distance($this) < $this->attack_r) $this->hated->attack(2, new EntityDamageByEntityEvent($this, $this->hated, EntityDamageEvent::CAUSE_ENTITY_ATTACK, 2));\n\t\t\t}\n\t\t\t\n\t\t\tif($this->moveDirection != null){\n\t\t\t\tif($this->motionX ** 2 + $this->motionZ ** 2 <= $this->moveDirection->lengthSquared()){\n\t\t\t\t\t$motionY = $this->getVelY(); //僵尸运动计算\n\t\t\t\t\tif($motionY >= 0){\n\t\t\t\t\t\t$this->motionX = $this->moveDirection->x * $this->moveSpeed;\n\t\t\t\t\t\t$this->motionZ = $this->moveDirection->z * $this->moveSpeed;\n\t\t\t\t\t\t$this->motionY = $motionY;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->moveDirection = $this->generateRandomDirection(); //生成随机运动方向\n\t\t\t\t\t\t$this->moveTicker = 0;\n\t\t\t\t\t\t$this->tempTicking = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->moveDirection = $this->generateRandomDirection();\n\t\t\t\t$this->moveTicker = 0;\n\t\t\t}\n\t\t\t\n\t\t\t//var_dump($this->moveDirection,$this->motionX,$this->motionZ);\n\t\t\t\n\t\t\t$expectedPos = new Vector3($this->x + $this->motionX, $this->y + $this->motionY, $this->z + $this->motionZ);\n\t\t\t\n\t\t\tif($this->motionY == 0) $this->motionY -= $this->gravity; //重力计算\n\n\t\t\t$this->move($this->motionX, $this->motionY, $this->motionZ);\n\n\t\t\tif($expectedPos->distanceSquared($this) > 0){\n\t\t\t\t$this->moveDirection = $this->generateRandomDirection();\n\t\t\t}\n\t\t\t\n\t\t\t$friction = 1 - $this->drag;\n\n\t\t\t$this->motionX *= $friction;\n\t\t\t//$this->motionY *= 1 - $this->drag;\n\t\t\t$this->motionZ *= $friction;\n\n\t\t\t$f = sqrt(($this->motionX ** 2) + ($this->motionZ ** 2));\n\t\t\t$this->yaw = (-atan2($this->motionX, $this->motionZ) * 180 / M_PI); //视角计算\n\t\t\t//$this->pitch = (-atan2($f, $this->motionY) * 180 / M_PI);\n\t\t\t\n\t\t\t$this->updateMovement();\n\t\t}\n\t\t\n\t\t$this->timings->stopTiming();\n\n\t\treturn $hasUpdate or !$this->onGround or abs($this->motionX) > 0.00001 or abs($this->motionY) > 0.00001 or abs($this->motionZ) > 0.00001;\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->eid = $this->getId();\n\t\t$pk->type = Zombie::NETWORK_ID;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->yaw = $this->yaw;\n\t\t$pk->pitch = $this->pitch;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n\n\tpublic function getDrops(){\n\t\t$lootingL = 0;\n\t\t$cause = $this->lastDamageCause;\n\t\t$drops = [];\n\t\tif($cause instanceof EntityDamageByEntityEvent and $cause->getDamager() instanceof Player){\n\t\t\t$lootingL = $cause->getDamager()->getItemInHand()->getEnchantmentLevel(Enchantment::TYPE_WEAPON_LOOTING);\n\t\t\tif(mt_rand(0, 199) < (5 + 2 * $lootingL)){\n\t\t\t\tswitch(mt_rand(0, 3)){\n\t\t\t\t\tcase 0:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::IRON_INGOT, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 1:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::CARROT, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase 2:\n\t\t\t\t\t\t$drops[] = ItemItem::get(ItemItem::POTATO, 0, 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$count = mt_rand(0, 2 + $lootingL);\n\t\t\tif($count > 0){\n\t\t\t\t$drops[] = ItemItem::get(ItemItem::ROTTEN_FLESH, 0, $count);\n\t\t\t}\n\t\t}\n\n\t\treturn $drops;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/entity/ZombieVillager.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\entity;\n\nuse pocketmine\\Player;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\n\nclass ZombieVillager extends Zombie{\n\tconst NETWORK_ID = 44;\n\n\tpublic $width = 1.031;\n\tpublic $length = 0.891;\n\tpublic $height = 2.125;\n\n\tpublic function initEntity(){\n\t\t$this->setMaxHealth(20);\n\t\tparent::initEntity();\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Zombie Villager\";\n\t}\n\n\tpublic function spawnTo(Player $player){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = ZombieVillager::NETWORK_ID;\n\t\t$pk->eid = $this->getId();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->speedX = $this->motionX;\n\t\t$pk->speedY = $this->motionY;\n\t\t$pk->speedZ = $this->motionZ;\n\t\t$pk->metadata = $this->dataProperties;\n\t\t$player->dataPacket($pk);\n\n\t\tparent::spawnTo($player);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/Cancellable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\event;\n\n\n/**\n * Events that can be cancelled must use the interface Cancellable\n */\ninterface Cancellable{\n\tpublic function isCancelled();\n\n\tpublic function setCancelled($forceCancel = false);\n}"
  },
  {
    "path": "src/pocketmine/event/Event.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Event related classes\n */\nnamespace pocketmine\\event;\n\nabstract class Event{\n\n\t/**\n\t * Any callable event must declare the static variable\n\t *\n\t * public static $handlerList = null;\n\t * public static $eventPool = [];\n\t * public static $nextEvent = 0;\n\t *\n\t * Not doing so will deny the proper event initialization\n\t */\n\n\tprotected $eventName = null;\n\tprivate $isCancelled = false;\n\n\t/**\n\t * @return string\n\t */\n\tfinal public function getEventName(){\n\t\treturn $this->eventName === null ? get_class($this) : $this->eventName;\n\t}\n\n\t/**\n\t * @return bool\n\t *\n\t * @throws \\BadMethodCallException\n\t */\n\tpublic function isCancelled(){\n\t\tif(!($this instanceof Cancellable)){\n\t\t\tthrow new \\BadMethodCallException(\"Event is not Cancellable\");\n\t\t}\n\n\t\t/** @var Event $this */\n\t\treturn $this->isCancelled === true;\n\t}\n\n\t/**\n\t * @param bool $value\n\t *\n\t * @return bool\n\t *\n\t * @throws \\BadMethodCallException\n\t */\n\tpublic function setCancelled($value = true){\n\t\tif(!($this instanceof Cancellable)){\n\t\t\tthrow new \\BadMethodCallException(\"Event is not Cancellable\");\n\t\t}\n\n\t\t/** @var Event $this */\n\t\t$this->isCancelled = (bool) $value;\n\t\treturn (bool) $value;\n\t}\n\n\t/**\n\t * @return HandlerList\n\t */\n\tpublic function getHandlers(){\n\t\tif(static::$handlerList === null){\n\t\t\tstatic::$handlerList = new HandlerList();\n\t\t}\n\n\t\treturn static::$handlerList;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/EventPriority.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event;\n\n\n/**\n * List of event priorities\n *\n * Events will be called in this order:\n * LOWEST -> LOW -> NORMAL -> HIGH -> HIGHEST -> MONITOR\n *\n * MONITOR events should not change the event outcome or contents\n */\nabstract class EventPriority{\n\t/**\n\t * Event call is of very low importance and should be ran first, to allow\n\t * other plugins to further customise the outcome\n\t */\n\tconst LOWEST = 5;\n\t/**\n\t * Event call is of low importance\n\t */\n\tconst LOW = 4;\n\t/**\n\t * Event call is neither important or unimportant, and may be ran normally\n\t */\n\tconst NORMAL = 3;\n\t/**\n\t * Event call is of high importance\n\t */\n\tconst HIGH = 2;\n\t/**\n\t * Event call is critical and must have the final say in what happens\n\t * to the event\n\t */\n\tconst HIGHEST = 1;\n\t/**\n\t * Event is listened to purely for monitoring the outcome of an event.\n\t *\n\t * No modifications to the event should be made under this priority\n\t */\n\tconst MONITOR = 0;\n\n}"
  },
  {
    "path": "src/pocketmine/event/HandlerList.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event;\n\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\plugin\\RegisteredListener;\n\nclass HandlerList{\n\n\t/**\n\t * @var RegisteredListener[]\n\t */\n\tprivate $handlers = null;\n\n\t/**\n\t * @var RegisteredListener[][]\n\t */\n\tprivate $handlerSlots = [];\n\n\t/**\n\t * @var HandlerList[]\n\t */\n\tprivate static $allLists = [];\n\n\tpublic static function bakeAll(){\n\t\tforeach(self::$allLists as $h){\n\t\t\t$h->bake();\n\t\t}\n\t}\n\n\t/**\n\t * Unregisters all the listeners\n\t * If a Plugin or Listener is passed, all the listeners with that object will be removed\n\t *\n\t * @param Plugin|Listener|null $object\n\t */\n\tpublic static function unregisterAll($object = null){\n\t\tif($object instanceof Listener or $object instanceof Plugin){\n\t\t\tforeach(self::$allLists as $h){\n\t\t\t\t$h->unregister($object);\n\t\t\t}\n\t\t}else{\n\t\t\tforeach(self::$allLists as $h){\n\t\t\t\tforeach($h->handlerSlots as $key => $list){\n\t\t\t\t\t$h->handlerSlots[$key] = [];\n\t\t\t\t}\n\t\t\t\t$h->handlers = null;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function __construct(){\n\t\t$this->handlerSlots = [\n\t\t\tEventPriority::LOWEST => [],\n\t\t\tEventPriority::LOW => [],\n\t\t\tEventPriority::NORMAL => [],\n\t\t\tEventPriority::HIGH => [],\n\t\t\tEventPriority::HIGHEST => [],\n\t\t\tEventPriority::MONITOR => []\n\t\t];\n\t\tself::$allLists[] = $this;\n\t}\n\n\t/**\n\t * @param RegisteredListener $listener\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function register(RegisteredListener $listener){\n\t\tif($listener->getPriority() < EventPriority::MONITOR or $listener->getPriority() > EventPriority::LOWEST){\n\t\t\treturn;\n\t\t}\n\t\tif(isset($this->handlerSlots[$listener->getPriority()][spl_object_hash($listener)])){\n\t\t\tthrow new \\InvalidStateException(\"This listener is already registered to priority \" . $listener->getPriority());\n\t\t}\n\t\t$this->handlers = null;\n\t\t$this->handlerSlots[$listener->getPriority()][spl_object_hash($listener)] = $listener;\n\t}\n\n\t/**\n\t * @param RegisteredListener[] $listeners\n\t */\n\tpublic function registerAll(array $listeners){\n\t\tforeach($listeners as $listener){\n\t\t\t$this->register($listener);\n\t\t}\n\t}\n\n\t/**\n\t * @param RegisteredListener|Listener|Plugin $object\n\t */\n\tpublic function unregister($object){\n\t\tif($object instanceof Plugin or $object instanceof Listener){\n\t\t\t$changed = false;\n\t\t\tforeach($this->handlerSlots as $priority => $list){\n\t\t\t\tforeach($list as $hash => $listener){\n\t\t\t\t\tif(($object instanceof Plugin and $listener->getPlugin() === $object)\n\t\t\t\t\t\tor ($object instanceof Listener and $listener->getListener() === $object)\n\t\t\t\t\t){\n\t\t\t\t\t\tunset($this->handlerSlots[$priority][$hash]);\n\t\t\t\t\t\t$changed = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($changed === true){\n\t\t\t\t$this->handlers = null;\n\t\t\t}\n\t\t}elseif($object instanceof RegisteredListener){\n\t\t\tif(isset($this->handlerSlots[$object->getPriority()][spl_object_hash($object)])){\n\t\t\t\tunset($this->handlerSlots[$object->getPriority()][spl_object_hash($object)]);\n\t\t\t\t$this->handlers = null;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function bake(){\n\t\tif($this->handlers !== null){\n\t\t\treturn;\n\t\t}\n\t\t$entries = [];\n\t\tforeach($this->handlerSlots as $list){\n\t\t\tforeach($list as $hash => $listener){\n\t\t\t\t$entries[$hash] = $listener;\n\t\t\t}\n\t\t}\n\t\t$this->handlers = $entries;\n\t}\n\n\t/**\n\t * @param null|Plugin $plugin\n\t *\n\t * @return RegisteredListener[]\n\t */\n\tpublic function getRegisteredListeners($plugin = null){\n\t\tif($plugin !== null){\n\t\t\t$listeners = [];\n\t\t\tforeach($this->getRegisteredListeners(null) as $hash => $listener){\n\t\t\t\tif($listener->getPlugin() === $plugin){\n\t\t\t\t\t$listeners[$hash] = $plugin;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $listeners;\n\t\t}else{\n\t\t\twhile(($handlers = $this->handlers) === null){\n\t\t\t\t$this->bake();\n\t\t\t}\n\n\t\t\treturn $handlers;\n\t\t}\n\t}\n\n\t/**\n\t * @return HandlerList[]\n\t */\n\tpublic static function getHandlerLists(){\n\t\treturn self::$allLists;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/event/LevelTimings.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event;\n\nuse pocketmine\\level\\Level;\n\nclass LevelTimings{\n\n\t/** @var TimingsHandler */\n\tpublic $mobSpawn;\n\t/** @var TimingsHandler */\n\tpublic $doChunkUnload;\n\t/** @var TimingsHandler */\n\tpublic $doPortalForcer;\n\t/** @var TimingsHandler */\n\tpublic $doTickPending;\n\t/** @var TimingsHandler */\n\tpublic $doTickTiles;\n\t/** @var TimingsHandler */\n\tpublic $doVillages;\n\t/** @var TimingsHandler */\n\tpublic $doChunkMap;\n\t/** @var TimingsHandler */\n\tpublic $doChunkGC;\n\t/** @var TimingsHandler */\n\tpublic $doSounds;\n\t/** @var TimingsHandler */\n\tpublic $entityTick;\n\t/** @var TimingsHandler */\n\tpublic $tileEntityTick;\n\t/** @var TimingsHandler */\n\tpublic $tileEntityPending;\n\t/** @var TimingsHandler */\n\tpublic $tracker;\n\t/** @var TimingsHandler */\n\tpublic $doTick;\n\t/** @var TimingsHandler */\n\tpublic $tickEntities;\n\n\t/** @var TimingsHandler */\n\tpublic $syncChunkSendTimer;\n\t/** @var TimingsHandler */\n\tpublic $syncChunkSendPrepareTimer;\n\n\t/** @var TimingsHandler */\n\tpublic $syncChunkLoadTimer;\n\t/** @var TimingsHandler */\n\tpublic $syncChunkLoadDataTimer;\n\t/** @var TimingsHandler */\n\tpublic $syncChunkLoadStructuresTimer;\n\t/** @var TimingsHandler */\n\tpublic $syncChunkLoadEntitiesTimer;\n\t/** @var TimingsHandler */\n\tpublic $syncChunkLoadTileEntitiesTimer;\n\t/** @var TimingsHandler */\n\tpublic $syncChunkLoadTileTicksTimer;\n\t/** @var TimingsHandler */\n\tpublic $syncChunkLoadPostTimer;\n\n\tpublic function __construct(Level $level){\n\t\t$name = $level->getFolderName() . \" - \";\n\n\t\t$this->mobSpawn = new TimingsHandler(\"** \" . $name . \"mobSpawn\");\n\t\t$this->doChunkUnload = new TimingsHandler(\"** \" . $name . \"doChunkUnload\");\n\t\t$this->doTickPending = new TimingsHandler(\"** \" . $name . \"doTickPending\");\n\t\t$this->doTickTiles = new TimingsHandler(\"** \" . $name . \"doTickTiles\");\n\t\t$this->doVillages = new TimingsHandler(\"** \" . $name . \"doVillages\");\n\t\t$this->doChunkMap = new TimingsHandler(\"** \" . $name . \"doChunkMap\");\n\t\t$this->doSounds = new TimingsHandler(\"** \" . $name . \"doSounds\");\n\t\t$this->doChunkGC = new TimingsHandler(\"** \" . $name . \"doChunkGC\");\n\t\t$this->doPortalForcer = new TimingsHandler(\"** \" . $name . \"doPortalForcer\");\n\t\t$this->entityTick = new TimingsHandler(\"** \" . $name . \"entityTick\");\n\t\t$this->tileEntityTick = new TimingsHandler(\"** \" . $name . \"tileEntityTick\");\n\t\t$this->tileEntityPending = new TimingsHandler(\"** \" . $name . \"tileEntityPending\");\n\n\t\t$this->syncChunkSendTimer = new TimingsHandler(\"** \" . $name . \"syncChunkSend\");\n\t\t$this->syncChunkSendPrepareTimer = new TimingsHandler(\"** \" . $name . \"syncChunkSendPrepare\");\n\n\t\t$this->syncChunkLoadTimer = new TimingsHandler(\"** \" . $name . \"syncChunkLoad\");\n\t\t$this->syncChunkLoadDataTimer = new TimingsHandler(\"** \" . $name . \"syncChunkLoad - Data\");\n\t\t$this->syncChunkLoadStructuresTimer = new TimingsHandler(\"** \" . $name . \"syncChunkLoad - Structures\");\n\t\t$this->syncChunkLoadEntitiesTimer = new TimingsHandler(\"** \" . $name . \"syncChunkLoad - Entities\");\n\t\t$this->syncChunkLoadTileEntitiesTimer = new TimingsHandler(\"** \" . $name . \"syncChunkLoad - TileEntities\");\n\t\t$this->syncChunkLoadTileTicksTimer = new TimingsHandler(\"** \" . $name . \"syncChunkLoad - TileTicks\");\n\t\t$this->syncChunkLoadPostTimer = new TimingsHandler(\"** \" . $name . \"syncChunkLoad - Post\");\n\n\t\t$this->tracker = new TimingsHandler($name . \"tracker\");\n\t\t$this->doTick = new TimingsHandler($name . \"doTick\");\n\t\t$this->tickEntities = new TimingsHandler($name . \"tickEntities\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/Listener.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event;\n\ninterface Listener{\n\n}"
  },
  {
    "path": "src/pocketmine/event/TextContainer.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event;\n\nclass TextContainer{\n\n\t/** @var string $text */\n\tprotected $text;\n\n\tpublic function __construct($text){\n\t\t$this->text = $text;\n\t}\n\n\tpublic function setText($text){\n\t\t$this->text = $text;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getText(){\n\t\treturn $this->text;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function __toString(){\n\t\treturn $this->getText();\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/Timings.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event;\n\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\Player;\nuse pocketmine\\plugin\\PluginManager;\nuse pocketmine\\scheduler\\PluginTask;\nuse pocketmine\\scheduler\\TaskHandler;\nuse pocketmine\\tile\\Tile;\n\nabstract class Timings{\n\n\t/** @var TimingsHandler */\n\tpublic static $fullTickTimer;\n\t/** @var TimingsHandler */\n\tpublic static $serverTickTimer;\n\t/** @var TimingsHandler */\n\tpublic static $memoryManagerTimer;\n\t/** @var TimingsHandler */\n\tpublic static $garbageCollectorTimer;\n\t/** @var TimingsHandler */\n\tpublic static $playerListTimer;\n\t/** @var TimingsHandler */\n\tpublic static $playerNetworkTimer;\n\t/** @var TimingsHandler */\n\tpublic static $playerNetworkReceiveTimer;\n\t/** @var TimingsHandler */\n\tpublic static $playerChunkOrderTimer;\n\t/** @var TimingsHandler */\n\tpublic static $playerChunkSendTimer;\n\t/** @var TimingsHandler */\n\tpublic static $connectionTimer;\n\t/** @var TimingsHandler */\n\tpublic static $tickablesTimer;\n\t/** @var TimingsHandler */\n\tpublic static $schedulerTimer;\n\t/** @var TimingsHandler */\n\tpublic static $chunkIOTickTimer;\n\t/** @var TimingsHandler */\n\tpublic static $timeUpdateTimer;\n\t/** @var TimingsHandler */\n\tpublic static $serverCommandTimer;\n\t/** @var TimingsHandler */\n\tpublic static $worldSaveTimer;\n\t/** @var TimingsHandler */\n\tpublic static $generationTimer;\n\t/** @var TimingsHandler */\n\tpublic static $populationTimer;\n\t/** @var TimingsHandler */\n\tpublic static $generationCallbackTimer;\n\t/** @var TimingsHandler */\n\tpublic static $permissibleCalculationTimer;\n\t/** @var TimingsHandler */\n\tpublic static $permissionDefaultTimer;\n\n\t/** @var TimingsHandler */\n\tpublic static $entityMoveTimer;\n\t/** @var TimingsHandler */\n\tpublic static $tickEntityTimer;\n\t/** @var TimingsHandler */\n\tpublic static $activatedEntityTimer;\n\t/** @var TimingsHandler */\n\tpublic static $tickTileEntityTimer;\n\n\t/** @var TimingsHandler */\n\tpublic static $timerEntityBaseTick;\n\t/** @var TimingsHandler */\n\tpublic static $timerLivingEntityBaseTick;\n\t/** @var TimingsHandler */\n\tpublic static $timerEntityAI;\n\t/** @var TimingsHandler */\n\tpublic static $timerEntityAICollision;\n\t/** @var TimingsHandler */\n\tpublic static $timerEntityAIMove;\n\t/** @var TimingsHandler */\n\tpublic static $timerEntityTickRest;\n\n\t/** @var TimingsHandler */\n\tpublic static $schedulerSyncTimer;\n\t/** @var TimingsHandler */\n\tpublic static $schedulerAsyncTimer;\n\n\t/** @var TimingsHandler */\n\tpublic static $playerCommandTimer;\n\n\t/** @var TimingsHandler[] */\n\tpublic static $entityTypeTimingMap = [];\n\t/** @var TimingsHandler[] */\n\tpublic static $tileEntityTypeTimingMap = [];\n\t/** @var TimingsHandler[] */\n\tpublic static $packetReceiveTimingMap = [];\n\t/** @var TimingsHandler[] */\n\tpublic static $packetSendTimingMap = [];\n\t/** @var TimingsHandler[] */\n\tpublic static $pluginTaskTimingMap = [];\n\n\tpublic static function init(){\n\t\tif(self::$serverTickTimer instanceof TimingsHandler){\n\t\t\treturn;\n\t\t}\n\n\t\tself::$fullTickTimer = new TimingsHandler(\"Full Server Tick\");\n\t\tself::$serverTickTimer = new TimingsHandler(\"** Full Server Tick\", self::$fullTickTimer);\n\t\tself::$memoryManagerTimer = new TimingsHandler(\"Memory Manager\");\n\t\tself::$garbageCollectorTimer = new TimingsHandler(\"Garbage Collector\", self::$memoryManagerTimer);\n\t\tself::$playerListTimer = new TimingsHandler(\"Player List\");\n\t\tself::$playerNetworkTimer = new TimingsHandler(\"Player Network Send\");\n\t\tself::$playerNetworkReceiveTimer = new TimingsHandler(\"Player Network Receive\");\n\t\tself::$playerChunkOrderTimer = new TimingsHandler(\"Player Order Chunks\");\n\t\tself::$playerChunkSendTimer = new TimingsHandler(\"Player Send Chunks\");\n\t\tself::$connectionTimer = new TimingsHandler(\"Connection Handler\");\n\t\tself::$tickablesTimer = new TimingsHandler(\"Tickables\");\n\t\tself::$schedulerTimer = new TimingsHandler(\"Scheduler\");\n\t\tself::$chunkIOTickTimer = new TimingsHandler(\"ChunkIOTick\");\n\t\tself::$timeUpdateTimer = new TimingsHandler(\"Time Update\");\n\t\tself::$serverCommandTimer = new TimingsHandler(\"Server Command\");\n\t\tself::$worldSaveTimer = new TimingsHandler(\"World Save\");\n\t\tself::$generationTimer = new TimingsHandler(\"World Generation\");\n\t\tself::$populationTimer = new TimingsHandler(\"World Population\");\n\t\tself::$generationCallbackTimer = new TimingsHandler(\"World Generation Callback\");\n\t\tself::$permissibleCalculationTimer = new TimingsHandler(\"Permissible Calculation\");\n\t\tself::$permissionDefaultTimer = new TimingsHandler(\"Default Permission Calculation\");\n\n\t\tself::$entityMoveTimer = new TimingsHandler(\"** entityMove\");\n\t\tself::$tickEntityTimer = new TimingsHandler(\"** tickEntity\");\n\t\tself::$activatedEntityTimer = new TimingsHandler(\"** activatedTickEntity\");\n\t\tself::$tickTileEntityTimer = new TimingsHandler(\"** tickTileEntity\");\n\n\t\tself::$timerEntityBaseTick = new TimingsHandler(\"** entityBaseTick\");\n\t\tself::$timerLivingEntityBaseTick = new TimingsHandler(\"** livingEntityBaseTick\");\n\t\tself::$timerEntityAI = new TimingsHandler(\"** livingEntityAI\");\n\t\tself::$timerEntityAICollision = new TimingsHandler(\"** livingEntityAICollision\");\n\t\tself::$timerEntityAIMove = new TimingsHandler(\"** livingEntityAIMove\");\n\t\tself::$timerEntityTickRest = new TimingsHandler(\"** livingEntityTickRest\");\n\n\t\tself::$schedulerSyncTimer = new TimingsHandler(\"** Scheduler - Sync Tasks\", PluginManager::$pluginParentTimer);\n\t\tself::$schedulerAsyncTimer = new TimingsHandler(\"** Scheduler - Async Tasks\");\n\n\t\tself::$playerCommandTimer = new TimingsHandler(\"** playerCommand\");\n\n\t}\n\n\t/**\n\t * @param TaskHandler $task\n\t * @param             $period\n\t *\n\t * @return TimingsHandler\n\t */\n\tpublic static function getPluginTaskTimings(TaskHandler $task, $period){\n\t\t$ftask = $task->getTask();\n\t\tif($ftask instanceof PluginTask and $ftask->getOwner() !== null){\n\t\t\t$plugin = $ftask->getOwner()->getDescription()->getFullName();\n\t\t}elseif($task->timingName !== null){\n\t\t\t$plugin = \"Scheduler\";\n\t\t}else{\n\t\t\t$plugin = \"Unknown\";\n\t\t}\n\n\t\t$taskname = $task->getTaskName();\n\n\t\t$name = \"Task: \" . $plugin . \" Runnable: \" . $taskname;\n\n\t\tif($period > 0){\n\t\t\t$name .= \"(interval:\" . $period . \")\";\n\t\t}else{\n\t\t\t$name .= \"(Single)\";\n\t\t}\n\n\t\tif(!isset(self::$pluginTaskTimingMap[$name])){\n\t\t\tself::$pluginTaskTimingMap[$name] = new TimingsHandler($name, self::$schedulerSyncTimer);\n\t\t}\n\n\t\treturn self::$pluginTaskTimingMap[$name];\n\t}\n\n\t/**\n\t * @param Entity $entity\n\t *\n\t * @return TimingsHandler\n\t */\n\tpublic static function getEntityTimings(Entity $entity){\n\t\t$entityType = (new \\ReflectionClass($entity))->getShortName();\n\t\tif(!isset(self::$entityTypeTimingMap[$entityType])){\n\t\t\tif($entity instanceof Player){\n\t\t\t\tself::$entityTypeTimingMap[$entityType] = new TimingsHandler(\"** tickEntity - EntityPlayer\", self::$tickEntityTimer);\n\t\t\t}else{\n\t\t\t\tself::$entityTypeTimingMap[$entityType] = new TimingsHandler(\"** tickEntity - \" . $entityType, self::$tickEntityTimer);\n\t\t\t}\n\t\t}\n\n\t\treturn self::$entityTypeTimingMap[$entityType];\n\t}\n\n\t/**\n\t * @param Tile $tile\n\t *\n\t * @return TimingsHandler\n\t */\n\tpublic static function getTileEntityTimings(Tile $tile){\n\t\t$tileType = (new \\ReflectionClass($tile))->getShortName();\n\t\tif(!isset(self::$tileEntityTypeTimingMap[$tileType])){\n\t\t\tself::$tileEntityTypeTimingMap[$tileType] = new TimingsHandler(\"** tickTileEntity - \" . $tileType, self::$tickTileEntityTimer);\n\t\t}\n\n\t\treturn self::$tileEntityTypeTimingMap[$tileType];\n\t}\n\n\t/**\n\t * @param DataPacket $pk\n\t *\n\t * @return TimingsHandler\n\t */\n\tpublic static function getReceiveDataPacketTimings(DataPacket $pk){\n\t\tif(!isset(self::$packetReceiveTimingMap[$pk::NETWORK_ID])){\n\t\t\t$pkName = (new \\ReflectionClass($pk))->getShortName();\n\t\t\tself::$packetReceiveTimingMap[$pk::NETWORK_ID] = new TimingsHandler(\"** receivePacket - \" . $pkName . \" [0x\" . dechex($pk::NETWORK_ID) . \"]\", self::$playerNetworkReceiveTimer);\n\t\t}\n\n\t\treturn self::$packetReceiveTimingMap[$pk::NETWORK_ID];\n\t}\n\n\n\t/**\n\t * @param DataPacket $pk\n\t *\n\t * @return TimingsHandler\n\t */\n\tpublic static function getSendDataPacketTimings(DataPacket $pk){\n\t\tif(!isset(self::$packetSendTimingMap[$pk::NETWORK_ID])){\n\t\t\t$pkName = (new \\ReflectionClass($pk))->getShortName();\n\t\t\tself::$packetSendTimingMap[$pk::NETWORK_ID] = new TimingsHandler(\"** sendPacket - \" . $pkName . \" [0x\" . dechex($pk::NETWORK_ID) . \"]\", self::$playerNetworkTimer);\n\t\t}\n\n\t\treturn self::$packetSendTimingMap[$pk::NETWORK_ID];\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/TimingsHandler.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event;\n\nuse pocketmine\\command\\defaults\\TimingsCommand;\nuse pocketmine\\entity\\Living;\nuse pocketmine\\plugin\\PluginManager;\nuse pocketmine\\Server;\n\nclass TimingsHandler{\n\n\t/** @var TimingsHandler[] */\n\tprivate static $HANDLERS = [];\n\n\tprivate $name;\n\t/** @var TimingsHandler */\n\tprivate $parent = null;\n\n\tprivate $count = 0;\n\tprivate $curCount = 0;\n\tprivate $start = 0;\n\tprivate $timingDepth = 0;\n\tprivate $totalTime = 0;\n\tprivate $curTickTotal = 0;\n\tprivate $violations = 0;\n\n\t/**\n\t * @param string         $name\n\t * @param TimingsHandler $parent\n\t */\n\tpublic function __construct($name, TimingsHandler $parent = null){\n\t\t$this->name = $name;\n\t\tif($parent !== null){\n\t\t\t$this->parent = $parent;\n\t\t}\n\n\t\tself::$HANDLERS[spl_object_hash($this)] = $this;\n\t}\n\n\tpublic static function printTimings($fp){\n\t\tfwrite($fp, \"Minecraft\" . PHP_EOL);\n\n\t\tforeach(self::$HANDLERS as $timings){\n\t\t\t$time = $timings->totalTime;\n\t\t\t$count = $timings->count;\n\t\t\tif($count === 0){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$avg = $time / $count;\n\n\t\t\tfwrite($fp, \"    \" . $timings->name . \" Time: \" . round($time * 1000000000) . \" Count: \" . $count . \" Avg: \" . round($avg * 1000000000) . \" Violations: \" . $timings->violations . PHP_EOL);\n\t\t}\n\n\t\tfwrite($fp, \"# Version \" . Server::getInstance()->getVersion() . PHP_EOL);\n\t\tfwrite($fp, \"# \" . Server::getInstance()->getName() . \" \" . Server::getInstance()->getPocketMineVersion() . PHP_EOL);\n\n\t\t$entities = 0;\n\t\t$livingEntities = 0;\n\t\tforeach(Server::getInstance()->getLevels() as $level){\n\t\t\t$entities += count($level->getEntities());\n\t\t\tforeach($level->getEntities() as $e){\n\t\t\t\tif($e instanceof Living){\n\t\t\t\t\t++$livingEntities;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfwrite($fp, \"# Entities \" . $entities . PHP_EOL);\n\t\tfwrite($fp, \"# LivingEntities \" . $livingEntities . PHP_EOL);\n\t}\n\n\tpublic static function reload(){\n\t\tif(Server::getInstance()->getPluginManager()->useTimings()){\n\t\t\tforeach(self::$HANDLERS as $timings){\n\t\t\t\t$timings->reset();\n\t\t\t}\n\t\t\tTimingsCommand::$timingStart = microtime(true);\n\t\t}\n\t}\n\n\tpublic static function tick($measure = true){\n\t\tif(PluginManager::$useTimings){\n\t\t\tif($measure){\n\t\t\t\tforeach(self::$HANDLERS as $timings){\n\t\t\t\t\tif($timings->curTickTotal > 0.05){\n\t\t\t\t\t\t$timings->violations += round($timings->curTickTotal / 0.05);\n\t\t\t\t\t}\n\t\t\t\t\t$timings->curTickTotal = 0;\n\t\t\t\t\t$timings->curCount = 0;\n\t\t\t\t\t$timings->timingDepth = 0;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tforeach(self::$HANDLERS as $timings){\n\t\t\t\t\t$timings->totalTime -= $timings->curTickTotal;\n\t\t\t\t\t$timings->count -= $timings->curCount;\n\n\t\t\t\t\t$timings->curTickTotal = 0;\n\t\t\t\t\t$timings->curCount = 0;\n\t\t\t\t\t$timings->timingDepth = 0;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function startTiming(){\n\t\tif(PluginManager::$useTimings and ++$this->timingDepth === 1){\n\t\t\t$this->start = microtime(true);\n\t\t\tif($this->parent !== null and ++$this->parent->timingDepth === 1){\n\t\t\t\t$this->parent->start = $this->start;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function stopTiming(){\n\t\tif(PluginManager::$useTimings){\n\t\t\tif(--$this->timingDepth !== 0 or $this->start === 0){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$diff = microtime(true) - $this->start;\n\t\t\t$this->totalTime += $diff;\n\t\t\t$this->curTickTotal += $diff;\n\t\t\t++$this->curCount;\n\t\t\t++$this->count;\n\t\t\t$this->start = 0;\n\t\t\tif($this->parent !== null){\n\t\t\t\t$this->parent->stopTiming();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function reset(){\n\t\t$this->count = 0;\n\t\t$this->curCount = 0;\n\t\t$this->violations = 0;\n\t\t$this->curTickTotal = 0;\n\t\t$this->totalTime = 0;\n\t\t$this->start = 0;\n\t\t$this->timingDepth = 0;\n\t}\n\n\tpublic function remove(){\n\t\tunset(self::$HANDLERS[spl_object_hash($this)]);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/TranslationContainer.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event;\n\nclass TranslationContainer extends TextContainer{\n\n\t/** @var string[] $params */\n\tprotected $params = [];\n\n\t/**\n\t * @param string   $text\n\t * @param string[] $params\n\t */\n\tpublic function __construct($text, array $params = []){\n\t\tparent::__construct($text);\n\n\t\t$this->setParameters($params);\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic function getParameters(){\n\t\treturn $this->params;\n\t}\n\n\t/**\n\t * @param int $i\n\t *\n\t * @return string\n\t */\n\tpublic function getParameter($i){\n\t\treturn isset($this->params[$i]) ? $this->params[$i] : null;\n\t}\n\n\t/**\n\t * @param int    $i\n\t * @param string $str\n\t */\n\tpublic function setParameter($i, $str){\n\t\tif($i < 0 or $i > count($this->params)){ //Intended, allow to set the last\n\t\t\tthrow new \\InvalidArgumentException(\"Invalid index $i, have \" . count($this->params));\n\t\t}\n\n\t\t$this->params[(int) $i] = $str;\n\t}\n\n\t/**\n\t * @param string[] $params\n\t */\n\tpublic function setParameters(array $params){\n\t\t$i = 0;\n\t\tforeach($params as $str){\n\t\t\t$this->params[$i] = (string) $str;\n\n\t\t\t++$i;\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/block/BlockBreakEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass BlockBreakEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var \\pocketmine\\Player */\n\tprotected $player;\n\n\t/** @var \\pocketmine\\item\\Item */\n\tprotected $item;\n\n\t/** @var bool */\n\tprotected $instaBreak = false;\n\tprotected $blockDrops = [];\n\n\tpublic function __construct(Player $player, Block $block, Item $item, $instaBreak = false){\n\t\t$this->block = $block;\n\t\t$this->item = $item;\n\t\t$this->player = $player;\n\t\t$this->instaBreak = (bool)$instaBreak;\n\t\t$drops = $player->isSurvival() ? $block->getDrops($item) : [];\n\t\tif($drops != null && is_numeric($drops[0]))\n\t\t\t$this->blockDrops[] = Item::get($drops[0], $drops[1], $drops[2]);\n\t\telse\n\t\t\tforeach($drops as $i){\n\t\t\t\t$this->blockDrops[] = Item::get($i[0], $i[1], $i[2]);\n\t\t\t}\n\t}\n\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n\n\tpublic function getInstaBreak(){\n\t\treturn $this->instaBreak;\n\t}\n\n\t/**\n\t * @return Item[]\n\t */\n\tpublic function getDrops(){\n\t\treturn $this->blockDrops;\n\t}\n\n\t/**\n\t * @param Item[] $drops\n\t */\n\tpublic function setDrops(array $drops){\n\t\t$this->blockDrops = $drops;\n\t}\n\n\t/**\n\t * @param boolean $instaBreak\n\t */\n\tpublic function setInstaBreak($instaBreak){\n\t\t$this->instaBreak = (bool)$instaBreak;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/block/BlockBurnEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\event\\Cancellable;\n\nclass BlockBurnEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n}"
  },
  {
    "path": "src/pocketmine/event/block/BlockEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\n/**\n * Block related events\n */\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Event;\n\nabstract class BlockEvent extends Event{\n\t/** @var \\pocketmine\\block\\Block */\n\tprotected $block;\n\n\t/**\n\t * @param Block $block\n\t */\n\tpublic function __construct(Block $block){\n\t\t$this->block = $block;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getBlock(){\n\t\treturn $this->block;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/block/BlockFormEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\n\nclass BlockFormEvent extends BlockGrowEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tpublic function __construct(Block $block, Block $newState){\n\t\tparent::__construct($block, $newState);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/block/BlockGrowEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\n\nclass BlockGrowEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Block */\n\tprivate $newState;\n\n\tpublic function __construct(Block $block, Block $newState){\n\t\tparent::__construct($block);\n\t\t$this->newState = $newState;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getNewState(){\n\t\treturn $this->newState;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/block/BlockPlaceEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\n/**\n * Called when a player places a block\n */\nclass BlockPlaceEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var \\pocketmine\\Player */\n\tprotected $player;\n\n\t/** @var \\pocketmine\\item\\Item */\n\tprotected $item;\n\n\n\tprotected $blockReplace;\n\tprotected $blockAgainst;\n\n\tpublic function __construct(Player $player, Block $blockPlace, Block $blockReplace, Block $blockAgainst, Item $item){\n\t\t$this->block = $blockPlace;\n\t\t$this->blockReplace = $blockReplace;\n\t\t$this->blockAgainst = $blockAgainst;\n\t\t$this->item = $item;\n\t\t$this->player = $player;\n\t}\n\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n\n\t/**\n\t * Gets the item in hand\n\t *\n\t * @return mixed\n\t */\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n\n\tpublic function getBlockReplaced(){\n\t\treturn $this->blockReplace;\n\t}\n\n\tpublic function getBlockAgainst(){\n\t\treturn $this->blockAgainst;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/block/BlockSpreadEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\n\nclass BlockSpreadEvent extends BlockFormEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Block */\n\tprivate $source;\n\n\tpublic function __construct(Block $block, Block $source, Block $newState){\n\t\tparent::__construct($block, $newState);\n\t\t$this->source = $source;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getSource(){\n\t\treturn $this->source;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/block/BlockUpdateEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\event\\Cancellable;\n\n/**\n * Called when a block tries to be updated due to a neighbor change\n */\nclass BlockUpdateEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n}"
  },
  {
    "path": "src/pocketmine/event/block/ItemFrameDropItemEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\ItemFrame;\n\nclass ItemFrameDropItemEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var  Player */\n\tprivate $player;\n\t/** @var  Item */\n\tprivate $item;\n\t/** @var  ItemFrame */\n\tprivate $itemFrame;\n\n\tpublic function __construct(Player $player, Block $block, ItemFrame $itemFrame, Item $item){\n\t\t$this->player = $player;\n\t\t$this->block = $block;\n\t\t$this->itemFrame = $itemFrame;\n\t\t$this->item = $item;\n\t}\n\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n\n\tpublic function getItemFrame(){\n\t\treturn $this->itemFrame;\n\t}\n\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/block/LeavesDecayEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\n\nclass LeavesDecayEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tpublic function __construct(Block $block){\n\t\tparent::__construct($block);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/block/SignChangeEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\block;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a sign is changed by a player.\n */\nclass SignChangeEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var \\pocketmine\\Player */\n\tprivate $player;\n\t/** @var string[] */\n\tprivate $lines = [];\n\n\t/**\n\t * @param Block    $theBlock\n\t * @param Player   $thePlayer\n\t * @param string[] $theLines\n\t */\n\tpublic function __construct(Block $theBlock, Player $thePlayer, array $theLines){\n\t\tparent::__construct($theBlock);\n\t\t$this->player = $thePlayer;\n\t\t$this->lines = $theLines;\n\t}\n\n\t/**\n\t * @return Player\n\t */\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic function getLines(){\n\t\treturn $this->lines;\n\t}\n\n\t/**\n\t * @param int $index 0-3\n\t *\n\t * @return string\n\t */\n\tpublic function getLine($index){\n\t\treturn $this->lines[$index];\n\t}\n\n\t/**\n\t * @param int    $index 0-3\n\t * @param string $line\n\t */\n\tpublic function setLine($index, $line){\n\t\t$this->lines[$index] = $line;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/entity/CreeperPowerEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Creeper;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\entity\\Lightning;\n\nclass CreeperPowerEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst CAUSE_SET_ON = 0;\n\tconst CAUSE_SET_OFF = 1;\n\tconst CAUSE_LIGHTNING = 2;\n\n\t/** @var  Lightning */\n\tprivate $lightning;\n\n\tprivate $cause;\n\n\tpublic function __construct(Creeper $creeper, Lightning $lightning = null, int $cause = self::CAUSE_LIGHTNING){\n\t\t$this->entity = $creeper;\n\t\t$this->lightning = $lightning;\n\t\t$this->cause = $cause;\n\t}\n\n\tpublic function getLightning(){\n\t\treturn $this->lightning;\n\t}\n\n\tpublic function getCause(){\n\t\treturn $this->cause;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityArmorChangeEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\n\nclass EntityArmorChangeEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $oldItem;\n\tprivate $newItem;\n\tprivate $slot;\n\n\tpublic function __construct(Entity $entity, Item $oldItem, Item $newItem, $slot){\n\t\t$this->entity = $entity;\n\t\t$this->oldItem = $oldItem;\n\t\t$this->newItem = $newItem;\n\t\t$this->slot = (int) $slot;\n\t}\n\n\tpublic function getSlot(){\n\t\treturn $this->slot;\n\t}\n\n\tpublic function getNewItem(){\n\t\treturn $this->newItem;\n\t}\n\n\tpublic function setNewItem(Item $item){\n\t\t$this->newItem = $item;\n\t}\n\n\tpublic function getOldItem(){\n\t\treturn $this->oldItem;\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityBlockChangeEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\n\n/**\n * Called when an Entity, excluding players, changes a block directly\n */\nclass EntityBlockChangeEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $from;\n\tprivate $to;\n\n\tpublic function __construct(Entity $entity, Block $from, Block $to){\n\t\t$this->entity = $entity;\n\t\t$this->from = $from;\n\t\t$this->to = $to;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getBlock(){\n\t\treturn $this->from;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getTo(){\n\t\treturn $this->to;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityCombustByBlockEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\n\nclass EntityCombustByBlockEvent extends EntityCombustEvent{\n\n\tprotected $combuster;\n\n\t/**\n\t * @param Block  $combuster\n\t * @param Entity $combustee\n\t * @param int    $duration\n\t * @param int    $ProtectLevel\n\t */\n\tpublic function __construct(Block $combuster, Entity $combustee, $duration, $ProtectLevel = 0){\n\t\tparent::__construct($combustee, $duration, $ProtectLevel);\n\t\t$this->combuster = $combuster;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getCombuster(){\n\t\treturn $this->combuster;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityCombustByEntityEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\n\nclass EntityCombustByEntityEvent extends EntityCombustEvent{\n\n\tprotected $combuster;\n\n\t/**\n\t * @param Entity $combuster\n\t * @param Entity $combustee\n\t * @param int    $duration\n\t * @param int    $ProtectLevel\n\t */\n\tpublic function __construct(Entity $combuster, Entity $combustee, $duration, $ProtectLevel = 0){\n\t\tparent::__construct($combustee, $duration, $ProtectLevel);\n\t\t$this->combuster = $combuster;\n\t}\n\n\t/**\n\t * @return Entity\n\t */\n\tpublic function getCombuster(){\n\t\treturn $this->combuster;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityCombustEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\n\nclass EntityCombustEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprotected $duration;\n\tprotected $ProtectLevel;\n\n\t/**\n\t * @param Entity $combustee\n\t * @param int    $duration\n\t * @param int    $ProtectLevel\n\t */\n\tpublic function __construct(Entity $combustee, $duration, $ProtectLevel = 0){\n\t\t$this->entity = $combustee;\n\t\t$this->duration = $duration;\n\t\t$this->ProtectLevel = $ProtectLevel;\n\t}\n\n\tpublic function getDuration(){\n\t\tif($this->ProtectLevel !== 0){\n\t\t\treturn round($this->duration * (1 - 0.15 * $this->ProtectLevel));\n\t\t}else{\n\t\t\treturn $this->duration;\n\t\t}\n\t}\n\n\tpublic function setDuration($duration){\n\t\t$this->duration = (int) $duration;\n\t}\n\n\tpublic function setProtectLevel($ProtectLevel){\n\t\t$this->ProtectLevel = (int) $ProtectLevel;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityDamageByBlockEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\n\nclass EntityDamageByBlockEvent extends EntityDamageEvent{\n\n\t/** @var Block */\n\tprivate $damager;\n\n\n\t/**\n\t * @param Block     $damager\n\t * @param Entity    $entity\n\t * @param int       $cause\n\t * @param int|int[] $damage\n\t */\n\tpublic function __construct(Block $damager, Entity $entity, $cause, $damage){\n\t\t$this->damager = $damager;\n\t\tparent::__construct($entity, $cause, $damage);\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getDamager(){\n\t\treturn $this->damager;\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityDamageByChildEntityEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\n\nclass EntityDamageByChildEntityEvent extends EntityDamageByEntityEvent{\n\n\t/** @var Entity */\n\tprivate $childEntity;\n\n\n\t/**\n\t * @param Entity    $damager\n\t * @param Entity    $childEntity\n\t * @param Entity    $entity\n\t * @param int       $cause\n\t * @param int|int[] $damage\n\t */\n\tpublic function __construct(Entity $damager, Entity $childEntity, Entity $entity, $cause, $damage){\n\t\t$this->childEntity = $childEntity;\n\t\tparent::__construct($damager, $entity, $cause, $damage);\n\t}\n\n\t/**\n\t * @return Entity\n\t */\n\tpublic function getChild(){\n\t\treturn $this->childEntity;\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityDamageByEntityEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\n\nclass EntityDamageByEntityEvent extends EntityDamageEvent{\n\n\t/** @var Entity */\n\tprivate $damager;\n\t/** @var float */\n\tprivate $knockBack;\n\n\t/**\n\t * @param Entity    $damager\n\t * @param Entity    $entity\n\t * @param int       $cause\n\t * @param int|int[] $damage\n\t * @param float     $knockBack\n\t */\n\tpublic function __construct(Entity $damager, Entity $entity, $cause, $damage, $knockBack = 0.4){\n\t\t$this->damager = $damager;\n\t\t$this->knockBack = $knockBack;\n\t\tparent::__construct($entity, $cause, $damage);\n\t\t$this->addAttackerModifiers($damager);\n\t}\n\n\tprotected function addAttackerModifiers(Entity $damager){\n\t\tif($damager->hasEffect(Effect::STRENGTH)){\n\t\t\t$this->setRateDamage(1 + 0.3 * ($damager->getEffect(Effect::STRENGTH)->getAmplifier() + 1), self::MODIFIER_STRENGTH);\n\t\t}\n\n\t\tif($damager->hasEffect(Effect::WEAKNESS)){\n\t\t\t$eff_level = 1 -  0.2 * ($damager->getEffect(Effect::WEAKNESS)->getAmplifier() + 1);\n\t\t\tif($eff_level < 0){\n\t\t\t\t$eff_level = 0;\n\t\t\t}\n\t\t\t$this->setRateDamage($eff_level, self::MODIFIER_WEAKNESS);\n\t\t}\n\t}\n\n\t/**\n\t * @return Entity\n\t */\n\tpublic function getDamager(){\n\t\treturn $this->damager;\n\t}\n\t/**\n\t * @return float\n\t */\n\tpublic function getKnockBack(){\n\t\treturn $this->knockBack;\n\t}\n\t/**\n\t * @param float $knockBack\n\t */\n\tpublic function setKnockBack($knockBack){\n\t\t$this->knockBack = $knockBack;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityDamageEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\inventory\\PlayerInventory;\nuse pocketmine\\item\\Armor;\nuse pocketmine\\Player;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nclass EntityDamageEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst MODIFIER_BASE = 0;\n\tconst MODIFIER_RESISTANCE = 1;\n\tconst MODIFIER_ARMOR = 2;\n\tconst MODIFIER_PROTECTION = 3;\n\tconst MODIFIER_STRENGTH = 4;\n\tconst MODIFIER_WEAKNESS = 5;\n\n\tconst CAUSE_CONTACT = 0;\n\tconst CAUSE_ENTITY_ATTACK = 1;\n\tconst CAUSE_PROJECTILE = 2;\n\tconst CAUSE_SUFFOCATION = 3;\n\tconst CAUSE_FALL = 4;\n\tconst CAUSE_FIRE = 5;\n\tconst CAUSE_FIRE_TICK = 6;\n\tconst CAUSE_LAVA = 7;\n\tconst CAUSE_DROWNING = 8;\n\tconst CAUSE_BLOCK_EXPLOSION = 9;\n\tconst CAUSE_ENTITY_EXPLOSION = 10;\n\tconst CAUSE_VOID = 11;\n\tconst CAUSE_SUICIDE = 12;\n\tconst CAUSE_MAGIC = 13;\n\tconst CAUSE_CUSTOM = 14;\n\tconst CAUSE_STARVATION = 15;\n\n\tconst CAUSE_LIGHTNING = 16;\n\n\n\tprivate $cause;\n\tprivate $EPF = 0;\n\tprivate $fireProtectL = 0;\n\t/** @var array */\n\tprivate $modifiers;\n\tprivate $rateModifiers = [];\n\tprivate $originals;\n\tprivate $usedArmors = [];\n\tprivate $thornsLevel = [];\n\tprivate $thornsArmor;\n\tprivate $thornsDamage = 0;\n\n\n\t/**\n\t * @param Entity    $entity\n\t * @param int       $cause\n\t * @param int|int[] $damage\n\t *\n\t * @throws \\Exception\n\t */\n\tpublic function __construct(Entity $entity, $cause, $damage){\n\t\t$this->entity = $entity;\n\t\t$this->cause = $cause;\n\t\tif(is_array($damage)){\n\t\t\t$this->modifiers = $damage;\n\t\t}else{\n\t\t\t$this->modifiers = [\n\t\t\t\tself::MODIFIER_BASE => $damage\n\t\t\t];\n\t\t}\n\n\t\t$this->originals = $this->modifiers;\n\n\t\tif(!isset($this->modifiers[self::MODIFIER_BASE])){\n\t\t\tthrow new \\InvalidArgumentException(\"BASE Damage modifier missing\");\n\t\t}\n\n\t\t//For DAMAGE_RESISTANCE\n\t\tif($cause !== self::CAUSE_VOID and $cause !== self::CAUSE_SUICIDE){\n\t\t\tif($entity->hasEffect(Effect::DAMAGE_RESISTANCE)){\n\t\t\t\t$RES_level = 1 - 0.20 * ($entity->getEffect(Effect::DAMAGE_RESISTANCE)->getAmplifier() + 1);\n\t\t\t\tif($RES_level < 0){\n\t\t\t\t\t$RES_level = 0;\n\t\t\t\t}\n\t\t\t\t$this->setRateDamage($RES_level, self::MODIFIER_RESISTANCE);\n\t\t\t}\n\t\t}\n\n\t\t//TODO: add zombie\n\t\tif($entity instanceof Player and $entity->getInventory() instanceof PlayerInventory){\n\t\t\tswitch($cause){\n\t\t\t\tcase self::CAUSE_CONTACT:\n\t\t\t\tcase self::CAUSE_ENTITY_ATTACK:\n\t\t\t\tcase self::CAUSE_PROJECTILE:\n\t\t\t\tcase self::CAUSE_FIRE:\n\t\t\t\tcase self::CAUSE_LAVA:\n\t\t\t\tcase self::CAUSE_BLOCK_EXPLOSION:\n\t\t\t\tcase self::CAUSE_ENTITY_EXPLOSION:\n\t\t\t\tcase self::CAUSE_LIGHTNING:\n\t\t\t\t\t$points = 0;\n\t\t\t\t\tforeach($entity->getInventory()->getArmorContents() as $index => $i){\n\t\t\t\t\t\tif($i->isArmor()){\n\t\t\t\t\t\t\t$points += $i->getArmorValue();\n\t\t\t\t\t\t\t$this->usedArmors[$index] = 1;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($points !== 0){\n\t\t\t\t\t\t$this->setRateDamage(1 - 0.04 * $points, self::MODIFIER_ARMOR);\n\t\t\t\t\t}\n\t\t\t\t\t//For Protection\n\t\t\t\t\t$spe_Prote = null;\n\t\t\t\t\tswitch($cause){\n\t\t\t\t\t\tcase self::CAUSE_ENTITY_EXPLOSION:\n\t\t\t\t\t\tcase self::CAUSE_BLOCK_EXPLOSION:\n\t\t\t\t\t\t\t$spe_Prote = Enchantment::TYPE_ARMOR_EXPLOSION_PROTECTION;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase self::CAUSE_FIRE:\n\t\t\t\t\t\tcase self::CAUSE_LAVA:\n\t\t\t\t\t\t\t$spe_Prote = Enchantment::TYPE_ARMOR_FIRE_PROTECTION;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase self::CAUSE_PROJECTILE:\n\t\t\t\t\t\t\t$spe_Prote = Enchantment::TYPE_ARMOR_PROJECTILE_PROTECTION;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tdefault;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\tforeach($this->usedArmors as $index => $cost){\n\t\t\t\t\t\t$i = $entity->getInventory()->getArmorItem($index);\n\t\t\t\t\t\tif($i->isArmor()){\n\t\t\t\t\t\t\t$this->EPF += $i->getEnchantmentLevel(Enchantment::TYPE_ARMOR_PROTECTION);\n\t\t\t\t\t\t\t$this->fireProtectL = max($this->fireProtectL, $i->getEnchantmentLevel(Enchantment::TYPE_ARMOR_FIRE_PROTECTION));\n\t\t\t\t\t\t\tif($i->getEnchantmentLevel(Enchantment::TYPE_ARMOR_THORNS) > 0){\n\t\t\t\t\t\t\t\t$this->thornsLevel[$index] = $i->getEnchantmentLevel(Enchantment::TYPE_ARMOR_THORNS);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tif($spe_Prote !== null){\n\t\t\t\t\t\t\t\t$this->EPF += 2 * $i->getEnchantmentLevel($spe_Prote);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase self::CAUSE_FALL:\n\t\t\t\t\t//Feather Falling\n\t\t\t\t\t$i = $entity->getInventory()->getBoots();\n\t\t\t\t\tif($i->isArmor()){\n\t\t\t\t\t\t$this->EPF += $i->getEnchantmentLevel(Enchantment::TYPE_ARMOR_PROTECTION);\n\t\t\t\t\t\t$this->EPF += 3 * $i->getEnchantmentLevel(Enchantment::TYPE_ARMOR_FALL_PROTECTION);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase self::CAUSE_FIRE_TICK:\n\t\t\t\tcase self::CAUSE_SUFFOCATION:\n\t\t\t\tcase self::CAUSE_DROWNING:\n\t\t\t\tcase self::CAUSE_VOID:\n\t\t\t\tcase self::CAUSE_SUICIDE:\n\t\t\t\tcase self::CAUSE_MAGIC:\n\t\t\t\tcase self::CAUSE_CUSTOM:\n\t\t\t\tcase self::CAUSE_STARVATION:\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif($this->EPF !== 0){\n\t\t\t\t$this->EPF = min(20, ceil($this->EPF * mt_rand(50, 100) / 100));\n\t\t\t\t$this->setRateDamage(1 - 0.04 * $this->EPF, self::MODIFIER_PROTECTION);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getCause(){\n\t\treturn $this->cause;\n\t}\n\n\t/**\n\t * @param int $type\n\t *\n\t * @return int\n\t */\n\tpublic function getOriginalDamage($type = self::MODIFIER_BASE){\n\t\tif(isset($this->originals[$type])){\n\t\t\treturn $this->originals[$type];\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/**\n\t * @param int $type\n\t *\n\t * @return int\n\t */\n\tpublic function getDamage($type = self::MODIFIER_BASE){\n\t\tif(isset($this->modifiers[$type])){\n\t\t\treturn $this->modifiers[$type];\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t/**\n\t * @param float $damage\n\t * @param int   $type\n\t *\n\t * @throws \\UnexpectedValueException\n\t */\n\tpublic function setDamage($damage, $type = self::MODIFIER_BASE){\n\t\t$this->modifiers[$type] = $damage;\n\t}\n\n\t/**\n\t * @param int $type\n\t *\n\t * @return float 1 - the percentage\n\t */\n\tpublic function getRateDamage($type = self::MODIFIER_BASE){\n\t\tif(isset($this->rateModifiers[$type])){\n\t\t\treturn $this->rateModifiers[$type];\n\t\t}\n\t\treturn 1;\n\t}\n\n\t/**\n\t * @param float $damage\n\t * @param int   $type\n\t *\n\t * Notice:If you want to add/reduce the damage without reducing by Armor or effect. set a new Damage using setDamage\n\t * Notice:If you want to add/reduce the damage within reducing by Armor of effect. Plz change the MODIFIER_BASE\n\t * Notice:If you want to add/reduce the damage by multiplying. Plz use this function.\n\t */\n\tpublic function setRateDamage($damage, $type = self::MODIFIER_BASE){\n\t\t$this->rateModifiers[$type] = $damage;\n\t}\n\n\t/**\n\t * @param int $type\n\t *\n\t * @return bool\n\t */\n\tpublic function isApplicable($type){\n\t\treturn isset($this->modifiers[$type]);\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getFinalDamage(){\n\t\t$damage = $this->modifiers[self::MODIFIER_BASE];\n\t\tforeach($this->rateModifiers as $type => $d){\n\t\t\t$damage *= $d;\n\t\t}\n\t\tforeach($this->modifiers as $type => $d){\n\t\t\tif($type !== self::MODIFIER_BASE){\n\t\t\t\t$damage += $d;\n\t\t\t}\n\t\t}\n\t\treturn $damage;\n\t}\n\n\t/**\n\t * @return Item $usedArmors\n\t * notice: $usedArmors $index->$cost\n\t * $index: the $index of ArmorInventory\n\t * $cost:  the num of durability cost\n\t */\n\tpublic function getUsedArmors(){\n\t\treturn $this->usedArmors;\n\t}\n\n\t/**\n\t * @return Int $fireProtectL\n\t */\n\tpublic function getFireProtectL(){\n\t\treturn $this->fireProtectL;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function useArmors(){\n\t\tif($this->entity instanceof Player){\n\t\t\tif($this->entity->isSurvival() and $this->entity->isAlive()){\n\t\t\t\tforeach($this->usedArmors as $index => $cost){\n\t\t\t\t\t$i = $this->entity->getInventory()->getArmorItem($index);\n\t\t\t\t\tif($i->isArmor()){\n\t\t\t\t\t\t/** @var Armor $i */\n\t\t\t\t\t\t$i->useOn($i, $cost);\n\t\t\t\t\t\t$this->entity->getInventory()->setArmorItem($index, $i);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function createThornsDamage(){\n\t\tif($this->thornsLevel !== []){\n\t\t\t$this->thornsArmor = array_rand($this->thornsLevel);\n\t\t\t$thornsL = $this->thornsLevel[$this->thornsArmor];\n\t\t\tif(mt_rand(1, 100) < $thornsL * 15){\n\t\t\t\t$this->thornsDamage = mt_rand(1, 4);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getThornsDamage(){\n\t\treturn $this->thornsDamage;\n\t}\n\n\t/**\n\t * @return bool should be used after getThornsDamage()\n\t */\n\tpublic function setThornsArmorUse(){\n\t\tif($this->thornsArmor === null){\n\t\t\treturn false;\n\t\t}else{\n\t\t\t$this->usedArmors[$this->thornsArmor] = 3;\n\t\t\treturn true;\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityDeathEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Living;\nuse pocketmine\\item\\Item;\n\nclass EntityDeathEvent extends EntityEvent{\n\tpublic static $handlerList = null;\n\n\t/** @var Item[] */\n\tprivate $drops = [];\n\n\n\t/**\n\t * @param Living $entity\n\t * @param Item[] $drops\n\t */\n\tpublic function __construct(Living $entity, array $drops = []){\n\t\t$this->entity = $entity;\n\t\t$this->drops = $drops;\n\t}\n\n\t/**\n\t * @return Living\n\t */\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\item\\Item[]\n\t */\n\tpublic function getDrops(){\n\t\treturn $this->drops;\n\t}\n\n\t/**\n\t * @param Item[] $drops\n\t */\n\tpublic function setDrops(array $drops){\n\t\t$this->drops = $drops;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityDespawnEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Creature;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Human;\nuse pocketmine\\entity\\Item;\nuse pocketmine\\entity\\Projectile;\nuse pocketmine\\entity\\Vehicle;\n\n/**\n * Called when a entity is despawned\n */\nclass EntityDespawnEvent extends EntityEvent{\n\tpublic static $handlerList = null;\n\n\tprivate $entityType;\n\n\t/**\n\t * @param Entity $entity\n\t */\n\tpublic function __construct(Entity $entity){\n\t\t$this->entity = $entity;\n\t\t$this->entityType = $entity::NETWORK_ID;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getType(){\n\t\treturn $this->entityType;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isCreature(){\n\t\treturn $this->entity instanceof Creature;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isHuman(){\n\t\treturn $this->entity instanceof Human;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isProjectile(){\n\t\treturn $this->entity instanceof Projectile;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isVehicle(){\n\t\treturn $this->entity instanceof Vehicle;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isItem(){\n\t\treturn $this->entity instanceof Item;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityDrinkPotionEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Potion;\n\nclass EntityDrinkPotionEvent extends EntityEvent implements Cancellable{\n\t\n\tpublic static $handlerList = null;\n\t\n\t/* @var Potion */\n\tprivate $potion;\n\t\n\t/* @var Effect[] */\n\tprivate $effects;\n\t\n\tpublic function __construct(Entity $entity, Potion $potion){\n\t\t$this->entity = $entity;\n\t\t$this->potion = $potion;\n\t\t$this->effects = $potion->getEffects();\n\t}\n\t\n\tpublic function getEffects(){\n\t\treturn $this->effects;\n\t}\n\t\n\tpublic function getPotion(){\n\t\treturn $this->potion;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityEatBlockEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\FoodSource;\n\nclass EntityEatBlockEvent extends EntityEatEvent implements Cancellable{\n\tpublic function __construct(Entity $entity, FoodSource $foodSource){\n\t\tif(!($foodSource instanceof Block)){\n\t\t\tthrow new \\InvalidArgumentException(\"Food source must be a block\");\n\t\t}\n\t\tparent::__construct($entity, $foodSource);\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getResidue(){\n\t\treturn parent::getResidue();\n\t}\n\n\tpublic function setResidue($residue){\n\t\tif(!($residue instanceof Block)){\n\t\t\tthrow new \\InvalidArgumentException(\"Eating a Block can only result in a Block residue\");\n\t\t}\n\t\tparent::setResidue($residue);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityEatEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\FoodSource;\n\nclass EntityEatEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var FoodSource */\n\tprivate $foodSource;\n\t/** @var int */\n\tprivate $foodRestore;\n\t/** @var float */\n\tprivate $saturationRestore;\n\tprivate $residue;\n\t/** @var Effect[] */\n\tprivate $additionalEffects;\n\n\tpublic function __construct(Entity $entity, FoodSource $foodSource){\n\t\t$this->entity = $entity;\n\t\t$this->foodSource = $foodSource;\n\t\t$this->foodRestore = $foodSource->getFoodRestore();\n\t\t$this->saturationRestore = $foodSource->getSaturationRestore();\n\t\t$this->residue = $foodSource->getResidue();\n\t\t$this->additionalEffects = $foodSource->getAdditionalEffects();\n\t}\n\n\tpublic function getFoodSource(){\n\t\treturn $this->foodSource;\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn $this->foodRestore;\n\t}\n\n\tpublic function setFoodRestore(int $foodRestore){\n\t\t$this->foodRestore = $foodRestore;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn $this->saturationRestore;\n\t}\n\n\tpublic function setSaturationRestore(float $saturationRestore){\n\t\t$this->saturationRestore = $saturationRestore;\n\t}\n\n\tpublic function getResidue(){\n\t\treturn $this->residue;\n\t}\n\n\tpublic function setResidue($residue){\n\t\t$this->residue = $residue;\n\t}\n\n\t/**\n\t * @return Effect[]\n\t */\n\tpublic function getAdditionalEffects(){\n\t\treturn $this->additionalEffects;\n\t}\n\n\t/**\n\t * @param Effect[] $additionalEffects\n\t *\n\t * @throws \\TypeError\n\t */\n\tpublic function setAdditionalEffects(array $additionalEffects){\n\t\tforeach($additionalEffects as $effect){\n\t\t\tif(!($effect instanceof Effect)){\n\t\t\t\tthrow new \\TypeError(\"Argument 1 passed to EntityEatEvent::setAdditionalEffects() must be an Effect array\");\n\t\t\t}\n\t\t}\n\t\t$this->additionalEffects = $additionalEffects;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityEatItemEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Food;\nuse pocketmine\\item\\Item;\n\nclass EntityEatItemEvent extends EntityEatEvent{\n\tpublic function __construct(Entity $entity, Food $foodSource){\n\t\tparent::__construct($entity, $foodSource);\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getResidue(){\n\t\treturn parent::getResidue();\n\t}\n\n\tpublic function setResidue($residue){\n\t\tif(!($residue instanceof Item)){\n\t\t\tthrow new \\InvalidArgumentException(\"Eating an Item can only result in an Item residue\");\n\t\t}\n\t\tparent::setResidue($residue);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityEffectAddEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\Event;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\entity\\Effect;\n\nclass EntityEffectAddEvent extends EntityEvent implements Cancellable{\n\n\tpublic static $handlerList = null;\n\n\t/** @var Effect */\n\tprotected $effect;\n\n\tpublic function __construct(Entity $entity, Effect $effect){\n\t\t$this->entity = $entity;\n\t\t$this->effect = $effect;\n\t}\n\n\t/**\n\t * @return Effect\n\t */\n\tpublic function getEffect(){\n\t\treturn $this->effect;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityEffectRemoveEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\Event;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\entity\\Effect;\n\nclass EntityEffectRemoveEvent extends EntityEvent implements Cancellable{\n\n\tpublic static $handlerList = null;\n\n\t/** @var Effect */\n\tprotected $effect;\n\n\tpublic function __construct(Entity $entity, int $effect){\n\t\t$this->entity = $entity;\n\t\t$this->effect = $effect;\n\t}\n\n\t/**\n\t * @return Effect\n\t */\n\tpublic function getEffect(){\n\t\treturn $this->effect;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\n/**\n * Entity related Events, like spawn, inventory, attack...\n */\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\event\\Event;\n\nabstract class EntityEvent extends Event{\n\t/** @var \\pocketmine\\entity\\Entity */\n\tprotected $entity;\n\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityExplodeEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\level\\Position;\n\n/**\n * Called when a entity explodes\n */\nclass EntityExplodeEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Position */\n\tprotected $position;\n\n\t/**\n\t * @var Block[]\n\t */\n\tprotected $blocks;\n\n\t/** @var float */\n\tprotected $yield;\n\n\t/**\n\t * @param Entity   $entity\n\t * @param Position $position\n\t * @param Block[]  $blocks\n\t * @param float    $yield\n\t */\n\tpublic function __construct(Entity $entity, Position $position, array $blocks, $yield){\n\t\t$this->entity = $entity;\n\t\t$this->position = $position;\n\t\t$this->blocks = $blocks;\n\t\t$this->yield = $yield;\n\t}\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getPosition(){\n\t\treturn $this->position;\n\t}\n\n\t/**\n\t * @return Block[]\n\t */\n\tpublic function getBlockList(){\n\t\treturn $this->blocks;\n\t}\n\n\t/**\n\t * @param Block[] $blocks\n\t */\n\tpublic function setBlockList(array $blocks){\n\t\t$this->blocks = $blocks;\n\t}\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getYield(){\n\t\treturn $this->yield;\n\t}\n\n\t/**\n\t * @param float $yield\n\t */\n\tpublic function setYield($yield){\n\t\t$this->yield = $yield;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityGenerateEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\level\\Position;\n\nclass EntityGenerateEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst CAUSE_AI_HOLDER = 0;\n\tconst CAUSE_MOB_SPAWNER = 1;\n\n\t/** @var Position  */\n\tprivate $position;\n\tprivate $cause;\n\tprivate $entityType;\n\n\tpublic function __construct(Position $pos, int $entityType, int $cause = self::CAUSE_MOB_SPAWNER){\n\t\t$this->position = $pos;\n\t\t$this->entityType = $entityType;\n\t\t$this->cause = $cause;\n\t}\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getPosition(){\n\t\treturn $this->position;\n\t}\n\n\tpublic function setPosition(Position $pos){\n\t\t$this->position = $pos;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getType() : int{\n\t\treturn $this->entityType;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getCause() : int{\n\t\treturn $this->cause;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityInventoryChangeEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\n\nclass EntityInventoryChangeEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $oldItem;\n\tprivate $newItem;\n\tprivate $slot;\n\n\tpublic function __construct(Entity $entity, Item $oldItem, Item $newItem, $slot){\n\t\t$this->entity = $entity;\n\t\t$this->oldItem = $oldItem;\n\t\t$this->newItem = $newItem;\n\t\t$this->slot = (int) $slot;\n\t}\n\n\tpublic function getSlot(){\n\t\treturn $this->slot;\n\t}\n\n\tpublic function getNewItem(){\n\t\treturn $this->newItem;\n\t}\n\n\tpublic function setNewItem(Item $item){\n\t\t$this->newItem = $item;\n\t}\n\n\tpublic function getOldItem(){\n\t\treturn $this->oldItem;\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityLevelChangeEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\level\\Level;\n\nclass EntityLevelChangeEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $originLevel;\n\tprivate $targetLevel;\n\n\tpublic function __construct(Entity $entity, Level $originLevel, Level $targetLevel){\n\t\t$this->entity = $entity;\n\t\t$this->originLevel = $originLevel;\n\t\t$this->targetLevel = $targetLevel;\n\t}\n\n\tpublic function getOrigin(){\n\t\treturn $this->originLevel;\n\t}\n\n\tpublic function getTarget(){\n\t\treturn $this->targetLevel;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityMotionEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\math\\Vector3;\n\nclass EntityMotionEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Vector3 */\n\tprivate $mot;\n\n\tpublic function __construct(Entity $entity, Vector3 $mot){\n\t\t$this->entity = $entity;\n\t\t$this->mot = $mot;\n\t}\n\n\t/**\n\t * @return Vector3\n\t */\n\tpublic function getVector(){\n\t\treturn $this->mot;\n\t}\n\n\n}\n"
  },
  {
    "path": "src/pocketmine/event/entity/EntityRegainHealthEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\n\nclass EntityRegainHealthEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst CAUSE_REGEN = 0;\n\tconst CAUSE_EATING = 1;\n\tconst CAUSE_MAGIC = 2;\n\tconst CAUSE_CUSTOM = 3;\n\tconst CAUSE_SATURATION = 4;\n\n\tprivate $amount;\n\tprivate $reason;\n\n\n\t/**\n\t * @param Entity $entity\n\t * @param float  $amount\n\t * @param int    $regainReason\n\t */\n\tpublic function __construct(Entity $entity, $amount, $regainReason){\n\t\t$this->entity = $entity;\n\t\t$this->amount = $amount;\n\t\t$this->reason = (int) $regainReason;\n\t}\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getAmount(){\n\t\treturn $this->amount;\n\t}\n\n\t/**\n\t * @param float $amount\n\t */\n\tpublic function setAmount($amount){\n\t\t$this->amount = $amount;\n\t}\n\n\tpublic function getRegainReason(){\n\t\treturn $this->reason;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityShootBowEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Living;\nuse pocketmine\\entity\\Projectile;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\n\nclass EntityShootBowEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Item */\n\tprivate $bow;\n\t/** @var Projectile */\n\tprivate $projectile;\n\t/** @var float */\n\tprivate $force;\n\n\t/**\n\t * @param Living     $shooter\n\t * @param Item       $bow\n\t * @param Projectile $projectile\n\t * @param float      $force\n\t */\n\tpublic function __construct(Living $shooter, Item $bow, Projectile $projectile, $force){\n\t\t$this->entity = $shooter;\n\t\t$this->bow = $bow;\n\t\t$this->projectile = $projectile;\n\t\t$this->force = $force;\n\t}\n\n\t/**\n\t * @return Living\n\t */\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getBow(){\n\t\treturn $this->bow;\n\t}\n\n\t/**\n\t * @return Entity|Projectile\n\t */\n\tpublic function getProjectile(){\n\t\treturn $this->projectile;\n\t}\n\n\t/**\n\t * @param Entity $projectile\n\t */\n\tpublic function setProjectile(Entity $projectile){\n\t\tif($projectile !== $this->projectile){\n\t\t\tif(count($this->projectile->getViewers()) === 0){\n\t\t\t\t$this->projectile->kill();\n\t\t\t\t$this->projectile->close();\n\t\t\t}\n\t\t\t$this->projectile = $projectile;\n\t\t}\n\t}\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getForce(){\n\t\treturn $this->force;\n\t}\n\n\t/**\n\t * @param float $force\n\t */\n\tpublic function setForce($force){\n\t\t$this->force = $force;\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntitySpawnEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Creature;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Human;\nuse pocketmine\\entity\\Item;\nuse pocketmine\\entity\\Projectile;\nuse pocketmine\\entity\\Vehicle;\n\n/**\n * Called when a entity is spawned\n */\nclass EntitySpawnEvent extends EntityEvent{\n\tpublic static $handlerList = null;\n\n\tprivate $entityType;\n\n\t/**\n\t * @param Entity $entity\n\t */\n\tpublic function __construct(Entity $entity){\n\t\t$this->entity = $entity;\n\t\t$this->entityType = $entity::NETWORK_ID;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\level\\Position\n\t */\n\tpublic function getPosition(){\n\t\treturn $this->entity->getPosition();\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getType(){\n\t\treturn $this->entityType;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isCreature(){\n\t\treturn $this->entity instanceof Creature;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isHuman(){\n\t\treturn $this->entity instanceof Human;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isProjectile(){\n\t\treturn $this->entity instanceof Projectile;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isVehicle(){\n\t\treturn $this->entity instanceof Vehicle;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isItem(){\n\t\treturn $this->entity instanceof Item;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/EntityTeleportEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\level\\Position;\n\nclass EntityTeleportEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Position */\n\tprivate $from;\n\t/** @var Position */\n\tprivate $to;\n\n\tpublic function __construct(Entity $entity, Position $from, Position $to){\n\t\t$this->entity = $entity;\n\t\t$this->from = $from;\n\t\t$this->to = $to;\n\t}\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getFrom(){\n\t\treturn $this->from;\n\t}\n\n\t/**\n\t * @param Position $from\n\t */\n\tpublic function setFrom(Position $from){\n\t\t$this->from = $from;\n\t}\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getTo(){\n\t\treturn $this->to;\n\t}\n\n\t/**\n\t * @param Position $to\n\t */\n\tpublic function setTo(Position $to){\n\t\t$this->to = $to;\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/ExplosionPrimeEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\Cancellable;\n\n/**\n * Called when a entity decides to explode\n */\nclass ExplosionPrimeEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprotected $force;\n\tprivate $blockBreaking;\n\tprivate $dropItem;\n\n\t/**\n\t * @param Entity $entity\n\t * @param float  $force\n\t * @param bool   $dropItem\n\t */\n\tpublic function __construct(Entity $entity, $force, bool $dropItem){\n\t\t$this->entity = $entity;\n\t\t$this->force = $force;\n\t\t$this->blockBreaking = true;\n\t\t$this->dropItem = $dropItem;\n\t}\n\n\tpublic function setDropItem(bool $dropItem){\n\t\t$this->dropItem = $dropItem;\n\t}\n\n\tpublic function dropItem() : bool{\n\t\treturn $this->dropItem;\n\t}\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getForce(){\n\t\treturn $this->force;\n\t}\n\n\tpublic function setForce($force){\n\t\t$this->force = (float) $force;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isBlockBreaking(){\n\t\treturn $this->blockBreaking;\n\t}\n\n\t/**\n\t * @param bool $affectsBlocks\n\t */\n\tpublic function setBlockBreaking($affectsBlocks){\n\t\t$this->blockBreaking = (bool) $affectsBlocks;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/ItemDespawnEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Item;\nuse pocketmine\\event\\Cancellable;\n\nclass ItemDespawnEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/**\n\t * @param Item $item\n\t */\n\tpublic function __construct(Item $item){\n\t\t$this->entity = $item;\n\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/ItemSpawnEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Item;\n\nclass ItemSpawnEvent extends EntityEvent{\n\tpublic static $handlerList = null;\n\n\t/**\n\t * @param Item $item\n\t */\n\tpublic function __construct(Item $item){\n\t\t$this->entity = $item;\n\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/ProjectileHitEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Projectile;\n\nclass ProjectileHitEvent extends EntityEvent{\n\tpublic static $handlerList = null;\n\n\t/**\n\t * @param Projectile $entity\n\t */\n\tpublic function __construct(Projectile $entity){\n\t\t$this->entity = $entity;\n\n\t}\n\n\t/**\n\t * @return Projectile\n\t */\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/entity/ProjectileLaunchEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\entity;\n\nuse pocketmine\\entity\\Projectile;\nuse pocketmine\\event\\Cancellable;\n\nclass ProjectileLaunchEvent extends EntityEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/**\n\t * @param Projectile $entity\n\t */\n\tpublic function __construct(Projectile $entity){\n\t\t$this->entity = $entity;\n\n\t}\n\n\t/**\n\t * @return Projectile\n\t */\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/CraftItemEvent.php",
    "content": "<?php\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\event\\Event;\nuse pocketmine\\inventory\\Recipe;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass CraftItemEvent extends Event implements Cancellable{\n\tpublic static $handlerList = null;\n\t/** @var Item[] */\n\tprivate $input = [];\n\t/** @var Recipe */\n\tprivate $recipe;\n\t/** @var \\pocketmine\\Player */\n\tprivate $player;\n\n\t/**\n\t * @param \\pocketmine\\Player $player\n\t * @param Item[]             $input\n\t * @param Recipe             $recipe\n\t */\n\tpublic function __construct(Player $player, array $input, Recipe $recipe){\n\t\t$this->player = $player;\n\t\t$this->input = $input;\n\t\t$this->recipe = $recipe;\n\t}\n\n\t/**\n\t * @return Item[]\n\t */\n\tpublic function getInput(){\n\t\t$items = [];\n\t\tforeach($items as $i => $item){\n\t\t\t$items[$i] = clone $item;\n\t\t}\n\t\treturn $items;\n\t}\n\n\t/**\n\t * @return Recipe\n\t */\n\tpublic function getRecipe(){\n\t\treturn $this->recipe;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\Player\n\t */\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/FurnaceBurnEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\event\\block\\BlockEvent;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\tile\\Furnace;\n\nclass FurnaceBurnEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $furnace;\n\tprivate $fuel;\n\tprivate $burnTime;\n\tprivate $burning = true;\n\n\tpublic function __construct(Furnace $furnace, Item $fuel, $burnTime){\n\t\tparent::__construct($furnace->getBlock());\n\t\t$this->fuel = $fuel;\n\t\t$this->burnTime = (int) $burnTime;\n\t\t$this->furnace = $furnace;\n\t}\n\n\t/**\n\t * @return Furnace\n\t */\n\tpublic function getFurnace(){\n\t\treturn $this->furnace;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getFuel(){\n\t\treturn $this->fuel;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getBurnTime(){\n\t\treturn $this->burnTime;\n\t}\n\n\t/**\n\t * @param int $burnTime\n\t */\n\tpublic function setBurnTime($burnTime){\n\t\t$this->burnTime = (int) $burnTime;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isBurning(){\n\t\treturn $this->burning;\n\t}\n\n\t/**\n\t * @param bool $burning\n\t */\n\tpublic function setBurning($burning){\n\t\t$this->burning = (bool) $burning;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/FurnaceSmeltEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\event\\block\\BlockEvent;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\tile\\Furnace;\n\nclass FurnaceSmeltEvent extends BlockEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $furnace;\n\tprivate $source;\n\tprivate $result;\n\n\tpublic function __construct(Furnace $furnace, Item $source, Item $result){\n\t\tparent::__construct($furnace->getBlock());\n\t\t$this->source = clone $source;\n\t\t$this->source->setCount(1);\n\t\t$this->result = $result;\n\t\t$this->furnace = $furnace;\n\t}\n\n\t/**\n\t * @return Furnace\n\t */\n\tpublic function getFurnace(){\n\t\treturn $this->furnace;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getSource(){\n\t\treturn $this->source;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getResult(){\n\t\treturn $this->result;\n\t}\n\n\t/**\n\t * @param Item $result\n\t */\n\tpublic function setResult(Item $result){\n\t\t$this->result = $result;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/InventoryCloseEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\inventory\\Inventory;\nuse pocketmine\\Player;\n\nclass InventoryCloseEvent extends InventoryEvent{\n\tpublic static $handlerList = null;\n\n\t/** @var Player */\n\tprivate $who;\n\n\t/**\n\t * @param Inventory $inventory\n\t * @param Player    $who\n\t */\n\tpublic function __construct(Inventory $inventory, Player $who){\n\t\t$this->who = $who;\n\t\tparent::__construct($inventory);\n\t}\n\n\t/**\n\t * @return Player\n\t */\n\tpublic function getPlayer(){\n\t\treturn $this->who;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/InventoryEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\n/**\n * Inventory related events\n */\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\event\\Event;\nuse pocketmine\\inventory\\Inventory;\n\nabstract class InventoryEvent extends Event{\n\n\t/** @var Inventory */\n\tprotected $inventory;\n\n\tpublic function __construct(Inventory $inventory){\n\t\t$this->inventory = $inventory;\n\t}\n\n\t/**\n\t * @return Inventory\n\t */\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\entity\\Human[]\n\t */\n\tpublic function getViewers(){\n\t\treturn $this->inventory->getViewers();\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/InventoryOpenEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\inventory\\Inventory;\nuse pocketmine\\Player;\n\nclass InventoryOpenEvent extends InventoryEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Player */\n\tprivate $who;\n\n\t/**\n\t * @param Inventory $inventory\n\t * @param Player    $who\n\t */\n\tpublic function __construct(Inventory $inventory, Player $who){\n\t\t$this->who = $who;\n\t\tparent::__construct($inventory);\n\t}\n\n\t/**\n\t * @return Player\n\t */\n\tpublic function getPlayer(){\n\t\treturn $this->who;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/InventoryPickupArrowEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\entity\\Arrow;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\inventory\\Inventory;\n\nclass InventoryPickupArrowEvent extends InventoryEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Arrow */\n\tprivate $arrow;\n\n\t/**\n\t * @param Inventory $inventory\n\t * @param Arrow     $arrow\n\t */\n\tpublic function __construct(Inventory $inventory, Arrow $arrow){\n\t\t$this->arrow = $arrow;\n\t\tparent::__construct($inventory);\n\t}\n\n\t/**\n\t * @return Arrow\n\t */\n\tpublic function getArrow(){\n\t\treturn $this->arrow;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/InventoryPickupItemEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\entity\\Item;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\inventory\\Inventory;\n\nclass InventoryPickupItemEvent extends InventoryEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Item */\n\tprivate $item;\n\n\t/**\n\t * @param Inventory $inventory\n\t * @param Item      $item\n\t */\n\tpublic function __construct(Inventory $inventory, Item $item){\n\t\t$this->item = $item;\n\t\tparent::__construct($inventory);\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/inventory/InventoryTransactionEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\inventory;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\event\\Event;\nuse pocketmine\\inventory\\TransactionQueue;\n\n/**\n * Called when an inventory transaction queue starts execution. \n */\n\nclass InventoryTransactionEvent extends Event implements Cancellable{\n\n\tpublic static $handlerList = null;\n\t\n\t/** @var TransactionQueue */\n\tprivate $transactionQueue;\n\t\n\t/**\n\t * @param TransactionQueue $ts\n\t */\n\tpublic function __construct(TransactionQueue $transactionQueue){\n\t\t$this->transactionQueue = $transactionQueue;\n\t}\n\n\t/**\n\t * @deprecated\n\t * @return TransactionQueue\n\t */\n\tpublic function getTransaction(){\n\t\treturn $this->transactionQueue;\n\t}\n\n\t/**\n\t * @return TransactionQueue\n\t */\n\tpublic function getQueue(){\n\t\treturn $this->transactionQueue;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/level/ChunkEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\n/**\n * Level related events\n */\nnamespace pocketmine\\event\\level;\n\nuse pocketmine\\level\\format\\Chunk;\n\nabstract class ChunkEvent extends LevelEvent{\n\t/** @var Chunk */\n\tprivate $chunk;\n\n\t/**\n\t * @param Chunk $chunk\n\t */\n\tpublic function __construct(Chunk $chunk){\n\t\tparent::__construct($chunk->getProvider()->getLevel());\n\t\t$this->chunk = $chunk;\n\t}\n\n\t/**\n\t * @return Chunk\n\t */\n\tpublic function getChunk(){\n\t\treturn $this->chunk;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/level/ChunkLoadEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\nuse pocketmine\\level\\format\\Chunk;\n\n/**\n * Called when a Chunk is loaded\n */\nclass ChunkLoadEvent extends ChunkEvent{\n\tpublic static $handlerList = null;\n\n\tprivate $newChunk;\n\n\tpublic function __construct(Chunk $chunk, $newChunk){\n\t\tparent::__construct($chunk);\n\t\t$this->newChunk = (bool) $newChunk;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isNewChunk(){\n\t\treturn $this->newChunk;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/level/ChunkPopulateEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\n/**\n * Called when a Chunk is populated (after receiving it on the main thread)\n */\nclass ChunkPopulateEvent extends ChunkEvent{\n\tpublic static $handlerList = null;\n}"
  },
  {
    "path": "src/pocketmine/event/level/ChunkUnloadEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\nuse pocketmine\\event\\Cancellable;\n\n/**\n * Called when a Chunk is unloaded\n */\nclass ChunkUnloadEvent extends ChunkEvent implements Cancellable{\n\tpublic static $handlerList = null;\n}"
  },
  {
    "path": "src/pocketmine/event/level/LevelEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\n/**\n * Level related events\n */\nnamespace pocketmine\\event\\level;\n\nuse pocketmine\\event\\Event;\nuse pocketmine\\level\\Level;\n\nabstract class LevelEvent extends Event{\n\t/** @var \\pocketmine\\level\\Level */\n\tprivate $level;\n\n\t/**\n\t * @param Level $level\n\t */\n\tpublic function __construct(Level $level){\n\t\t$this->level = $level;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\level\\Level\n\t */\n\tpublic function getLevel(){\n\t\treturn $this->level;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/level/LevelInitEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\n/**\n * Called when a Level is initializing\n */\nclass LevelInitEvent extends LevelEvent{\n\tpublic static $handlerList = null;\n}"
  },
  {
    "path": "src/pocketmine/event/level/LevelLoadEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\n/**\n * Called when a Level is loaded\n */\nclass LevelLoadEvent extends LevelEvent{\n\tpublic static $handlerList = null;\n}"
  },
  {
    "path": "src/pocketmine/event/level/LevelSaveEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\n/**\n * Called when a Level is saved\n */\nclass LevelSaveEvent extends LevelEvent{\n\tpublic static $handlerList = null;\n}"
  },
  {
    "path": "src/pocketmine/event/level/LevelUnloadEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\nuse pocketmine\\event\\Cancellable;\n\n/**\n * Called when a Level is unloaded\n */\nclass LevelUnloadEvent extends LevelEvent implements Cancellable{\n\tpublic static $handlerList = null;\n}"
  },
  {
    "path": "src/pocketmine/event/level/SpawnChangeEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\level;\n\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\Position;\n\n/**\n * An event that is called when a level spawn changes.\n * The previous spawn is included\n */\nclass SpawnChangeEvent extends LevelEvent{\n\tpublic static $handlerList = null;\n\n\t/** @var Position */\n\tprivate $previousSpawn;\n\n\t/**\n\t * @param Level    $level\n\t * @param Position $previousSpawn\n\t */\n\tpublic function __construct(Level $level, Position $previousSpawn){\n\t\tparent::__construct($level);\n\t\t$this->previousSpawn = $previousSpawn;\n\t}\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getPreviousSpawn(){\n\t\treturn $this->previousSpawn;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/level/WeatherChangeEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\level;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\weather\\Weather;\n\nclass WeatherChangeEvent extends LevelEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $weather;\n\tprivate $duration;\n\n\tpublic function __construct(Level $level, int $weather, int $duration){\n\t\tparent::__construct($level);\n\t\t$this->weather = $weather;\n\t\t$this->duration = $duration;\n\t}\n\n\tpublic function getWeather() : int{\n\t\treturn $this->weather;\n\t}\n\n\tpublic function setWeather(int $weather = Weather::SUNNY){\n\t\t$this->weather = $weather;\n\t}\n\n\tpublic function getDuration() : int{\n\t\treturn $this->duration;\n\t}\n\n\tpublic function setDuration(int $duration){\n\t\t$this->duration = $duration;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerAchievementAwardedEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a player is awarded an achievement\n */\nclass PlayerAchievementAwardedEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $achievement;\n\n\t/**\n\t * @param Player $player\n\t * @param string $achievementId\n\t */\n\tpublic function __construct(Player $player, $achievementId){\n\t\t$this->player = $player;\n\t\t$this->achievement = $achievementId;\n\t}\n\n\tpublic function getAchievement(){\n\t\treturn $this->achievement;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerAnimationEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a player does an animation\n */\nclass PlayerAnimationEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst ARM_SWING = 1;\n\tconst WAKE_UP = 3;\n\n\tprivate $animationType;\n\n\t/**\n\t * @param Player $player\n\t * @param int    $animation\n\t */\n\tpublic function __construct(Player $player, $animation = self::ARM_SWING){\n\t\t$this->player = $player;\n\t\t$this->animationType = $animation;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getAnimationType(){\n\t\treturn $this->animationType;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/event/player/PlayerBedEnterEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerBedEnterEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $bed;\n\n\tpublic function __construct(Player $player, Block $bed){\n\t\t$this->player = $player;\n\t\t$this->bed = $bed;\n\t}\n\n\tpublic function getBed(){\n\t\treturn $this->bed;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerBedLeaveEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\Player;\n\nclass PlayerBedLeaveEvent extends PlayerEvent{\n\tpublic static $handlerList = null;\n\n\tprivate $bed;\n\n\tpublic function __construct(Player $player, Block $bed){\n\t\t$this->player = $player;\n\t\t$this->bed = $bed;\n\t}\n\n\tpublic function getBed(){\n\t\treturn $this->bed;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerBucketEmptyEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass PlayerBucketEmptyEvent extends PlayerBucketEvent{\n\tpublic static $handlerList = null;\n\n\tpublic function __construct(Player $who, Block $blockClicked, $blockFace, Item $bucket, Item $itemInHand){\n\t\tparent::__construct($who, $blockClicked, $blockFace, $bucket, $itemInHand);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerBucketEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nabstract class PlayerBucketEvent extends PlayerEvent implements Cancellable{\n\n\t/** @var Block */\n\tprivate $blockClicked;\n\t/** @var int */\n\tprivate $blockFace;\n\t/** @var Item */\n\tprivate $bucket;\n\t/** @var Item */\n\tprivate $item;\n\n\t/**\n\t * @param Player $who\n\t * @param Block  $blockClicked\n\t * @param int    $blockFace\n\t * @param Item   $bucket\n\t * @param Item   $itemInHand\n\t */\n\tpublic function __construct(Player $who, Block $blockClicked, $blockFace, Item $bucket, Item $itemInHand){\n\t\t$this->player = $who;\n\t\t$this->blockClicked = $blockClicked;\n\t\t$this->blockFace = (int) $blockFace;\n\t\t$this->item = $itemInHand;\n\t\t$this->bucket = $bucket;\n\t}\n\n\t/**\n\t * Returns the bucket used in this event\n\t *\n\t * @return Item\n\t */\n\tpublic function getBucket(){\n\t\treturn $this->bucket;\n\t}\n\n\t/**\n\t * Returns the item in hand after the event\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n\n\t/**\n\t * @param Item $item\n\t */\n\tpublic function setItem(Item $item){\n\t\t$this->item = $item;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getBlockClicked(){\n\t\treturn $this->blockClicked;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getBlockFace(){\n\t\treturn $this->blockFace;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerBucketFillEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass PlayerBucketFillEvent extends PlayerBucketEvent{\n\tpublic static $handlerList = null;\n\n\tpublic function __construct(Player $who, Block $blockClicked, $blockFace, Item $bucket, Item $itemInHand){\n\t\tparent::__construct($who, $blockClicked, $blockFace, $bucket, $itemInHand);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerChatEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\n/**\n * Called when a player chats something\n */\nclass PlayerChatEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $message;\n\n\t/** @var string */\n\tprotected $format;\n\n\t/**\n\t * @var Player[]\n\t */\n\tprotected $recipients = [];\n\n\tpublic function __construct(Player $player, $message, $format = \"chat.type.text\", array $recipients = null){\n\t\t$this->player = $player;\n\t\t$this->message = $message;\n\n\t\t$this->format = $format;\n\n\t\tif($recipients === null){\n\t\t\t$this->recipients = Server::getInstance()->getPluginManager()->getPermissionSubscriptions(Server::BROADCAST_CHANNEL_USERS);\n\t\t}else{\n\t\t\t$this->recipients = $recipients;\n\t\t}\n\t}\n\n\tpublic function getMessage(){\n\t\treturn $this->message;\n\t}\n\n\tpublic function setMessage($message){\n\t\t$this->message = $message;\n\t}\n\n\t/**\n\t * Changes the player that is sending the message\n\t *\n\t * @param Player $player\n\t */\n\tpublic function setPlayer(Player $player){\n\t\t$this->player = $player;\n\t}\n\n\tpublic function getFormat(){\n\t\treturn $this->format;\n\t}\n\n\tpublic function setFormat($format){\n\t\t$this->format = $format;\n\t}\n\n\tpublic function getRecipients(){\n\t\treturn $this->recipients;\n\t}\n\n\tpublic function setRecipients(array $recipients){\n\t\t$this->recipients = $recipients;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerCommandPreprocessEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a player runs a command or chats, early in the process\n *\n * You don't want to use this except for a few cases like logging commands,\n * blocking commands on certain places, or applying modifiers.\n *\n * The message contains a slash at the start\n */\nclass PlayerCommandPreprocessEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $message;\n\n\n\t/**\n\t * @param Player $player\n\t * @param string $message\n\t */\n\tpublic function __construct(Player $player, $message){\n\t\t$this->player = $player;\n\t\t$this->message = $message;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getMessage(){\n\t\treturn $this->message;\n\t}\n\n\t/**\n\t * @param string $message\n\t */\n\tpublic function setMessage($message){\n\t\t$this->message = $message;\n\t}\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function setPlayer(Player $player){\n\t\t$this->player = $player;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerCreationEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Event;\nuse pocketmine\\network\\SourceInterface;\nuse pocketmine\\Player;\n\n/**\n * Allows the creation of players overriding the base Player class\n */\nclass PlayerCreationEvent extends Event{\n\tpublic static $handlerList = null;\n\n\t/** @var SourceInterface */\n\tprivate $interface;\n\t/** @var mixed */\n\tprivate $clientId;\n\t/** @var string */\n\tprivate $address;\n\t/** @var int */\n\tprivate $port;\n\n\t/** @var Player::class */\n\tprivate $baseClass;\n\t/** @var Player::class */\n\tprivate $playerClass;\n\n\t/**\n\t * @param SourceInterface $interface\n\t * @param Player::class   $baseClass\n\t * @param Player::class   $playerClass\n\t * @param mixed           $clientId\n\t * @param string          $address\n\t * @param int             $port\n\t */\n\tpublic function __construct(SourceInterface $interface, $baseClass, $playerClass, $clientId, $address, $port){\n\t\t$this->interface = $interface;\n\t\t$this->clientId = $clientId;\n\t\t$this->address = $address;\n\t\t$this->port = $port;\n\n\t\tif(!is_a($baseClass, Player::class, true)){\n\t\t\tthrow new \\RuntimeException(\"Base class $baseClass must extend \" . Player::class);\n\t\t}\n\n\t\t$this->baseClass = $baseClass;\n\n\t\tif(!is_a($playerClass, Player::class, true)){\n\t\t\tthrow new \\RuntimeException(\"Class $playerClass must extend \" . Player::class);\n\t\t}\n\n\t\t$this->playerClass = $playerClass;\n\t}\n\n\t/**\n\t * @return SourceInterface\n\t */\n\tpublic function getInterface(){\n\t\treturn $this->interface;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getAddress(){\n\t\treturn $this->address;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getPort(){\n\t\treturn $this->port;\n\t}\n\n\t/**\n\t * @return mixed\n\t */\n\tpublic function getClientId(){\n\t\treturn $this->clientId;\n\t}\n\n\t/**\n\t * @return Player::class\n\t */\n\tpublic function getBaseClass(){\n\t\treturn $this->baseClass;\n\t}\n\n\t/**\n\t * @param Player::class $class\n\t */\n\tpublic function setBaseClass($class){\n\t\tif(!is_a($class, $this->baseClass, true)){\n\t\t\tthrow new \\RuntimeException(\"Base class $class must extend \" . $this->baseClass);\n\t\t}\n\n\t\t$this->baseClass = $class;\n\t}\n\n\t/**\n\t * @return Player::class\n\t */\n\tpublic function getPlayerClass(){\n\t\treturn $this->playerClass;\n\t}\n\n\t/**\n\t * @param Player::class $class\n\t */\n\tpublic function setPlayerClass($class){\n\t\tif(!is_a($class, $this->baseClass, true)){\n\t\t\tthrow new \\RuntimeException(\"Class $class must extend \" . $this->baseClass);\n\t\t}\n\n\t\t$this->playerClass = $class;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerDeathEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\entity\\EntityDeathEvent;\nuse pocketmine\\event\\TextContainer;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass PlayerDeathEvent extends EntityDeathEvent{\n\tpublic static $handlerList = null;\n\n\t/** @var TextContainer|string */\n\tprivate $deathMessage;\n\tprivate $keepInventory = false;\n\tprivate $keepExperience = false;\n\n\t/**\n\t * @param Player               $entity\n\t * @param Item[]               $drops\n\t * @param string|TextContainer $deathMessage\n\t */\n\tpublic function __construct(Player $entity, array $drops, $deathMessage){\n\t\tparent::__construct($entity, $drops);\n\t\t$this->deathMessage = $deathMessage;\n\t}\n\n\t/**\n\t * @return Player\n\t */\n\tpublic function getEntity(){\n\t\treturn $this->entity;\n\t}\n\n\t/**\n\t * @return Player\n\t */\n\tpublic function getPlayer(){\n\t\treturn $this->entity;\n\t}\n\n\t/**\n\t * @return TextContainer|string\n\t */\n\tpublic function getDeathMessage(){\n\t\treturn $this->deathMessage;\n\t}\n\n\t/**\n\t * @param string|TextContainer $deathMessage\n\t */\n\tpublic function setDeathMessage($deathMessage){\n\t\t$this->deathMessage = $deathMessage;\n\t}\n\n\tpublic function getKeepInventory() : bool{\n\t\treturn $this->keepInventory;\n\t}\n\n\tpublic function setKeepInventory(bool $keepInventory){\n\t\t$this->keepInventory = $keepInventory;\n\t}\n\n\tpublic function getKeepExperience() : bool{\n\t\treturn $this->keepExperience;\n\t}\n\n\tpublic function setKeepExperience(bool $keepExperience){\n\t\t$this->keepExperience = $keepExperience;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerDropItemEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\n/**\n * Called when a player tries to drop an item from its hotbar\n */\nclass PlayerDropItemEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Item */\n\tprivate $drop;\n\n\t/**\n\t * @param Player $player\n\t * @param Item   $drop\n\t */\n\tpublic function __construct(Player $player, Item $drop){\n\t\t$this->player = $player;\n\t\t$this->drop = $drop;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getItem(){\n\t\treturn $this->drop;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\n/**\n * Player-only related events\n */\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Event;\n\nabstract class PlayerEvent extends Event{\n\t/** @var \\pocketmine\\Player */\n\tprotected $player;\n\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerExhaustEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\entity\\Human;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerExhaustEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst CAUSE_ATTACK = 1;\n\tconst CAUSE_DAMAGE = 2;\n\tconst CAUSE_MINING = 3;\n\tconst CAUSE_HEALTH_REGEN = 4;\n\tconst CAUSE_POTION = 5;\n\tconst CAUSE_WALKING = 6;\n\tconst CAUSE_SNEAKING = 7;\n\tconst CAUSE_SWIMMING = 8;\n\tconst CAUSE_JUMPING = 10;\n\tconst CAUSE_CUSTOM = 11;\n\n\tconst CAUSE_FLAG_SPRINT = 0x10000;\n\n\t/** @var float */\n\tprivate $amount;\n\n\tpublic function __construct(Human $human, float $amount, int $cause){\n\t\t$this->player = $human;\n\t\t$this->amount = $amount;\n\t}\n\n\t/**\n\t * @return Human|Player\n\t */\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n\n\tpublic function getAmount() : float{\n\t\treturn $this->amount;\n\t}\n\n\tpublic function setAmount(float $amount){\n\t\t$this->amount = $amount;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/player/PlayerExperienceChangeEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\entity\\Human;\n\nclass PlayerExperienceChangeEvent extends PlayerEvent implements Cancellable{\n\t\n\t/** @deprecated */\n\tconst ADD_EXPERIENCE = 0;\n\tconst SET_EXPERIENCE = 1;\n\t\n\tpublic static $handlerList = null;\n\t\n\tpublic $progress;\n\tpublic $expLevel;\n\n\tpublic function __construct(Human $player, int $expLevel, float $progress){\n\t\t$this->progress = $progress;\n\t\t$this->expLevel = $expLevel;\n\t\t$this->player = $player;\n\t}\n\t\n\t/**\n\t * @deprecated This is redundant, and will be removed in the future.\n\t */\n\tpublic function getAction(){\n\t\treturn self::SET_EXPERIENCE;\n\t}\n\n\tpublic function getExpLevel(){\n\t\treturn $this->expLevel;\n\t}\n\n\tpublic function setExpLevel($level){\n\t\t$this->expLevel = $level;\n\t}\n\n\tpublic function getProgress(): float{\n\t\treturn $this->progress;\n\t}\n\t\n\tpublic function setProgress(float $progress){\n\t\t$this->progress = $progress; //errors will be handled internally anyway\n\t}\n\n\tpublic function getExp(){\n\t\treturn Human::getLevelXpRequirement($this->level) * $this->progress;\n\t}\n\n\tpublic function setExp($exp){\n\t\t$this->progress = $exp / Human::getLevelXpRequirement($this->level);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/player/PlayerFishEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\entity\\FishingHook;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\n/**\n * Called when a player uses the fishing rod\n */\nclass PlayerFishEvent extends PlayerEvent implements Cancellable{\n\n\tpublic static $handlerList = null;\n\n\t/** @var Item */\n\tprivate $item;\n\n\t/** @var FishingHook */\n\tprivate $hook;\n\n\t/**\n\t * @param Player $player\n\t * @param Item   $item\n\t * @param        $fishingHook\n\t */\n\tpublic function __construct(Player $player, Item $item, $fishingHook = null){\n\t\t$this->player = $player;\n\t\t$this->item = $item;\n\t\t$this->hook = $fishingHook;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getItem(){\n\t\treturn clone $this->item;\n\t}\n\n\tpublic function getHook(){\n\t\treturn $this->hook;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/player/PlayerGameModeChangeEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a player has its gamemode changed\n */\nclass PlayerGameModeChangeEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var int */\n\tprotected $gamemode;\n\n\tpublic function __construct(Player $player, $newGamemode){\n\t\t$this->player = $player;\n\t\t$this->gamemode = (int) $newGamemode;\n\t}\n\n\tpublic function getNewGamemode(){\n\t\treturn $this->gamemode;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerGlassBottleEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass PlayerGlassBottleEvent extends PlayerEvent implements Cancellable{\n    public static $handlerList = null;\n\n    /** @var Block */\n    private $target;\n    /** @var Item */\n    private $item;\n\n    /**\n     * @param Player $Player\n     * @param Block  $target\n     * @param Item   $itemInHand\n     */\n    public function __construct(Player $Player, Block $target, Item $itemInHand){\n        $this->player = $Player;\n        $this->target = $target;\n        $this->item = $itemInHand;\n    }\n    \n    /**\n     * @return Item\n     */\n    public function getItem(){\n        return $this->item;\n    }\n\n    /**\n     * @param Item $item\n     */\n    public function setItem(Item $item){\n        $this->item = $item;\n    }\n\n    /**\n     * @return Block\n     */\n    public function getBlock(){\n        return $this->target;\n    }\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerHungerChangeEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerHungerChangeEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\t\n\tpublic $data;\n\n\tpublic function __construct(Player $player, $data){\n\t\t$this->data = $data;\n\t\t$this->player = $player;\n\t}\n\t\n\tpublic function getData(){\n\t\treturn $this->data;\n\t}\n\t\n\tpublic function setData($data){\n\t\t$this->data = $data;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/event/player/PlayerInteractEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Position;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\n\n/**\n * Called when a player interacts or touches a block (including air?)\n */\nclass PlayerInteractEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst LEFT_CLICK_BLOCK = 0;\n\tconst RIGHT_CLICK_BLOCK = 1;\n\tconst LEFT_CLICK_AIR = 2;\n\tconst RIGHT_CLICK_AIR = 3;\n\tconst PHYSICAL = 4;\n\n\t/**\n\t * @var \\pocketmine\\block\\Block;\n\t */\n\tprotected $blockTouched;\n\n\tprotected $touchVector;\n\n\t/** @var int */\n\tprotected $blockFace;\n\n\t/** @var \\pocketmine\\item\\Item */\n\tprotected $item;\n\t\n\tprotected $action;\n\n\tpublic function __construct(Player $player, Item $item, Vector3 $block, $face, $action = PlayerInteractEvent::RIGHT_CLICK_BLOCK){\n\t\tif($block instanceof Block){\n\t\t\t$this->blockTouched = $block;\n\t\t\t$this->touchVector = new Vector3(0, 0, 0);\n\t\t}else{\n\t\t\t$this->touchVector = $block;\n\t\t\t$this->blockTouched = Block::get(0, 0, new Position(0, 0, 0, $player->level));\n\t\t}\n\t\t$this->player = $player;\n\t\t$this->item = $item;\n\t\t$this->blockFace = (int) $face;\n\t\t$this->action = (int) $action;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getAction(){\n\t\treturn $this->action;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n\n\t/**\n\t * @return Block\n\t */\n\tpublic function getBlock(){\n\t\treturn $this->blockTouched;\n\t}\n\n\t/**\n\t * @return Vector3\n\t */\n\tpublic function getTouchVector(){\n\t\treturn $this->touchVector;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getFace(){\n\t\treturn $this->blockFace;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/player/PlayerItemConsumeEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\n/**\n * Called when a player eats something\n */\nclass PlayerItemConsumeEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var Item */\n\tprivate $item;\n\n\t/**\n\t * @param Player $player\n\t * @param Item   $item\n\t */\n\tpublic function __construct(Player $player, Item $item){\n\t\t$this->player = $player;\n\t\t$this->item = $item;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getItem(){\n\t\treturn clone $this->item;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerItemHeldEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass PlayerItemHeldEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $item;\n\tprivate $slot;\n\tprivate $inventorySlot;\n\n\tpublic function __construct(Player $player, Item $item, $inventorySlot, $slot){\n\t\t$this->player = $player;\n\t\t$this->item = $item;\n\t\t$this->inventorySlot = (int) $inventorySlot;\n\t\t$this->slot = (int) $slot;\n\t}\n\n\tpublic function getSlot(){\n\t\treturn $this->slot;\n\t}\n\n\tpublic function getInventorySlot(){\n\t\treturn $this->inventorySlot;\n\t}\n\n\tpublic function getItem(){\n\t\treturn $this->item;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerJoinEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\TextContainer;\nuse pocketmine\\Player;\n\n/**\n * Called when a player joins the server, after sending all the spawn packets\n */\nclass PlayerJoinEvent extends PlayerEvent{\n\tpublic static $handlerList = null;\n\n\t/** @var string|TextContainer */\n\tprotected $joinMessage;\n\n\tpublic function __construct(Player $player, $joinMessage){\n\t\t$this->player = $player;\n\t\t$this->joinMessage = $joinMessage;\n\t}\n\n\t/**\n\t * @param string|TextContainer $joinMessage\n\t */\n\tpublic function setJoinMessage($joinMessage){\n\t\t$this->joinMessage = $joinMessage;\n\t}\n\n\t/**\n\t * @return string|TextContainer\n\t */\n\tpublic function getJoinMessage(){\n\t\treturn $this->joinMessage;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerKickEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a player leaves the server\n */\nclass PlayerKickEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $quitMessage;\n\n\t/** @var string */\n\tprotected $reason;\n\n\tpublic function __construct(Player $player, $reason, $quitMessage){\n\t\t$this->player = $player;\n\t\t$this->quitMessage = $quitMessage;\n\t\t$this->reason = $reason;\n\t}\n\n\tpublic function getReason(){\n\t\treturn $this->reason;\n\t}\n\n\tpublic function setQuitMessage($quitMessage){\n\t\t$this->quitMessage = $quitMessage;\n\t}\n\n\tpublic function getQuitMessage(){\n\t\treturn $this->quitMessage;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerLoginEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a player joins, after things have been correctly set up (you can change anything now)\n */\nclass PlayerLoginEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $kickMessage;\n\n\tpublic function __construct(Player $player, $kickMessage){\n\t\t$this->player = $player;\n\t\t$this->kickMessage = $kickMessage;\n\t}\n\n\tpublic function setKickMessage($kickMessage){\n\t\t$this->kickMessage = $kickMessage;\n\t}\n\n\tpublic function getKickMessage(){\n\t\treturn $this->kickMessage;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerMoveEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\level\\Location;\nuse pocketmine\\Player;\n\nclass PlayerMoveEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $from;\n\tprivate $to;\n\n\tpublic function __construct(Player $player, Location $from, Location $to){\n\t\t$this->player = $player;\n\t\t$this->from = $from;\n\t\t$this->to = $to;\n\t}\n\n\tpublic function getFrom(){\n\t\treturn $this->from;\n\t}\n\n\tpublic function setFrom(Location $from){\n\t\t$this->from = $from;\n\t}\n\n\tpublic function getTo(){\n\t\treturn $this->to;\n\t}\n\n\tpublic function setTo(Location $to){\n\t\t$this->to = $to;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerPickupExpOrbEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerPickupExpOrbEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $amount;\n\n\tpublic function __construct(Player $p, int $amount = 0){\n\t\t$this->player = $p;\n\t\t$this->amount = $amount;\n\t}\n\n\tpublic function getAmount() : int{\n\t\treturn $this->amount;\n\t}\n\n\tpublic function setAmount(int $amount){\n\t\t$this->amount = $amount;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerPreLoginEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when the player logs in, before things have been set up\n */\nclass PlayerPreLoginEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $kickMessage;\n\n\tpublic function __construct(Player $player, $kickMessage){\n\t\t$this->player = $player;\n\t\t$this->kickMessage = $kickMessage;\n\t}\n\n\tpublic function setKickMessage($kickMessage){\n\t\t$this->kickMessage = $kickMessage;\n\t}\n\n\tpublic function getKickMessage(){\n\t\treturn $this->kickMessage;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerQuitEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\Player;\n\n/**\n * Called when a player leaves the server\n */\nclass PlayerQuitEvent extends PlayerEvent{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $quitMessage;\n\tprotected $autoSave = true;\n\n\tpublic function __construct(Player $player, $quitMessage, $autoSave = true){\n\t\t$this->player = $player;\n\t\t$this->quitMessage = $quitMessage;\n\t\t$this->autoSave = $autoSave;\n\t}\n\n\tpublic function setQuitMessage($quitMessage){\n\t\t$this->quitMessage = $quitMessage;\n\t}\n\n\tpublic function getQuitMessage(){\n\t\treturn $this->quitMessage;\n\t}\n\n\tpublic function getAutoSave(){\n\t\treturn $this->autoSave;\n\t}\n\n\tpublic function setAutoSave($value = true){\n\t\t$this->autoSave = (bool) $value;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerRespawnEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\level\\Position;\nuse pocketmine\\Player;\n\n/**\n * Called when a player is respawned (or first time spawned)\n */\nclass PlayerRespawnEvent extends PlayerEvent{\n\tpublic static $handlerList = null;\n\n\t/** @var Position */\n\tprotected $position;\n\n\t/**\n\t * @param Player   $player\n\t * @param Position $position\n\t */\n\tpublic function __construct(Player $player, Position $position){\n\t\t$this->player = $player;\n\t\t$this->position = $position;\n\t}\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getRespawnPosition(){\n\t\treturn $this->position;\n\t}\n\n\t/**\n\t * @param Position $position\n\t */\n\tpublic function setRespawnPosition(Position $position){\n\t\t$this->position = $position;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerTextPreSendEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\n/**\n * Called when a player is sent a message via sendMessage, sendPopup or sendTip\n */\nclass PlayerTextPreSendEvent extends PlayerEvent implements Cancellable{\n\tconst MESSAGE = 0;\n\tconst POPUP = 1;\n\tconst TIP = 2;\n\tconst TRANSLATED_MESSAGE = 3;\n\n\tpublic static $handlerList = null;\n\n\tprotected $message;\n\tprotected $type = self::MESSAGE;\n\n\tpublic function __construct(Player $player, $message, $type = self::MESSAGE){\n\t\t$this->player = $player;\n\t\t$this->message = $message;\n\t\t$this->type = $type;\n\t}\n\n\tpublic function getMessage(){\n\t\treturn $this->message;\n\t}\n\n\tpublic function setMessage($message){\n\t\t$this->message = $message;\n\t}\n\n\tpublic function getType(){\n\t\treturn $this->type;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/event/player/PlayerToggleFlightEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerToggleFlightEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var bool */\n\tprotected $isFlying;\n\n\tpublic function __construct(Player $player, $isFlying){\n\t\t$this->player = $player;\n\t\t$this->isFlying = (bool) $isFlying;\n\t}\n\n\tpublic function isFlying(){\n\t\treturn $this->isFlying;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerToggleGlideEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerToggleGlideEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var bool */\n\tprotected $isGliding;\n\n\tpublic function __construct(Player $player, $isGliding){\n\t\t$this->player = $player;\n\t\t$this->isGliding = (bool) $isGliding;\n\t}\n\n\tpublic function isGliding(){\n\t\treturn $this->isGliding;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerToggleSneakEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerToggleSneakEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var bool */\n\tprotected $isSneaking;\n\n\tpublic function __construct(Player $player, $isSneaking){\n\t\t$this->player = $player;\n\t\t$this->isSneaking = (bool) $isSneaking;\n\t}\n\n\tpublic function isSneaking(){\n\t\treturn $this->isSneaking;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerToggleSprintEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerToggleSprintEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var bool */\n\tprotected $isSprinting;\n\n\tpublic function __construct(Player $player, $isSprinting){\n\t\t$this->player = $player;\n\t\t$this->isSprinting = (bool) $isSprinting;\n\t}\n\n\tpublic function isSprinting(){\n\t\treturn $this->isSprinting;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/player/PlayerUseFishingRodEvent.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\event\\player;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\Player;\n\nclass PlayerUseFishingRodEvent extends PlayerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tconst ACTION_START_FISHING = 0;\n\tconst ACTION_STOP_FISHING = 1;\n\n\tprivate $action;\n\n\tpublic function __construct(Player $player, int $action = PlayerUseFishingRodEvent::ACTION_START_FISHING){\n\t\t$this->player = $player;\n\t\t$this->action = $action;\n\t}\n\n\tpublic function getAction() : int{\n\t\treturn $this->action;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/plugin/PluginDisableEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n\nnamespace pocketmine\\event\\plugin;\n\nuse pocketmine\\plugin\\Plugin;\n\n\nclass PluginDisableEvent extends PluginEvent{\n\tpublic static $handlerList = null;\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function __construct(Plugin $plugin){\n\t\tparent::__construct($plugin);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/plugin/PluginEnableEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n\nnamespace pocketmine\\event\\plugin;\n\nuse pocketmine\\plugin\\Plugin;\n\n\nclass PluginEnableEvent extends PluginEvent{\n\tpublic static $handlerList = null;\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function __construct(Plugin $plugin){\n\t\tparent::__construct($plugin);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/plugin/PluginEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Events related Plugin enable / disable events\n */\nnamespace pocketmine\\event\\plugin;\n\nuse pocketmine\\event\\Event;\nuse pocketmine\\plugin\\Plugin;\n\n\nabstract class PluginEvent extends Event{\n\n\t/** @var Plugin */\n\tprivate $plugin;\n\n\tpublic function __construct(Plugin $plugin){\n\t\t$this->plugin = $plugin;\n\t}\n\n\t/**\n\t * @return Plugin\n\t */\n\tpublic function getPlugin(){\n\t\treturn $this->plugin;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/event/server/DataPacketReceiveEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\server;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\Player;\n\nclass DataPacketReceiveEvent extends ServerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $packet;\n\tprivate $player;\n\n\tpublic function __construct(Player $player, DataPacket $packet){\n\t\t$this->packet = $packet;\n\t\t$this->player = $player;\n\t}\n\n\tpublic function getPacket(){\n\t\treturn $this->packet;\n\t}\n\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/server/DataPacketSendEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\server;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\Player;\n\nclass DataPacketSendEvent extends ServerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\tprivate $packet;\n\tprivate $player;\n\n\tpublic function __construct(Player $player, DataPacket $packet){\n\t\t$this->packet = $packet;\n\t\t$this->player = $player;\n\t}\n\n\tpublic function getPacket(){\n\t\treturn $this->packet;\n\t}\n\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/event/server/LowMemoryEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\server;\nuse pocketmine\\utils\\Utils;\n\n\n/**\n * Called when the server is in a low-memory state as defined by the properties\n * Plugins should free caches or other non-essential data.\n */\nclass LowMemoryEvent extends ServerEvent{\n\tpublic static $handlerList = null;\n\n\tprivate $memory;\n\tprivate $memoryLimit;\n\tprivate $triggerCount;\n\tprivate $global;\n\n\tpublic function __construct($memory, $memoryLimit, $isGlobal = false, $triggerCount = 0){\n\t\t$this->memory = $memory;\n\t\t$this->memoryLimit = $memoryLimit;\n\t\t$this->global = (bool) $isGlobal;\n\t\t$this->triggerCount = (int) $triggerCount;\n\t}\n\n\t/**\n\t * Returns the memory usage at the time of the event call (in bytes)\n\t *\n\t * @return int\n\t */\n\tpublic function getMemory(){\n\t\treturn $this->memory;\n\t}\n\n\t/**\n\t * Returns the memory limit defined (in bytes)\n\t *\n\t * @return int\n\t */\n\tpublic function getMemoryLimit(){\n\t\treturn $this->memory;\n\t}\n\n\t/**\n\t * Returns the times this event has been called in the current low-memory state\n\t *\n\t * @return int\n\t */\n\tpublic function getTriggerCount(){\n\t\treturn $this->triggerCount;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isGlobal(){\n\t\treturn $this->global;\n\t}\n\n\t/**\n\t * Amount of memory already freed\n\t *\n\t * @return int\n\t */\n\tpublic function getMemoryFreed(){\n\t\treturn $this->getMemory() - ($this->isGlobal() ? Utils::getMemoryUsage(true)[1] : Utils::getMemoryUsage(true)[0]);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/server/QueryRegenerateEvent.php",
    "content": "<?php\n\n/**\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\server;\n\nuse pocketmine\\Server;\nuse pocketmine\\utils\\Binary;\n\nclass QueryRegenerateEvent extends ServerEvent{\n\tpublic static $handlerList = null;\n\n\tconst GAME_ID = \"MINECRAFTPE\";\n\n\tprivate $timeout;\n\tprivate $serverName;\n\tprivate $listPlugins;\n\t/** @var \\pocketmine\\plugin\\Plugin[] */\n\tprivate $plugins;\n\t/** @var \\pocketmine\\Player[] */\n\tprivate $players;\n\n\tprivate $gametype;\n\tprivate $version;\n\tprivate $server_engine;\n\tprivate $map;\n\tprivate $numPlayers;\n\tprivate $maxPlayers;\n\tprivate $whitelist;\n\tprivate $port;\n\tprivate $ip;\n\n\tprivate $extraData = [];\n\n\n\tpublic function __construct(Server $server, $timeout = 5){\n\t\t$this->timeout = $timeout;\n\t\t$this->serverName = $server->getMotd();\n\t\t$this->listPlugins = $server->getProperty(\"settings.query-plugins\", true);\n\t\t$this->plugins = $server->getPluginManager()->getPlugins();\n\t\t$this->players = [];\n\t\tforeach($server->getOnlinePlayers() as $player){\n\t\t\tif($player->isOnline()){\n\t\t\t\t$this->players[] = $player;\n\t\t\t}\n\t\t}\n\n\t\tif($server->isDServerEnabled() and $server->dserverConfig[\"queryMaxPlayers\"]) $pc = $server->dserverConfig[\"queryMaxPlayers\"];\n\t\telseif($server->isDServerEnabled() and $server->dserverConfig[\"queryAllPlayers\"]) $pc = $server->getDServerMaxPlayers();\n\t\telse $pc = $server->getMaxPlayers();\n\n\t\tif($server->isDServerEnabled() and $server->dserverConfig[\"queryPlayers\"]) $poc = $server->getDServerOnlinePlayers();\n\t\telse $poc = count($this->players);\n\n\t\t$this->gametype = ($server->getGamemode() & 0x01) === 0 ? \"SMP\" : \"CMP\";\n\t\t$this->version = $server->getVersion();\n\t\t$this->server_engine = $server->getName() . \" \" . $server->getPocketMineVersion();\n\t\t$this->map = $server->getDefaultLevel() === null ? \"unknown\" : $server->getDefaultLevel()->getName();\n\t\t$this->numPlayers = $poc;\n\t\t$this->maxPlayers = $pc;\n\t\t$this->whitelist = $server->hasWhitelist() ? \"on\" : \"off\";\n\t\t$this->port = $server->getPort();\n\t\t$this->ip = $server->getIp();\n\n\t}\n\n\t/**\n\t * Gets the min. timeout for Query Regeneration\n\t *\n\t * @return int\n\t */\n\tpublic function getTimeout(){\n\t\treturn $this->timeout;\n\t}\n\n\tpublic function setTimeout($timeout){\n\t\t$this->timeout = $timeout;\n\t}\n\n\tpublic function getServerName(){\n\t\treturn $this->serverName;\n\t}\n\n\tpublic function setServerName($serverName){\n\t\t$this->serverName = $serverName;\n\t}\n\n\tpublic function canListPlugins(){\n\t\treturn $this->listPlugins;\n\t}\n\n\tpublic function setListPlugins($value){\n\t\t$this->listPlugins = (bool) $value;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\plugin\\Plugin[]\n\t */\n\tpublic function getPlugins(){\n\t\treturn $this->plugins;\n\t}\n\n\t/**\n\t * @param \\pocketmine\\plugin\\Plugin[] $plugins\n\t */\n\tpublic function setPlugins(array $plugins){\n\t\t$this->plugins = $plugins;\n\t}\n\n\t/**\n\t * @return \\pocketmine\\Player[]\n\t */\n\tpublic function getPlayerList(){\n\t\treturn $this->players;\n\t}\n\n\t/**\n\t * @param \\pocketmine\\Player[] $players\n\t */\n\tpublic function setPlayerList(array $players){\n\t\t$this->players = $players;\n\t}\n\n\tpublic function getPlayerCount(){\n\t\treturn $this->numPlayers;\n\t}\n\n\tpublic function setPlayerCount($count){\n\t\t$this->numPlayers = (int) $count;\n\t}\n\n\tpublic function getMaxPlayerCount(){\n\t\treturn $this->maxPlayers;\n\t}\n\n\tpublic function setMaxPlayerCount($count){\n\t\t$this->maxPlayers = (int) $count;\n\t}\n\n\tpublic function getWorld(){\n\t\treturn $this->map;\n\t}\n\n\tpublic function setWorld($world){\n\t\t$this->map = (string) $world;\n\t}\n\n\t/**\n\t * Returns the extra Query data in key => value form\n\t *\n\t * @return array\n\t */\n\tpublic function getExtraData(){\n\t\treturn $this->extraData;\n\t}\n\n\tpublic function setExtraData(array $extraData){\n\t\t$this->extraData = $extraData;\n\t}\n\n\tpublic function getLongQuery(){\n\t\t$query = \"\";\n\n\t\t$plist = $this->server_engine;\n\t\tif(count($this->plugins) > 0 and $this->listPlugins){\n\t\t\t$plist .= \":\";\n\t\t\tforeach($this->plugins as $p){\n\t\t\t\t$d = $p->getDescription();\n\t\t\t\t$plist .= \" \" . str_replace([\";\", \":\", \" \"], [\"\", \"\", \"_\"], $d->getName()) . \" \" . str_replace([\";\", \":\", \" \"], [\"\", \"\", \"_\"], $d->getVersion()) . \";\";\n\t\t\t}\n\t\t\t$plist = substr($plist, 0, -1);\n\t\t}\n\n\t\t$KVdata = [\n\t\t\t\"splitnum\" => chr(128),\n\t\t\t\"hostname\" => $this->serverName,\n\t\t\t\"gametype\" => $this->gametype,\n\t\t\t\"game_id\" => self::GAME_ID,\n\t\t\t\"version\" => $this->version,\n\t\t\t\"server_engine\" => $this->server_engine,\n\t\t\t\"plugins\" => $plist,\n\t\t\t\"map\" => $this->map,\n\t\t\t\"numplayers\" => $this->numPlayers,\n\t\t\t\"maxplayers\" => $this->maxPlayers,\n\t\t\t\"whitelist\" => $this->whitelist,\n\t\t\t\"hostip\" => $this->ip,\n\t\t\t\"hostport\" => $this->port\n\t\t];\n\n\t\tforeach($KVdata as $key => $value){\n\t\t\t$query .= $key . \"\\x00\" . $value . \"\\x00\";\n\t\t}\n\n\t\tforeach($this->extraData as $key => $value){\n\t\t\t$query .= $key . \"\\x00\" . $value . \"\\x00\";\n\t\t}\n\n\t\t$query .= \"\\x00\\x01player_\\x00\\x00\";\n\t\tforeach($this->players as $player){\n\t\t\t$query .= $player->getName() . \"\\x00\";\n\t\t}\n\t\t$query .= \"\\x00\";\n\n\t\treturn $query;\n\t}\n\n\tpublic function getShortQuery(){\n\t\treturn $this->serverName . \"\\x00\" . $this->gametype . \"\\x00\" . $this->map . \"\\x00\" . $this->numPlayers . \"\\x00\" . $this->maxPlayers . \"\\x00\" . Binary::writeLShort($this->port) . $this->ip . \"\\x00\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/server/RemoteServerCommandEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\server;\n\nuse pocketmine\\command\\CommandSender;\n\n/**\n * This event is called when a command is received over RCON.\n */\nclass RemoteServerCommandEvent extends ServerCommandEvent{\n\tpublic static $handlerList = null;\n\n\t/**\n\t * @param CommandSender $sender\n\t * @param string        $command\n\t */\n\tpublic function __construct(CommandSender $sender, $command){\n\t\tparent::__construct($sender, $command);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/server/ServerCommandEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\nnamespace pocketmine\\event\\server;\n\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\event\\Cancellable;\n\n/**\n * Called when the console runs a command, early in the process\n *\n * You don't want to use this except for a few cases like logging commands,\n * blocking commands on certain places, or applying modifiers.\n *\n * The message contains a slash at the start\n */\nclass ServerCommandEvent extends ServerEvent implements Cancellable{\n\tpublic static $handlerList = null;\n\n\t/** @var string */\n\tprotected $command;\n\n\t/** @var CommandSender */\n\tprotected $sender;\n\n\t/**\n\t * @param CommandSender $sender\n\t * @param string        $command\n\t */\n\tpublic function __construct(CommandSender $sender, $command){\n\t\t$this->sender = $sender;\n\t\t$this->command = $command;\n\t}\n\n\t/**\n\t * @return CommandSender\n\t */\n\tpublic function getSender(){\n\t\treturn $this->sender;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getCommand(){\n\t\treturn $this->command;\n\t}\n\n\t/**\n\t * @param string $command\n\t */\n\tpublic function setCommand($command){\n\t\t$this->command = $command;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/event/server/ServerEvent.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link   http://www.pocketmine.net/\n *\n *\n */\n\n/**\n * Events related to the server core, like networking, stop, level loading\n */\nnamespace pocketmine\\event\\server;\n\nuse pocketmine\\event\\Event;\n\nabstract class ServerEvent extends Event{\n\n}"
  },
  {
    "path": "src/pocketmine/inventory/AnvilInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Position;\nuse pocketmine\\Player;\n\nclass AnvilInventory extends TemporaryInventory{\n\n\tconst TARGET = 0;\n\tconst SACRIFICE = 1;\n\tconst RESULT = 2;\n\n\n\tpublic function __construct(Position $pos){\n\t\tparent::__construct(new FakeBlockMenu($this, $pos), InventoryType::get(InventoryType::ANVIL));\n\t}\n\n\t/**\n\t * @return FakeBlockMenu\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n\n\tpublic function getResultSlotIndex(){\n\t\treturn self::RESULT;\n\t}\n\n\tpublic function onRename(Player $player, Item $resultItem) : bool{\n\t\tif(!$resultItem->deepEquals($this->getItem(self::TARGET), true, false, true)){\n\t\t\t//Item does not match target item. Everything must match except the tags.\n\t\t\treturn false;\n\t\t}\n\n\t\tif($player->getXpLevel() < $resultItem->getRepairCost()){ //Not enough exp\n\t\t\treturn false;\n\t\t}\n\t\t$player->takeXpLevel($resultItem->getRepairCost());\n\t\t\n\t\t$this->clearAll();\n\t\tif(!$player->getServer()->allowInventoryCheats and !$player->isCreative()){\n\t\t\tif(!$player->getFloatingInventory()->canAddItem($resultItem)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$player->getFloatingInventory()->addItem($resultItem);\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function processSlotChange(Transaction $transaction): bool{\n\t\tif($transaction->getSlot() === $this->getResultSlotIndex()){\n\t\t\treturn false;\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function onSlotChange($index, $before, $send){\n\t\t//Do not send anvil slot updates to anyone. This will cause a client crash.\n\t}\n\n\tpublic function onClose(Player $who){\n\t\tparent::onClose($who);\n\n\t\t$this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem(0));\n\t\t$this->getHolder()->getLevel()->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem(1));\n\t\t$this->clear(0);\n\t\t$this->clear(1);\n\t\t$this->clear(2);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/inventory/BaseInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\entity\\EntityInventoryChangeEvent;\nuse pocketmine\\event\\inventory\\InventoryOpenEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\ContainerSetContentPacket;\nuse pocketmine\\network\\protocol\\ContainerSetSlotPacket;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nabstract class BaseInventory implements Inventory{\n\n\t/** @var InventoryType */\n\tprotected $type;\n\t/** @var int */\n\tprotected $maxStackSize = Inventory::MAX_STACK;\n\t/** @var int */\n\tprotected $size;\n\t/** @var string */\n\tprotected $name;\n\t/** @var string */\n\tprotected $title;\n\t/** @var Item[] */\n\tprotected $slots = [];\n\t/** @var Player[] */\n\tprotected $viewers = [];\n\t/** @var InventoryHolder */\n\tprotected $holder;\n\n\t/**\n\t * @param InventoryHolder $holder\n\t * @param InventoryType   $type\n\t * @param Item[]          $items\n\t * @param int             $overrideSize\n\t * @param string          $overrideTitle\n\t */\n\tpublic function __construct(InventoryHolder $holder, InventoryType $type, array $items = [], $overrideSize = null, $overrideTitle = null){\n\t\t$this->holder = $holder;\n\n\t\t$this->type = $type;\n\t\tif($overrideSize !== null){\n\t\t\t$this->size = (int) $overrideSize;\n\t\t}else{\n\t\t\t$this->size = $this->type->getDefaultSize();\n\t\t}\n\n\t\tif($overrideTitle !== null){\n\t\t\t$this->title = $overrideTitle;\n\t\t}else{\n\t\t\t$this->title = $this->type->getDefaultTitle();\n\t\t}\n\n\t\t$this->name = $this->type->getDefaultTitle();\n\n\t\t$this->setContents($items);\n\t}\n\n\tpublic function __destruct(){\n\t\t$this->holder = null;\n\t\t$this->slots = [];\n\t}\n\n\tpublic function getSize(){\n\t\treturn $this->size;\n\t}\n\n\tpublic function getHotbarSize(){\n\t\treturn 0;\n\t}\n\n\tpublic function setSize($size){\n\t\t$this->size = (int) $size;\n\t}\n\n\tpublic function getMaxStackSize(){\n\t\treturn $this->maxStackSize;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->name;\n\t}\n\n\tpublic function getTitle(){\n\t\treturn $this->title;\n\t}\n\n\tpublic function getItem($index){\n\t\treturn isset($this->slots[$index]) ? clone $this->slots[$index] : Item::get(Item::AIR, 0, 0);\n\t}\n\n\tpublic function getContents(){\n\t\treturn $this->slots;\n\t}\n\n\t/**\n\t * @param Item[] $items\n\t */\n\tpublic function setContents(array $items, $send = true){\n\t\tif(count($items) > $this->size){\n\t\t\t$items = array_slice($items, 0, $this->size, true);\n\t\t}\n\n\t\tfor($i = 0; $i < $this->size; ++$i){\n\t\t\tif(!isset($items[$i])){\n\t\t\t\tif(isset($this->slots[$i])){\n\t\t\t\t\t$this->clear($i, $send);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif (!$this->setItem($i, $items[$i], $send)){\n\t\t\t\t\t$this->clear($i, $send);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function setItem($index, Item $item, $send = true){\n\t\t$item = clone $item;\n\t\tif($index < 0 or $index >= $this->size){\n\t\t\treturn false;\n\t\t}elseif($item->getId() === 0 or $item->getCount() <= 0){\n\t\t\treturn $this->clear($index, $send);\n\t\t}\n\n\t\t$holder = $this->getHolder();\n\t\tif($holder instanceof Entity){\n\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($holder, $this->getItem($index), $item, $index));\n\t\t\tif($ev->isCancelled()){\n\t\t\t\t$this->sendSlot($index, $this->getViewers());\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$item = $ev->getNewItem();\n\t\t}\n\n\t\t$old = $this->getItem($index);\n\t\t$this->slots[$index] = clone $item;\n\t\t$this->onSlotChange($index, $old, $send);\n\n\n\t\treturn true;\n\t}\n\n\tpublic function contains(Item $item){\n\t\t$count = max(1, $item->getCount());\n\t\t$checkDamage = !$item->hasAnyDamageValue();\n\t\t$checkTags = $item->getCompoundTag();\n\t\tforeach($this->getContents() as $i){\n\t\t\tif($item->equals($i, $checkDamage, $checkTags)){\n\t\t\t\t$count -= $i->getCount();\n\t\t\t\tif($count <= 0){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function slotContains($slot, Item $item, $matchCount = false){\n\t\tif($matchCount){\n\t\t\treturn $this->getItem($slot)->deepEquals($item, true, true, true);\n\t\t}else{\n\t\t\treturn $this->getItem($slot)->deepEquals($item) and $this->getItem($slot)->getCount() >= $item->getCount();\n\t\t}\n\t}\n\n\tpublic function all(Item $item){\n\t\t$slots = [];\n\t\t$checkDamage = !$item->hasAnyDamageValue() ;\n\t\t$checkTags = $item->getCompoundTag();\n\t\tforeach($this->getContents() as $index => $i){\n\t\t\tif($item->equals($i, $checkDamage, $checkTags)){\n\t\t\t\t$slots[$index] = $i;\n\t\t\t}\n\t\t}\n\n\t\treturn $slots;\n\t}\n\n\tpublic function remove(Item $item, $send = true){\n\t\t$checkDamage = !$item->hasAnyDamageValue() ;\n\t\t$checkTags = $item->getCompoundTag();\n\t\t$checkCount = $item->getCount() === null ? false : true;\n\n\t\tforeach($this->getContents() as $index => $i){\n\t\t\tif($item->equals($i, $checkDamage, $checkTags, $checkCount)){\n\t\t\t\t$this->clear($index, $send);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function first(Item $item){\n\t\t$count = max(1, $item->getCount());\n\t\t$checkDamage = !$item->hasAnyDamageValue();\n\t\t$checkTags = $item->getCompoundTag();\n\n\t\tforeach($this->getContents() as $index => $i){\n\t\t\tif($item->equals($i, $checkDamage, $checkTags) and $i->getCount() >= $count){\n\t\t\t\treturn $index;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\tpublic function firstEmpty(){\n\t\tfor($i = 0; $i < $this->size; ++$i){\n\t\t\tif($this->getItem($i)->getId() === Item::AIR){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\t\n\tpublic function firstOccupied(){\n\t\tfor($i = 0; $i < $this->size; $i++){\n\t\t\tif(($item = $this->getItem($i))->getId() !== Item::AIR and $item->getCount() > 0){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t}\n\t\treturn -1;\n\t}\n\n\tpublic function canAddItem(Item $item){\n\t\t$item = clone $item;\n\t\t$checkDamage = $item->hasAnyDamageValue() ;\n\t\t$checkTags = $item->getCompoundTag();\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$slot = $this->getItem($i);\n\t\t\tif($item->equals($slot, $checkDamage, $checkTags)){\n\t\t\t\tif(($diff = $slot->getMaxStackSize() - $slot->getCount()) > 0){\n\t\t\t\t\t$item->setCount($item->getCount() - $diff);\n\t\t\t\t}\n\t\t\t}elseif($slot->getId() === Item::AIR){\n\t\t\t\t$item->setCount($item->getCount() - $this->getMaxStackSize());\n\t\t\t}\n\n\t\t\tif($item->getCount() <= 0){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function addItem(...$slots){\n\t\t/** @var Item[] $itemSlots */\n\t\t/** @var Item[] $slots */\n\t\t$itemSlots = [];\n\t\tforeach($slots as $slot){\n\t\t\tif(!($slot instanceof Item)){\n\t\t\t\tthrow new \\InvalidArgumentException(\"Expected Item, got \".gettype($slot));\n\t\t\t}\n\t\t\tif($slot->getId() !== 0 and $slot->getCount() > 0){\n\t\t\t\t$itemSlots[] = clone $slot;\n\t\t\t}\n\t\t}\n\n\t\t$emptySlots = [];\n\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$item = $this->getItem($i);\n\t\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\t\t$emptySlots[] = $i;\n\t\t\t}\n\n\t\t\tforeach($itemSlots as $index => $slot){\n\t\t\t\tif($slot->equals($item) and $item->getCount() < $item->getMaxStackSize()){\n\t\t\t\t\t$amount = min($item->getMaxStackSize() - $item->getCount(), $slot->getCount(), $this->getMaxStackSize());\n\t\t\t\t\tif($amount > 0){\n\t\t\t\t\t\t$slot->setCount($slot->getCount() - $amount);\n\t\t\t\t\t\t$item->setCount($item->getCount() + $amount);\n\t\t\t\t\t\t$this->setItem($i, $item);\n\t\t\t\t\t\tif($slot->getCount() <= 0){\n\t\t\t\t\t\t\tunset($itemSlots[$index]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(count($itemSlots) === 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(count($itemSlots) > 0 and count($emptySlots) > 0){\n\t\t\tforeach($emptySlots as $slotIndex){\n\t\t\t\t//This loop only gets the first item, then goes to the next empty slot\n\t\t\t\tforeach($itemSlots as $index => $slot){\n\t\t\t\t\t$amount = min($slot->getMaxStackSize(), $slot->getCount(), $this->getMaxStackSize());\n\t\t\t\t\t$slot->setCount($slot->getCount() - $amount);\n\t\t\t\t\t$item = clone $slot;\n\t\t\t\t\t$item->setCount($amount);\n\t\t\t\t\t$this->setItem($slotIndex, $item);\n\t\t\t\t\tif($slot->getCount() <= 0){\n\t\t\t\t\t\tunset($itemSlots[$index]);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $itemSlots;\n\t}\n\n\tpublic function removeItem(...$slots){\n\t\t/** @var Item[] $itemSlots */\n\t\t/** @var Item[] $slots */\n\t\t$itemSlots = [];\n\t\tforeach($slots as $slot){\n\t\t\tif(!($slot instanceof Item)){\n\t\t\t\tthrow new \\InvalidArgumentException(\"Expected Item[], got \".gettype($slot));\n\t\t\t}\n\t\t\tif($slot->getId() !== 0 and $slot->getCount() > 0){\n\t\t\t\t$itemSlots[] = clone $slot;\n\t\t\t}\n\t\t}\n\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$item = $this->getItem($i);\n\t\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tforeach($itemSlots as $index => $slot){\n\t\t\t\tif($slot->equals($item, $slot->hasAnyDamageValue(), $slot->getCompoundTag())){\n\t\t\t\t\t$amount = min($item->getCount(), $slot->getCount());\n\t\t\t\t\t$slot->setCount($slot->getCount() - $amount);\n\t\t\t\t\t$item->setCount($item->getCount() - $amount);\n\t\t\t\t\t$this->setItem($i, $item);\n\t\t\t\t\tif($slot->getCount() <= 0){\n\t\t\t\t\t\tunset($itemSlots[$index]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(count($itemSlots) === 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $itemSlots;\n\t}\n\n\tpublic function clear($index, $send = true){\n\t\tif(isset($this->slots[$index])){\n\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t\t$old = $this->slots[$index];\n\t\t\t$holder = $this->getHolder();\n\t\t\tif($holder instanceof Entity){\n\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($holder, $old, $item, $index));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t$this->sendSlot($index, $this->getViewers());\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$item = $ev->getNewItem();\n\t\t\t}\n\t\t\tif($item->getId() !== Item::AIR){\n\t\t\t\t$this->slots[$index] = clone $item;\n\t\t\t}else{\n\t\t\t\tunset($this->slots[$index]);\n\t\t\t}\n\t\t\t$this->onSlotChange($index, $old, $send);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function clearAll($send = true){\n\t\tforeach($this->getContents() as $index => $i){\n\t\t\t$this->clear($index, $send);\n\t\t}\n\t}\n\n\t/**\n\t * @return Player[]\n\t */\n\tpublic function getViewers(){\n\t\treturn $this->viewers;\n\t}\n\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n\n\tpublic function setMaxStackSize($size){\n\t\t$this->maxStackSize = (int) $size;\n\t}\n\n\tpublic function open(Player $who){\n\t\t$who->getServer()->getPluginManager()->callEvent($ev = new InventoryOpenEvent($this, $who));\n\t\tif($ev->isCancelled()){\n\t\t\treturn false;\n\t\t}\n\t\t$this->onOpen($who);\n\n\t\treturn true;\n\t}\n\n\tpublic function close(Player $who){\n\t\t$this->onClose($who);\n\t}\n\n\tpublic function onOpen(Player $who){\n\t\t$this->viewers[spl_object_hash($who)] = $who;\n\t}\n\n\tpublic function onClose(Player $who){\n\t\tunset($this->viewers[spl_object_hash($who)]);\n\t}\n\n\tpublic function onSlotChange($index, $before, $send){\n\t\tif($send){\n\t\t\t$this->sendSlot($index, $this->getViewers());\n\t\t}\n\t}\n\n\tpublic function processSlotChange(Transaction $transaction): bool{\n\t\treturn true;\n\t}\n\n\n\t/**\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendContents($target){\n\t\tif($target instanceof Player){\n\t\t\t$target = [$target];\n\t\t}\n\n\t\t$pk = new ContainerSetContentPacket();\n\t\t$pk->slots = [];\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$pk->slots[$i] = $this->getItem($i);\n\t\t}\n\n\t\tforeach($target as $player){\n\t\t\tif(($id = $player->getWindowId($this)) === -1 or $player->spawned !== true){\n\t\t\t\t$this->close($player);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$pk->windowid = $id;\n\t\t\t$player->dataPacket($pk);\n\t\t}\n\t}\n\n\t/**\n\t * @param int             $index\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendSlot($index, $target){\n\t\tif($target instanceof Player){\n\t\t\t$target = [$target];\n\t\t}\n\n\t\t$pk = new ContainerSetSlotPacket();\n\t\t$pk->slot = $index;\n\t\t$pk->item = clone $this->getItem($index);\n\n\t\tforeach($target as $player){\n\t\t\tif(($id = $player->getWindowId($this)) === -1){\n\t\t\t\t$this->close($player);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$pk->windowid = $id;\n\t\t\t$player->dataPacket($pk);\n\t\t}\n\t}\n\n\tpublic function getType(){\n\t\treturn $this->type;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/inventory/BaseTransaction.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass BaseTransaction implements Transaction{\n\t/** @var Inventory */\n\tprotected $inventory;\n\t/** @var int */\n\tprotected $slot;\n\t/** @var Item */\n\tprotected $targetItem;\n\t/** @var float */\n\tprotected $creationTime;\n\t/** @var int */\n\tprotected $transactionType = Transaction::TYPE_NORMAL;\n\t/** @var int */\n\tprotected $failures = 0;\n\t/** @var bool */\n\tprotected $wasSuccessful = false;\n\t/** @var string */\n\tprotected $achievements = [];\n\n\t/**\n\t * @param Inventory $inventory\n\t * @param int       $slot\n\t * @param Item      $targetItem\n\t * @param string[]  $achievements\n\t * @param int       $transactionType\n\t */\n\tpublic function __construct($inventory, $slot, Item $targetItem, $achievements = [], $transactionType = Transaction::TYPE_NORMAL){\n\t\t$this->inventory = $inventory;\n\t\t$this->slot = (int) $slot;\n\t\t$this->targetItem = clone $targetItem;\n\t\t$this->creationTime = microtime(true);\n\t\t$this->transactionType = $transactionType;\n\t\t$this->achievements = $achievements;\n\t}\n\n\tpublic function getCreationTime(){\n\t\treturn $this->creationTime;\n\t}\n\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\tpublic function getSlot(){\n\t\treturn $this->slot;\n\t}\n\n\tpublic function getTargetItem(){\n\t\treturn clone $this->targetItem;\n\t}\n\n\tpublic function setTargetItem(Item $item){\n\t\t$this->targetItem = clone $item;\n\t}\n\n\tpublic function getFailures(){\n\t\treturn $this->failures;\n\t}\n\n\tpublic function addFailure(){\n\t\t$this->failures++;\n\t}\n\n\tpublic function succeeded(){\n\t\treturn $this->wasSuccessful;\n\t}\n\n\tpublic function setSuccess($value = true){\n\t\t$this->wasSuccessful = $value;\n\t}\n\n\tpublic function getTransactionType(){\n\t\treturn $this->transactionType;\n\t}\n\t\n\tpublic function getAchievements(){\n\t\treturn $this->achievements;\n\t}\n\t\n\tpublic function hasAchievements(){\n\t\treturn count($this->achievements) !== 0;\n\t}\n\t\n\tpublic function addAchievement(string $achievementName){\n\t\t$this->achievements[] = $achievementName;\n\t}\n\n\t/**\n\t * @param Player $source\n\t *\n\t * Sends a slot update to inventory viewers\n\t * For successful transactions, update non-source viewers (source does not need updating)\n\t * For failed transactions, update the source (non-source viewers will see nothing anyway)\n\t */\n\tpublic function sendSlotUpdate(Player $source){\n\t\tif($this->getInventory() instanceof TemporaryInventory){\n\t\t\treturn;\n\t\t}\n\n\t\t$targets = [];\n\t\tif($this->wasSuccessful){\n\t\t\t$targets = $this->getInventory()->getViewers();\n\t\t\tunset($targets[spl_object_hash($source)]);\n\t\t}else{\n\t\t\t$targets = [$source];\n\t\t}\n\t\t$this->inventory->sendSlot($this->slot, $targets);\n\t}\n\n\t/**\n\t * Returns the change in inventory resulting from this transaction\n\t * @return Item[\n\t *\t\t\t\t\"in\" => items added to the inventory\n\t *\t\t\t\t\"out\" => items removed from the inventory\n\t * ]\n\t */\n\tpublic function getChange(){\n\t\t$sourceItem = $this->getInventory()->getItem($this->slot);\n\n\t\tif($sourceItem->deepEquals($this->targetItem, true, true, true)){\n\t\t\t//This should never happen, somehow a change happened where nothing changed\n\t\t\treturn null;\n\n\t\t}elseif($sourceItem->deepEquals($this->targetItem)){ //Same item, change of count\n\t\t\t$item = clone $sourceItem;\n\t\t\t$countDiff = $this->targetItem->getCount() - $sourceItem->getCount();\n\t\t\t$item->setCount(abs($countDiff));\n\n\t\t\tif($countDiff < 0){\t//Count decreased\n\t\t\t\treturn [\"in\" => null,\n\t\t\t\t\t\t\"out\" => $item];\n\t\t\t}elseif($countDiff > 0){ //Count increased\n\t\t\t\treturn [\n\t\t\t\t\t\t\"in\" => $item,\n\t\t\t\t\t\t\"out\" => null];\n\t\t\t}else{\n\t\t\t\t//Should be impossible (identical items and no count change)\n\t\t\t\t//This should be caught by the first condition even if it was possible\n\t\t\t\treturn null;\n\t\t\t}\n\t\t}elseif($sourceItem->getId() !== Item::AIR and $this->targetItem->getId() === Item::AIR){\n\t\t\t//Slot emptied (item removed)\n\t\t\treturn [\"in\" => null,\n\t\t\t\t\t\"out\" => clone $sourceItem];\n\n\t\t}elseif($sourceItem->getId() === Item::AIR and $this->targetItem->getId() !== Item::AIR){\n\t\t\t//Slot filled (item added)\n\t\t\treturn [\"in\" => $this->getTargetItem(),\n\t\t\t\t\t\"out\" => null];\n\n\t\t}else{\n\t\t\t//Some other slot change - an item swap (tool damage changes will be ignored as they are processed server-side before any change is sent by the client\n\t\t\treturn [\"in\" => $this->getTargetItem(),\n\t\t\t\t\t\"out\" => clone $sourceItem];\n\t\t}\n\t}\n\n\t/**\n\t * @param Player $source\n\t * @return bool\n\t *\n\t * Handles transaction execution. Returns whether transaction was successful or not.\n\t */\n\n\tpublic function execute(Player $source): bool{\n\t\tif($this->getInventory()->processSlotChange($this)){ //This means that the transaction should be handled the normal way\n\t\t\tif(!$source->getServer()->allowInventoryCheats and !$source->isCreative()){\n\t\t\t\t$change = $this->getChange();\n\n\t\t\t\tif($change === null){ //No changes to make, ignore this transaction\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t/* Verify that we have the required items */\n\t\t\t\tif($change[\"out\"] instanceof Item){\n\t\t\t\t\tif(!$this->getInventory()->slotContains($this->getSlot(), $change[\"out\"])){\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($change[\"in\"] instanceof Item){\n\t\t\t\t\tif(!$source->getFloatingInventory()->contains($change[\"in\"])){\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t/* All checks passed, make changes to floating inventory\n\t\t\t\t * This will not be reached unless all requirements are met */\n\t\t\t\tif($change[\"out\"] instanceof Item){\n\t\t\t\t\t$source->getFloatingInventory()->addItem($change[\"out\"]);\n\t\t\t\t}\n\t\t\t\tif($change[\"in\"] instanceof Item){\n\t\t\t\t\t$source->getFloatingInventory()->removeItem($change[\"in\"]);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->getInventory()->setItem($this->getSlot(), $this->getTargetItem(), false);\n\t\t}\n\t\t\n\t\t/* Process transaction achievements, like getting iron from a furnace */\n\t\tforeach($this->achievements as $achievement){\n\t\t\t$source->awardAchievement($achievement);\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/BigShapedRecipe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nclass BigShapedRecipe extends ShapedRecipe{\n\n}"
  },
  {
    "path": "src/pocketmine/inventory/BigShapelessRecipe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nclass BigShapelessRecipe extends ShapelessRecipe{\n\n}"
  },
  {
    "path": "src/pocketmine/inventory/BrewingInventory.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\tile\\BrewingStand;\n\nclass BrewingInventory extends ContainerInventory{\n\tpublic function __construct(BrewingStand $tile){\n\t\tparent::__construct($tile, InventoryType::get(InventoryType::BREWING_STAND));\n\t}\n\n\t/**\n\t * @return BrewingStand\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n\n\tpublic function setIngredient(Item $item){\n\t\t$this->setItem(0, $item);\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getIngredient(){\n\t\treturn $this->getItem(0);\n\t}\n\n\tpublic function onSlotChange($index, $before, $send){\n\t\tparent::onSlotChange($index, $before, $send);\n\n\t\t$this->getHolder()->scheduleUpdate();\n\t\t$this->getHolder()->updateSurface();\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/BrewingRecipe.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\UUID;\n\nclass BrewingRecipe implements Recipe{\n\n\tprivate $id = null;\n\n\t/** @var Item */\n\tprivate $output;\n\n\t/** @var Item */\n\tprivate $ingredient;\n\n\t/** @var Item  */\n\tprivate $potion;\n\n\t/**\n\t * BrewingRecipe constructor.\n\t * @param Item $result\n\t * @param Item $ingredient\n\t * @param Item $potion\n\t */\n\tpublic function __construct(Item $result, Item $ingredient, Item $potion){\n\t\t$this->output = clone $result;\n\t\t$this->ingredient = clone $ingredient;\n\t\t$this->potion = clone $potion;\n\t}\n\n\tpublic function getPotion(){\n\t\treturn clone $this->potion;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function setId(UUID $id){\n\t\tif($this->id !== null){\n\t\t\tthrow new \\InvalidStateException(\"Id is already set\");\n\t\t}\n\n\t\t$this->id = $id;\n\t}\n\n\t/**\n\t * @param Item $item\n\t */\n\tpublic function setInput(Item $item){\n\t\t$this->ingredient = clone $item;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getInput(){\n\t\treturn clone $this->ingredient;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getResult(){\n\t\treturn clone $this->output;\n\t}\n\n\tpublic function registerToCraftingManager(){\n\t\tServer::getInstance()->getCraftingManager()->registerBrewingRecipe($this);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/ChestInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\block\\TrappedChest;\nuse pocketmine\\level\\Level;\nuse pocketmine\\network\\protocol\\BlockEventPacket;\nuse pocketmine\\Player;\n\nuse pocketmine\\tile\\Chest;\n\nclass ChestInventory extends ContainerInventory{\n\tpublic function __construct(Chest $tile){\n\t\tparent::__construct($tile, InventoryType::get(InventoryType::CHEST));\n\t}\n\n\t/**\n\t * @return Chest\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n\n\tpublic function getContents($withAir = false){\n\t\tif($withAir){\n\t\t\t$contents = [];\n\t\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t\t$contents[$i] = $this->getItem($i);\n\t\t\t}\n\n\t\t\treturn $contents;\n\t\t}\n\t\treturn parent::getContents();\n\t}\n\n\tpublic function onOpen(Player $who){\n\t\tparent::onOpen($who);\n\n\t\tif(count($this->getViewers()) === 1){\n\t\t\t$pk = new BlockEventPacket();\n\t\t\t$pk->x = $this->getHolder()->getX();\n\t\t\t$pk->y = $this->getHolder()->getY();\n\t\t\t$pk->z = $this->getHolder()->getZ();\n\t\t\t$pk->case1 = 1;\n\t\t\t$pk->case2 = 2;\n\t\t\tif(($level = $this->getHolder()->getLevel()) instanceof Level){\n\t\t\t\t$level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk);\n\t\t\t}\n\t\t}\n\n\t\tif($this->getHolder()->getLevel() instanceof Level){\n\t\t\t/** @var TrappedChest $block */\n\t\t\t$block = $this->getHolder()->getBlock();\n\t\t\tif($block instanceof TrappedChest){\n\t\t\t\tif(!$block->isActivated()){\n\t\t\t\t\t$block->activate();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onClose(Player $who){\n\t\tif($this->getHolder()->getLevel() instanceof Level){\n\t\t\t/** @var TrappedChest $block */\n\t\t\t$block = $this->getHolder()->getBlock();\n\t\t\tif($block instanceof TrappedChest){\n\t\t\t\tif($block->isActivated()){\n\t\t\t\t\t$block->deactivate();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif(count($this->getViewers()) === 1){\n\t\t\t$pk = new BlockEventPacket();\n\t\t\t$pk->x = $this->getHolder()->getX();\n\t\t\t$pk->y = $this->getHolder()->getY();\n\t\t\t$pk->z = $this->getHolder()->getZ();\n\t\t\t$pk->case1 = 1;\n\t\t\t$pk->case2 = 0;\n\t\t\tif(($level = $this->getHolder()->getLevel()) instanceof Level){\n\t\t\t\t$level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk);\n\t\t\t}\n\t\t}\n\t\tparent::onClose($who);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/ContainerInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\ContainerClosePacket;\nuse pocketmine\\network\\protocol\\ContainerOpenPacket;\nuse pocketmine\\Player;\n\nabstract class ContainerInventory extends BaseInventory{\n\tpublic function onOpen(Player $who){\n\t\tparent::onOpen($who);\n\t\t$pk = new ContainerOpenPacket();\n\t\t$pk->windowid = $who->getWindowId($this);\n\t\t$pk->type = $this->getType()->getNetworkType();\n\t\t$pk->slots = $this->getSize();\n\t\t$holder = $this->getHolder();\n\t\tif($holder instanceof Vector3){\n\t\t\t$pk->x = $holder->getX();\n\t\t\t$pk->y = $holder->getY();\n\t\t\t$pk->z = $holder->getZ();\n\t\t}else{\n\t\t\t$pk->x = $pk->y = $pk->z = 0;\n\t\t}\n\n\t\t$who->dataPacket($pk);\n\n\t\t$this->sendContents($who);\n\t}\n\n\tpublic function onClose(Player $who){\n\t\t$pk = new ContainerClosePacket();\n\t\t$pk->windowid = $who->getWindowId($this);\n\t\t$who->dataPacket($pk);\n\t\tparent::onClose($who);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/CraftingInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\n/**\n * Manages crafting operations\n * This class includes future methods for shaped crafting\n *\n * TODO: add small matrix inventory\n */\nclass CraftingInventory extends BaseInventory{\n\n\t/** @var Inventory */\n\tprivate $resultInventory;\n\n\t/**\n\t * @param InventoryHolder $holder\n\t * @param Inventory       $resultInventory\n\t * @param InventoryType   $inventoryType\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function __construct(InventoryHolder $holder, Inventory $resultInventory, InventoryType $inventoryType){\n\t\tif($inventoryType->getDefaultTitle() !== \"Crafting\"){\n\t\t\tthrow new \\InvalidStateException(\"Invalid Inventory type, expected CRAFTING or WORKBENCH\");\n\t\t}\n\t\t$this->resultInventory = $resultInventory;\n\t\tparent::__construct($holder, $inventoryType);\n\t}\n\n\t/**\n\t * @return Inventory\n\t */\n\tpublic function getResultInventory(){\n\t\treturn $this->resultInventory;\n\t}\n\n\tpublic function getSize(){\n\t\treturn $this->getResultInventory()->getSize() + parent::getSize();\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/CraftingManager.php",
    "content": "<?php\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\block\\Planks;\nuse pocketmine\\block\\Quartz;\nuse pocketmine\\block\\Sandstone;\nuse pocketmine\\block\\Slab;\nuse pocketmine\\block\\Stone;\nuse pocketmine\\block\\StoneBricks;\nuse pocketmine\\block\\StoneWall;\nuse pocketmine\\block\\Wood;\nuse pocketmine\\block\\Wood2;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\Potion;\nuse pocketmine\\utils\\UUID;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\MainLogger;\nuse pocketmine\\utils\\Config;\n\nclass CraftingManager{\n\t/** @var Recipe[] */\n\tpublic $recipes = [];\n\n\t/** @var Recipe[][] */\n\tprotected $recipeLookup = [];\n\n\t/** @var FurnaceRecipe[] */\n\tpublic $furnaceRecipes = [];\n\n\t/** @var BrewingRecipe[] */\n\tpublic $brewingRecipes = [];\n\n\tprivate static $RECIPE_COUNT = 0;\n\n\tpublic function __construct(bool $useJson = false){\n\t\t$this->registerBrewingStand();\n\n\t\t// load recipes from src/pocketmine/resources/recipes.json\n\t\t$recipes = new Config(Server::getInstance()->getFilePath() . \"src/pocketmine/resources/recipes.json\", Config::JSON, []);\n\n\t\tforeach($recipes->getAll() as $recipe){\n\t\t\tswitch($recipe[\"type\"]){\n\t\t\t\tcase 0:\n\t\t\t\t\t// TODO: handle multiple result items\n\t\t\t\t\tif(count($recipe[\"output\"]) === 1){\n\t\t\t\t\t\t$first = $recipe[\"output\"][0];\n\t\t\t\t\t\t$result = new ShapelessRecipe(Item::get($first[\"id\"], $first[\"damage\"], $first[\"count\"], $first[\"nbt\"]));\n\n\t\t\t\t\t\tforeach($recipe[\"input\"] as $ingredient){\n\t\t\t\t\t\t\t$result->addIngredient(Item::get($ingredient[\"id\"], $ingredient[\"damage\"], $ingredient[\"count\"], $first[\"nbt\"]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->registerRecipe($result);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 1:\n\t\t\t\t\t// TODO: handle multiple result items\n\t\t\t\t\tif(count($recipe[\"output\"]) === 1){\n\t\t\t\t\t\t$first = $recipe[\"output\"][0];\n\t\t\t\t\t\t$result = new ShapedRecipe(Item::get($first[\"id\"], $first[\"damage\"], $first[\"count\"], $first[\"nbt\"]), $recipe[\"height\"], $recipe[\"width\"]);\n\n\t\t\t\t\t\t$shape = array_chunk($recipe[\"input\"], $recipe[\"width\"]);\n\t\t\t\t\t\tforeach($shape as $y => $row){\n\t\t\t\t\t\t\tforeach($row as $x => $ingredient){\n\t\t\t\t\t\t\t\t$result->addIngredient($x, $y, Item::get($ingredient[\"id\"], ($ingredient[\"damage\"] < 0 ? -1 : $ingredient[\"damage\"]), $ingredient[\"count\"], $ingredient[\"nbt\"]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->registerRecipe($result);\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase 2:\n\t\t\t\tcase 3:\n\t\t\t\t\t$result = $recipe[\"output\"];\n\t\t\t\t\t$resultItem = Item::get($result[\"id\"], $result[\"damage\"], $result[\"count\"], $result[\"nbt\"]);\n\t\t\t\t\t$this->registerRecipe(new FurnaceRecipe($resultItem, Item::get($recipe[\"inputId\"], $recipe[\"inputDamage\"] ?? -1, 1)));\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected function registerBrewingStand(){\n\t\t//Potion\n\t\t//WATER_BOTTLE\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::AWKWARD, 1), Item::get(Item::NETHER_WART, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::THICK, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE_EXTENDED, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::WEAKNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE, 1), Item::get(Item::GHAST_TEAR, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE, 1), Item::get(Item::GLISTERING_MELON, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE, 1), Item::get(Item::BLAZE_POWDER, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE, 1), Item::get(Item::MAGMA_CREAM, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE, 1), Item::get(Item::SUGAR, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE, 1), Item::get(Item::SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::MUNDANE, 1), Item::get(Item::RABBIT_FOOT, 0, 1), Item::get(Item::POTION, Potion::WATER_BOTTLE, 1)));\n\t\t//To WEAKNESS\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::WEAKNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::MUNDANE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::WEAKNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::THICK, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::WEAKNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::MUNDANE_EXTENDED, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::WEAKNESS_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::WEAKNESS, 1)));\n\t\t//GHAST_TEAR and BLAZE_POWDER\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::REGENERATION, 1), Item::get(Item::GHAST_TEAR, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::REGENERATION_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::REGENERATION, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::REGENERATION_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::REGENERATION, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::STRENGTH, 1), Item::get(Item::BLAZE_POWDER, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::STRENGTH_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::STRENGTH, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::STRENGTH_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::STRENGTH, 1)));\n\t\t//SPIDER_EYE GLISTERING_MELON and PUFFERFISH\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::POISON, 1), Item::get(Item::SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::POISON_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::POISON, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::POISON_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::POISON, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HEALING, 1), Item::get(Item::GLISTERING_MELON, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HEALING_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::HEALING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::WATER_BREATHING, 1), Item::get(Item::PUFFER_FISH, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::WATER_BREATHING_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::WATER_BREATHING, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HARMING, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::WATER_BREATHING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HARMING, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::HEALING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HARMING, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::POISON, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HARMING_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::HARMING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HARMING_TWO, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::HEALING_TWO, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::HARMING_TWO, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::POISON_T, 1)));\n\t\t//SUGAR MAGMA_CREAM and RABBIT_FOOT\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SWIFTNESS, 1), Item::get(Item::SUGAR, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SWIFTNESS_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::SWIFTNESS, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SWIFTNESS_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::SWIFTNESS, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::FIRE_RESISTANCE, 1), Item::get(Item::MAGMA_CREAM, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::FIRE_RESISTANCE_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::FIRE_RESISTANCE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::LEAPING, 1), Item::get(Item::RABBIT_FOOT, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::LEAPING_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::LEAPING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::LEAPING_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::LEAPING, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SLOWNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::FIRE_RESISTANCE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SLOWNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::SWIFTNESS, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SLOWNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::LEAPING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SLOWNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::FIRE_RESISTANCE_T, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SLOWNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::LEAPING_T, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SLOWNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::SWIFTNESS_T, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::SLOWNESS_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::SLOWNESS, 1)));\n\t\t//GOLDEN_CARROT\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::NIGHT_VISION, 1), Item::get(Item::GOLDEN_CARROT, 0, 1), Item::get(Item::POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::NIGHT_VISION_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::NIGHT_VISION, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::INVISIBILITY, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::NIGHT_VISION, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::INVISIBILITY_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::POTION, Potion::INVISIBILITY, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::POTION, Potion::INVISIBILITY_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::POTION, Potion::NIGHT_VISION_T, 1)));\n\t\t//===================================================================分隔符=======================================================================\n\t\t//SPLASH_POTION\n\t\t//WATER_BOTTLE\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1), Item::get(Item::NETHER_WART, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::THICK, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE_EXTENDED, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::WEAKNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1), Item::get(Item::GHAST_TEAR, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1), Item::get(Item::GLISTERING_MELON, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1), Item::get(Item::BLAZE_POWDER, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1), Item::get(Item::MAGMA_CREAM, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1), Item::get(Item::SUGAR, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1), Item::get(Item::SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1), Item::get(Item::RABBIT_FOOT, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BOTTLE, 1)));\n\t\t//To WEAKNESS\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::WEAKNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::MUNDANE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::WEAKNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::THICK, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::WEAKNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::MUNDANE_EXTENDED, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::WEAKNESS_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WEAKNESS, 1)));\n\t\t//GHAST_TEAR and BLAZE_POWDER\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::REGENERATION, 1), Item::get(Item::GHAST_TEAR, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::REGENERATION_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::REGENERATION, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::REGENERATION_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::REGENERATION, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::STRENGTH, 1), Item::get(Item::BLAZE_POWDER, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::STRENGTH_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::STRENGTH, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::STRENGTH_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::STRENGTH, 1)));\n\t\t//SPIDER_EYE GLISTERING_MELON and PUFFERFISH\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::POISON, 1), Item::get(Item::SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::POISON_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::POISON, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::POISON_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::POISON, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HEALING, 1), Item::get(Item::GLISTERING_MELON, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HEALING_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::HEALING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::WATER_BREATHING, 1), Item::get(Item::PUFFER_FISH, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::WATER_BREATHING_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BREATHING, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HARMING, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::WATER_BREATHING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HARMING, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::HEALING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HARMING, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::POISON, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HARMING_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::HARMING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HARMING_TWO, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::HEALING_TWO, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::HARMING_TWO, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::POISON_T, 1)));\n\t\t//SUGAR MAGMA_CREAM and RABBIT_FOOT\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SWIFTNESS, 1), Item::get(Item::SUGAR, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SWIFTNESS_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::SWIFTNESS, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SWIFTNESS_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::SWIFTNESS, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::FIRE_RESISTANCE, 1), Item::get(Item::MAGMA_CREAM, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::FIRE_RESISTANCE_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::FIRE_RESISTANCE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::LEAPING, 1), Item::get(Item::RABBIT_FOOT, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::LEAPING_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::LEAPING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::LEAPING_TWO, 1), Item::get(Item::GLOWSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::LEAPING, 1)));\n\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SLOWNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::FIRE_RESISTANCE, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SLOWNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::SWIFTNESS, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SLOWNESS, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::LEAPING, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SLOWNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::FIRE_RESISTANCE_T, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SLOWNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::LEAPING_T, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SLOWNESS_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::SWIFTNESS_T, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::SLOWNESS_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::SLOWNESS, 1)));\n\t\t//GOLDEN_CARROT\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::NIGHT_VISION, 1), Item::get(Item::GOLDEN_CARROT, 0, 1), Item::get(Item::SPLASH_POTION, Potion::AWKWARD, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::NIGHT_VISION_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::NIGHT_VISION, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::INVISIBILITY, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::NIGHT_VISION, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::INVISIBILITY_T, 1), Item::get(Item::REDSTONE_DUST, 0, 1), Item::get(Item::SPLASH_POTION, Potion::INVISIBILITY, 1)));\n\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, Potion::INVISIBILITY_T, 1), Item::get(Item::FERMENTED_SPIDER_EYE, 0, 1), Item::get(Item::SPLASH_POTION, Potion::NIGHT_VISION_T, 1)));\n\t\t//===================================================================分隔符=======================================================================\n\t\t//普通药水升级成喷溅\n\t\tforeach (Potion::POTIONS as $potion => $effect){\n\t\t\t$this->registerBrewingRecipe(new BrewingRecipe(Item::get(Item::SPLASH_POTION, $potion, 1), Item::get(Item::GUNPOWDER, 0, 1), Item::get(Item::POTION, $potion, 1)));\n\t\t}\n\t}\n\n\tpublic function sort(Item $i1, Item $i2){\n\t\tif($i1->getId() > $i2->getId()){\n\t\t\treturn 1;\n\t\t}elseif($i1->getId() < $i2->getId()){\n\t\t\treturn -1;\n\t\t}elseif($i1->getDamage() > $i2->getDamage()){\n\t\t\treturn 1;\n\t\t}elseif($i1->getDamage() < $i2->getDamage()){\n\t\t\treturn -1;\n\t\t}elseif($i1->getCount() > $i2->getCount()){\n\t\t\treturn 1;\n\t\t}elseif($i1->getCount() < $i2->getCount()){\n\t\t\treturn -1;\n\t\t}else{\n\t\t\treturn 0;\n\t\t}\n\t}\n\n\t/**\n\t * @param UUID $id\n\t * @return Recipe\n\t */\n\tpublic function getRecipe(UUID $id){\n\t\t$index = $id->toBinary();\n\t\treturn $this->recipes[$index] ?? null;\n\t}\n\n\t/**\n\t * @return Recipe[]\n\t */\n\tpublic function getRecipes(){\n\t\treturn $this->recipes;\n\t}\n\n\tpublic function getRecipesByResult(Item $item){\n\t\treturn @array_values($this->recipeLookup[$item->getId() . \":\" . $item->getDamage()]) ?? [];\n\t}\n\t/**\n\t * @return FurnaceRecipe[]\n\t */\n\tpublic function getFurnaceRecipes(){\n\t\treturn $this->furnaceRecipes;\n\t}\n\n\t/**\n\t * @param Item $input\n\t *\n\t * @return FurnaceRecipe\n\t */\n\tpublic function matchFurnaceRecipe(Item $input){\n\t\tif(isset($this->furnaceRecipes[$input->getId() . \":\" . $input->getDamage()])){\n\t\t\treturn $this->furnaceRecipes[$input->getId() . \":\" . $input->getDamage()];\n\t\t}elseif(isset($this->furnaceRecipes[$input->getId() . \":?\"])){\n\t\t\treturn $this->furnaceRecipes[$input->getId() . \":?\"];\n\t\t}\n\t\treturn null;\n\t}\n\n\n\t/**\n\t * @param Item $input\n\t * @param Item $potion\n\t *\n\t * @return BrewingRecipe\n\t */\n\tpublic function matchBrewingRecipe(Item $input, Item $potion){\n\t\t$subscript = $input->getId() . \":\" . ($input->getDamage() === null ? \"0\" : $input->getDamage()) . \":\" . $potion->getId() . \":\" .($potion->getDamage() === null ? \"0\" : $potion->getDamage());\n\t\tif(isset($this->brewingRecipes[$subscript])){\n\t\t\treturn $this->brewingRecipes[$subscript];\n\t\t}\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param ShapedRecipe $recipe\n\t */\n\tpublic function registerShapedRecipe(ShapedRecipe $recipe){\n\t\t$result = $recipe->getResult();\n\t\t$this->recipes[$recipe->getId()->toBinary()] = $recipe;\n\t\t$ingredients = $recipe->getIngredientMap();\n\t\t$hash = \"\";\n\t\tforeach($ingredients as $v){\n\t\t\tforeach($v as $item){\n\t\t\t\tif($item !== null){\n\t\t\t\t\t/** @var Item $item */\n\t\t\t\t\t$hash .= $item->getId() . \":\" . ($item->hasAnyDamageValue()  ? \"?\" : $item->getDamage()) . \"x\" . $item->getCount() . \",\";\n\t\t\t\t}\n\t\t\t}\n\t\t\t$hash .= \";\";\n\t\t}\n\t\t$this->recipeLookup[$result->getId() . \":\" . $result->getDamage()][$hash] = $recipe;\n\t}\n\n\t/**\n\t * @param ShapelessRecipe $recipe\n\t */\n\tpublic function registerShapelessRecipe(ShapelessRecipe $recipe){\n\t\t$result = $recipe->getResult();\n\t\t$this->recipes[$recipe->getId()->toBinary()] = $recipe;\n\t\t$hash = \"\";\n\t\t$ingredients = $recipe->getIngredientList();\n\t\tusort($ingredients, [$this, \"sort\"]);\n\t\tforeach($ingredients as $item){\n\t\t\t$hash .= $item->getId() . \":\" . ($item->hasAnyDamageValue() ? \"?\" : $item->getDamage()) . \"x\" . $item->getCount() . \",\";\n\t\t}\n\t\t$this->recipeLookup[$result->getId() . \":\" . $result->getDamage()][$hash] = $recipe;\n\t}\n\n\t/**\n\t * @param FurnaceRecipe $recipe\n\t */\n\tpublic function registerFurnaceRecipe(FurnaceRecipe $recipe){\n\t\t$input = $recipe->getInput();\n\t\t$this->furnaceRecipes[$input->getId() . \":\" . ($input->hasAnyDamageValue()  ? \"?\" : $input->getDamage())] = $recipe;\n\t}\n\n\t/**\n\t * @param BrewingRecipe $recipe\n\t */\n\tpublic function registerBrewingRecipe(BrewingRecipe $recipe){\n\t\t$input = $recipe->getInput();\n\t\t$potion = $recipe->getPotion();\n\t\t$this->brewingRecipes[$input->getId() . \":\" . ($input->getDamage() === null ? \"0\" : $input->getDamage()) . \":\" . $potion->getId() . \":\" .($potion->getDamage() === null ? \"0\" : $potion->getDamage())] = $recipe;\n\t}\n\n\t/**\n\t * @param ShapelessRecipe $recipe\n\t * @return bool\n\t */\n\tpublic function matchRecipe(ShapelessRecipe $recipe){\n\t\tif(!isset($this->recipeLookup[$idx = $recipe->getResult()->getId() . \":\" . $recipe->getResult()->getDamage()])){\n\t\t\treturn false;\n\t\t}\n\t\t$hash = \"\";\n\t\t$ingredients = $recipe->getIngredientList();\n\t\tusort($ingredients, [$this, \"sort\"]);\n\t\tforeach($ingredients as $item){\n\t\t\t$hash .= $item->getId() . \":\" . ($item->hasAnyDamageValue()  ? \"?\" : $item->getDamage()) . \"x\" . $item->getCount() . \",\";\n\t\t}\n\t\tif(isset($this->recipeLookup[$idx][$hash])){\n\t\t\treturn true;\n\t\t}\n\t\t$hasRecipe = null;\n\t\tforeach($this->recipeLookup[$idx] as $recipe){\n\t\t\tif($recipe instanceof ShapelessRecipe){\n\t\t\t\tif($recipe->getIngredientCount() !== count($ingredients)){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$checkInput = $recipe->getIngredientList();\n\t\t\t\tforeach($ingredients as $item){\n\t\t\t\t\t$amount = $item->getCount();\n\t\t\t\t\tforeach($checkInput as $k => $checkItem){\n\t\t\t\t\t\tif($checkItem->equals($item, $checkItem->getDamage() === null ? false : true, $checkItem->getCompoundTag() === null ? false : true)){\n\t\t\t\t\t\t\t$remove = min($checkItem->getCount(), $amount);\n\t\t\t\t\t\t\t$checkItem->setCount($checkItem->getCount() - $remove);\n\t\t\t\t\t\t\tif($checkItem->getCount() === 0){\n\t\t\t\t\t\t\t\tunset($checkInput[$k]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$amount -= $remove;\n\t\t\t\t\t\t\tif($amount === 0){\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(count($checkInput) === 0){\n\t\t\t\t\t$hasRecipe = $recipe;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($hasRecipe instanceof Recipe){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $hasRecipe !== null;\n\t}\n\n\t/**\n\t * @param Recipe $recipe\n\t */\n\tpublic function registerRecipe(Recipe $recipe){\n\t\t$recipe->setId(UUID::fromData(++self::$RECIPE_COUNT, $recipe->getResult()->getId(), $recipe->getResult()->getDamage(), $recipe->getResult()->getCount(), $recipe->getResult()->getCompoundTag()));\n\t\tif($recipe instanceof ShapedRecipe){\n\t\t\t$this->registerShapedRecipe($recipe);\n\t\t}elseif($recipe instanceof ShapelessRecipe){\n\t\t\t$this->registerShapelessRecipe($recipe);\n\t\t}elseif($recipe instanceof FurnaceRecipe){\n\t\t\t$this->registerFurnaceRecipe($recipe);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/inventory/CustomInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\n/**\n * All plugins that want to create their custom inventory should use this class as a base\n */\nabstract class CustomInventory extends ContainerInventory{\n\n}"
  },
  {
    "path": "src/pocketmine/inventory/DispenserInventory.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\tile\\Dispenser;\n\nclass DispenserInventory extends ContainerInventory{\n\tpublic function __construct(Dispenser $tile){\n\t\tparent::__construct($tile, InventoryType::get(InventoryType::DISPENSER));\n\t}\n\n\t/**\n\t * @return Dispenser\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/DoubleChestInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\network\\Network;\nuse pocketmine\\network\\protocol\\BlockEventPacket;\nuse pocketmine\\Player;\n\nuse pocketmine\\tile\\Chest;\n\nclass DoubleChestInventory extends ChestInventory implements InventoryHolder{\n\t/** @var ChestInventory */\n\tprivate $left;\n\t/** @var ChestInventory */\n\tprivate $right;\n\n\tpublic function __construct(Chest $left, Chest $right){\n\t\t$this->left = $left->getRealInventory();\n\t\t$this->right = $right->getRealInventory();\n\t\t$items = array_merge($this->left->getContents(true), $this->right->getContents(true));\n\t\tBaseInventory::__construct($this, InventoryType::get(InventoryType::DOUBLE_CHEST), $items);\n\t}\n\n\tpublic function getInventory(){\n\t\treturn $this;\n\t}\n\n\tpublic function getHolder(){\n\t\treturn $this->left->getHolder();\n\t}\n\n\tpublic function getItem($index){\n\t\treturn $index < $this->left->getSize() ? $this->left->getItem($index) : $this->right->getItem($index - $this->right->getSize());\n\t}\n\n\tpublic function setItem($index, Item $item){\n\t\treturn $index < $this->left->getSize() ? $this->left->setItem($index, $item) : $this->right->setItem($index - $this->right->getSize(), $item);\n\t}\n\n\tpublic function clear($index){\n\t\treturn $index < $this->left->getSize() ? $this->left->clear($index) : $this->right->clear($index - $this->right->getSize());\n\t}\n\n\tpublic function getContents(){\n\t\t$contents = [];\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$contents[$i] = $this->getItem($i);\n\t\t}\n\n\t\treturn $contents;\n\t}\n\n\t/**\n\t * @param Item[] $items\n\t */\n\tpublic function setContents(array $items){\n\t\tif(count($items) > $this->size){\n\t\t\t$items = array_slice($items, 0, $this->size, true);\n\t\t}\n\n\n\t\tfor($i = 0; $i < $this->size; ++$i){\n\t\t\tif(!isset($items[$i])){\n\t\t\t\tif ($i < $this->left->size){\n\t\t\t\t\tif(isset($this->left->slots[$i])){\n\t\t\t\t\t\t$this->clear($i);\n\t\t\t\t\t}\n\t\t\t\t}elseif(isset($this->right->slots[$i - $this->left->size])){\n\t\t\t\t\t$this->clear($i);\n\t\t\t\t}\n\t\t\t}elseif(!$this->setItem($i, $items[$i])){\n\t\t\t\t$this->clear($i);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onOpen(Player $who){\n\t\tparent::onOpen($who);\n\n\t\tif(count($this->getViewers()) === 1){\n\t\t\t$pk = new BlockEventPacket();\n\t\t\t$pk->x = $this->right->getHolder()->getX();\n\t\t\t$pk->y = $this->right->getHolder()->getY();\n\t\t\t$pk->z = $this->right->getHolder()->getZ();\n\t\t\t$pk->case1 = 1;\n\t\t\t$pk->case2 = 2;\n\t\t\tif(($level = $this->right->getHolder()->getLevel()) instanceof Level){\n\t\t\t\t$level->addChunkPacket($this->right->getHolder()->getX() >> 4, $this->right->getHolder()->getZ() >> 4, $pk);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onClose(Player $who){\n\t\tif(count($this->getViewers()) === 1){\n\t\t\t$pk = new BlockEventPacket();\n\t\t\t$pk->x = $this->right->getHolder()->getX();\n\t\t\t$pk->y = $this->right->getHolder()->getY();\n\t\t\t$pk->z = $this->right->getHolder()->getZ();\n\t\t\t$pk->case1 = 1;\n\t\t\t$pk->case2 = 0;\n\t\t\tif(($level = $this->right->getHolder()->getLevel()) instanceof Level){\n\t\t\t\t$level->addChunkPacket($this->right->getHolder()->getX() >> 4, $this->right->getHolder()->getZ() >> 4, $pk);\n\t\t\t}\n\t\t}\n\t\tparent::onClose($who);\n\t}\n\n\t/**\n\t * @return ChestInventory\n\t */\n\tpublic function getLeftSide(){\n\t\treturn $this->left;\n\t}\n\n\t/**\n\t * @return ChestInventory\n\t */\n\tpublic function getRightSide(){\n\t\treturn $this->right;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/DropItemTransaction.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass DropItemTransaction extends BaseTransaction{\n\n\tconst TRANSACTION_TYPE = Transaction::TYPE_DROP_ITEM;\n\n\tprotected $inventory = null;\n\n\tprotected $slot = null;\n\n\tprotected $sourceItem = null;\n\n\t/**\n\t * @param Item $droppedItem\n\t */\n\tpublic function __construct(Item $droppedItem){\n\t\t$this->targetItem = $droppedItem;\n\t}\n\n\tpublic function setSourceItem(Item $item){\n\t\t//Nothing to update\n\t}\n\n\tpublic function getInventory(){\n\t\treturn null;\n\t}\n\n\tpublic function getSlot(){\n\t\treturn null;\n\t}\n\n\tpublic function sendSlotUpdate(Player $source){\n\t\t//Nothing to update\n\t}\n\n\tpublic function getChange(){\n\t\treturn [\"in\" => $this->getTargetItem(),\n\t\t\t\t\"out\" => null];\n\t}\n\n\tpublic function execute(Player $source): bool{\n\t\t$droppedItem = $this->getTargetItem();\n\t\tif(!$source->getServer()->allowInventoryCheats and !$source->isCreative()){\n\t\t\tif(!$source->getFloatingInventory()->contains($droppedItem)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$source->getFloatingInventory()->removeItem($droppedItem);\n\t\t}\n\t\t$source->dropItem($droppedItem);\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/DropperInventory.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\tile\\Dropper;\n\nclass DropperInventory extends ContainerInventory{\n\tpublic function __construct(Dropper $tile){\n\t\tparent::__construct($tile, InventoryType::get(InventoryType::DROPPER));\n\t}\n\n\t/**\n\t * @return Dropper\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/EnchantInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\item\\Dye;\nuse pocketmine\\item\\EnchantedBook;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\item\\enchantment\\EnchantmentEntry;\nuse pocketmine\\item\\enchantment\\EnchantmentLevelTable;\nuse pocketmine\\item\\enchantment\\EnchantmentList;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\Position;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\CraftingDataPacket;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\tile\\EnchantTable;\n\nclass EnchantInventory extends TemporaryInventory{\n\tprivate $bookshelfAmount = 0;\n\n\tprivate $levels = [];\n\t/** @var EnchantmentEntry[] */\n\tprivate $entries = null;\n\n\tpublic function __construct(Position $pos){\n\t\tparent::__construct(new FakeBlockMenu($this, $pos), InventoryType::get(InventoryType::ENCHANT_TABLE));\n\t}\n\n\t/**\n\t * @return EnchantTable\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n\t\n\tpublic function getResultSlotIndex(){\n\t\treturn -1; //enchanting tables don't have result slots, they modify the item in the target slot instead\n\t}\n\n\tpublic function onOpen(Player $who){\n\t\tparent::onOpen($who);\n\t\tif($this->levels == null){\n\t\t\t$this->bookshelfAmount = $this->countBookshelf();\n\n\t\t\tif($this->bookshelfAmount < 0){\n\t\t\t\t$this->bookshelfAmount = 0;\n\t\t\t}\n\n\t\t\tif($this->bookshelfAmount > 15){\n\t\t\t\t$this->bookshelfAmount = 15;\n\t\t\t}\n\n\t\t\t$base = mt_rand(1, 8) + ($this->bookshelfAmount / 2) + mt_rand(0, $this->bookshelfAmount);\n\t\t\t$this->levels = [\n\t\t\t\t0 => max($base / 3, 1),\n\t\t\t\t1 => (($base * 2) / 3 + 1),\n\t\t\t\t2 => max($base, $this->bookshelfAmount * 2)\n\t\t\t];\n\t\t}\n\t}\n\n\tprivate function randomFloat($min = 0, $max = 1){\n\t\treturn $min + mt_rand() / mt_getrandmax() * ($max - $min);\n\t}\n\n\tpublic function onSlotChange($index, $before, $send){\n\t\tparent::onSlotChange($index, $before, $send);\n\n\t\tif($index === 0){\n\t\t\t$item = $this->getItem(0);\n\t\t\tif($item->getId() === Item::AIR){\n\t\t\t\t$this->entries = null;\n\t\t\t}elseif($before->getId() == Item::AIR and !$item->hasEnchantments()){\n\t\t\t\t//before enchant\n\t\t\t\tif($this->entries === null){\n\t\t\t\t\t$enchantAbility = Enchantment::getEnchantAbility($item);\n\t\t\t\t\t$this->entries = [];\n\t\t\t\t\tfor($i = 0; $i < 3; $i++){\n\t\t\t\t\t\t$result = [];\n\n\t\t\t\t\t\t$level = $this->levels[$i];\n\t\t\t\t\t\t$k = $level + mt_rand(0, round(round($enchantAbility / 4) * 2)) + 1;\n\t\t\t\t\t\t$bonus = ($this->randomFloat() + $this->randomFloat() - 1) * 0.15 + 1;\n\t\t\t\t\t\t$modifiedLevel = ($k * (1 + $bonus) + 0.5);\n\n\t\t\t\t\t\t$possible = EnchantmentLevelTable::getPossibleEnchantments($item, $modifiedLevel);\n\t\t\t\t\t\t$weights = [];\n\t\t\t\t\t\t$total = 0;\n\n\t\t\t\t\t\tfor($j = 0; $j < count($possible); $j++){\n\t\t\t\t\t\t\t$id = $possible[$j]->getId();\n\t\t\t\t\t\t\t$weight = Enchantment::getEnchantWeight($id);\n\t\t\t\t\t\t\t$weights[$j] = $weight;\n\t\t\t\t\t\t\t$total += $weight;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$v = mt_rand(1, $total + 1);\n\n\t\t\t\t\t\t$sum = 0;\n\t\t\t\t\t\tfor($key = 0; $key < count($weights); ++$key){\n\t\t\t\t\t\t\t$sum += $weights[$key];\n\t\t\t\t\t\t\tif($sum >= $v){\n\t\t\t\t\t\t\t\t$key++;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$key--;\n\n\t\t\t\t\t\tif(!isset($possible[$key])) return;\n\t\t\t\t\t\t$enchantment = $possible[$key];\n\t\t\t\t\t\t$result[] = $enchantment;\n\t\t\t\t\t\tunset($possible[$key]);\n\n\t\t\t\t\t\t//Extra enchantment\n\t\t\t\t\t\twhile(count($possible) > 0){\n\t\t\t\t\t\t\t$modifiedLevel = round($modifiedLevel / 2);\n\t\t\t\t\t\t\t$v = mt_rand(0, 51);\n\t\t\t\t\t\t\tif($v <= ($modifiedLevel + 1)){\n\n\t\t\t\t\t\t\t\t$possible = $this->removeConflictEnchantment($enchantment, $possible);\n\n\t\t\t\t\t\t\t\t$weights = [];\n\t\t\t\t\t\t\t\t$total = 0;\n\n\t\t\t\t\t\t\t\tfor($j = 0; $j < count($possible); $j++){\n\t\t\t\t\t\t\t\t\t$id = $possible[$j]->getId();\n\t\t\t\t\t\t\t\t\t$weight = Enchantment::getEnchantWeight($id);\n\t\t\t\t\t\t\t\t\t$weights[$j] = $weight;\n\t\t\t\t\t\t\t\t\t$total += $weight;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$v = mt_rand(1, $total + 1);\n\t\t\t\t\t\t\t\t$sum = 0;\n\t\t\t\t\t\t\t\tfor($key = 0; $key < count($weights); ++$key){\n\t\t\t\t\t\t\t\t\t$sum += $weights[$key];\n\t\t\t\t\t\t\t\t\tif($sum >= $v){\n\t\t\t\t\t\t\t\t\t\t$key++;\n\t\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$key--;\n\n\t\t\t\t\t\t\t\t$enchantment = $possible[$key];\n\t\t\t\t\t\t\t\t$result[] = $enchantment;\n\t\t\t\t\t\t\t\tunset($possible[$key]);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$this->entries[$i] = new EnchantmentEntry($result, $level, Enchantment::getRandomName());\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->sendEnchantmentList();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onClose(Player $who){\n\t\tparent::onClose($who);\n\n\t\t$level = $this->getHolder()->getLevel();\n\t\tfor($i = 0; $i < 2; ++$i){\n\t\t\tif($level instanceof Level) $level->dropItem($this->getHolder()->add(0.5, 0.5, 0.5), $this->getItem($i));\n\t\t\t$this->clear($i);\n\t\t}\n\n\t\tif(count($this->getViewers()) === 0){\n\t\t\t$this->levels = null;\n\t\t\t$this->entries = null;\n\t\t\t$this->bookshelfAmount = 0;\n\t\t}\n\t}\n\n\t/**\n\t * @param Enchantment[] $ent1\n\t * @param Enchantment[] $ent2\n\t *\n\t * @return bool\n\t */\n\tpublic function checkEnts(array $ent1, array $ent2){\n\t\tforeach($ent1 as $enchantment){\n\t\t\t$hasResult = false;\n\t\t\tforeach($ent2 as $enchantment1){\n\t\t\t\tif($enchantment->equals($enchantment1)){\n\t\t\t\t\t$hasResult = true;\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!$hasResult){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function onEnchant(Player $who, Item $before, Item $after){\n\t\t$result = ($before->getId() === Item::BOOK) ? new EnchantedBook() : $before;\n\t\tif(!$before->hasEnchantments() and $after->hasEnchantments() and $after->getId() == $result->getId() and\n\t\t\t$this->levels != null and $this->entries != null\n\t\t){\n\t\t\t$enchantments = $after->getEnchantments();\n\t\t\tfor($i = 0; $i < 3; $i++){\n\t\t\t\tif($this->checkEnts($enchantments, $this->entries[$i]->getEnchantments())){\n\t\t\t\t\t$lapis = $this->getItem(1);\n\t\t\t\t\t$level = $who->getXpLevel();\n\t\t\t\t\t$cost = $this->entries[$i]->getCost();\n\t\t\t\t\tif($lapis->getId() == Item::DYE and $lapis->getDamage() == Dye::BLUE and $lapis->getCount() > $i and $level >= $cost){\n\t\t\t\t\t\tforeach($enchantments as $enchantment){\n\t\t\t\t\t\t\t$result->addEnchantment($enchantment);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->setItem(0, $result);\n\t\t\t\t\t\t$lapis->setCount($lapis->getCount() - $i - 1);\n\t\t\t\t\t\t$this->setItem(1, $lapis);\n\t\t\t\t\t\t$who->takeXpLevel($i + 1);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function countBookshelf() : int{\n\t\tif($this->getHolder()->getLevel()->getServer()->countBookshelf){\n\t\t\t$count = 0;\n\t\t\t$pos = $this->getHolder();\n\t\t\t$offsets = [[2, 0], [-2, 0], [0, 2], [0, -2], [2, 1], [2, -1], [-2, 1], [-2, 1], [1, 2], [-1, 2], [1, -2], [-1, -2]];\n\t\t\tfor($i = 0; $i < 3; $i++){\n\t\t\t\tforeach($offsets as $offset){\n\t\t\t\t\tif($pos->getLevel()->getBlockIdAt($pos->x + $offset[0], $pos->y + $i, $pos->z + $offset[1]) == Block::BOOKSHELF){\n\t\t\t\t\t\t$count++;\n\t\t\t\t\t}\n\t\t\t\t\tif($count >= 15){\n\t\t\t\t\t\tbreak 2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn $count;\n\t\t}else{\n\t\t\treturn mt_rand(0, 15);\n\t\t}\n\t}\n\n\tpublic function sendEnchantmentList(){\n\t\t$pk = new CraftingDataPacket();\n\t\tif($this->entries !== null and $this->levels !== null){\n\t\t\t$list = new EnchantmentList(count($this->entries));\n\t\t\tfor($i = 0; $i < count($this->entries); $i++){\n\t\t\t\t$list->setSlot($i, $this->entries[$i]);\n\t\t\t}\n\t\t\t$pk->addEnchantList($list);\n\t\t}\n\n\t\tServer::getInstance()->broadcastPacket($this->getViewers(), $pk);\n\t}\n\n\t/**\n\t * @param Enchantment   $enchantment\n\t * @param Enchantment[] $enchantments\n\t * @return Enchantment[]\n\t */\n\tpublic function removeConflictEnchantment(Enchantment $enchantment, array $enchantments){\n\t\tif(count($enchantments) > 0){\n\t\t\tforeach($enchantments as $e){\n\t\t\t\t$id = $e->getId();\n\t\t\t\tif($id == $enchantment->getId()){\n\t\t\t\t\tunset($enchantments[$id]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif($id >= 0 and $id <= 4 and $enchantment->getId() >= 0 and $enchantment->getId() <= 4){\n\t\t\t\t\t//Protection\n\t\t\t\t\tunset($enchantments[$id]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif($id >= 9 and $id <= 14 and $enchantment->getId() >= 9 and $enchantment->getId() <= 14){\n\t\t\t\t\t//Weapon\n\t\t\t\t\tunset($enchantments[$id]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tif(($id === Enchantment::TYPE_MINING_SILK_TOUCH and $enchantment->getId() === Enchantment::TYPE_MINING_FORTUNE) or ($id === Enchantment::TYPE_MINING_FORTUNE and $enchantment->getId() === Enchantment::TYPE_MINING_SILK_TOUCH)){\n\t\t\t\t\t//Protection\n\t\t\t\t\tunset($enchantments[$id]);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$result = [];\n\t\tif(count($enchantments) > 0){\n\t\t\tforeach($enchantments as $enchantment){\n\t\t\t\t$result[] = $enchantment;\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/inventory/EnderChestInventory.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\entity\\Human;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\Position;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\network\\protocol\\BlockEventPacket;\nuse pocketmine\\Player;\n\nclass EnderChestInventory extends ContainerInventory{\n\t \n\tprivate $owner;\n\n\tpublic function __construct(Human $owner, $contents = null){\n\t\t$this->owner = $owner;\n\t\tparent::__construct(new FakeBlockMenu($this, $owner), InventoryType::get(InventoryType::ENDER_CHEST));\n\n\t\tif($contents !== null){\n\t\t\tif($contents instanceof ListTag){\n \t\t\tforeach($contents as $item){\n \t\t\t\t$this->setItem($item[\"Slot\"], Item::nbtDeserialize($item));\n \t\t\t}\n \t\t}else{\n\t\t\t\tthrow new \\InvalidArgumentException(\"Expecting ListTag, received \" . gettype($contents));\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getOwner(){\n\t\treturn $this->owner;\n\t}\n \n\tpublic function openAt(Position $pos){\n\t\t$this->getHolder()->setComponents($pos->x, $pos->y, $pos->z);\n\t\t$this->getHolder()->setLevel($pos->getLevel());\n\t\t$this->owner->addWindow($this);\n\t}\n \n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n\n\tpublic function onOpen(Player $who){\n\t\tparent::onOpen($who);\n\n\t\tif(count($this->getViewers()) === 1){\n\t\t\t$pk = new BlockEventPacket();\n\t\t\t$pk->x = $this->getHolder()->getX();\n\t\t\t$pk->y = $this->getHolder()->getY();\n\t\t\t$pk->z = $this->getHolder()->getZ();\n\t\t\t$pk->case1 = 1;\n\t\t\t$pk->case2 = 2;\n\t\t\tif(($level = $this->getHolder()->getLevel()) instanceof Level){\n\t\t\t\t$level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onClose(Player $who){\n\t\tif(count($this->getViewers()) === 1){\n\t\t\t$pk = new BlockEventPacket();\n\t\t\t$pk->x = $this->getHolder()->getX();\n\t\t\t$pk->y = $this->getHolder()->getY();\n\t\t\t$pk->z = $this->getHolder()->getZ();\n\t\t\t$pk->case1 = 1;\n\t\t\t$pk->case2 = 0;\n\t\t\tif(($level = $this->getHolder()->getLevel()) instanceof Level){\n\t\t\t\t$level->addChunkPacket($this->getHolder()->getX() >> 4, $this->getHolder()->getZ() >> 4, $pk);\n\t\t\t}\n\t\t}\n\n\t\tparent::onClose($who);\n\t}\n\n} "
  },
  {
    "path": "src/pocketmine/inventory/FakeBlockMenu.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\n\nuse pocketmine\\level\\Position;\n\n\nclass FakeBlockMenu extends Position implements InventoryHolder{\n\n\tprivate $inventory;\n\n\tpublic function __construct(Inventory $inventory, Position $pos){\n\t\t$this->inventory = $inventory;\n\t\tparent::__construct($pos->x, $pos->y, $pos->z, $pos->level);\n\t}\n\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/FloatingInventory.php",
    "content": "<?php\n\n/**\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\n/**\n * The in-between inventory where items involved in transactions are stored temporarily\n */\nclass FloatingInventory extends BaseInventory{\n\n\t/**\n\t * @param InventoryHolder $holder\n\t * @param InventoryType   $inventoryType\n\t */\n\tpublic function __construct(InventoryHolder $holder){\n\t\tparent::__construct($holder, InventoryType::get(InventoryType::PLAYER_FLOATING));\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/Fuel.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\n\n//TODO: remove this\nabstract class Fuel{\n\tpublic static $duration = [\n\t\tItem::COAL => 1600,\n\t\tItem::COAL_BLOCK => 16000,\n\t\tItem::TRUNK => 300,\n\t\t//Item::BROWN_MUSHROOM_BLOCK => 300,\n\t\t//Item::RED_MUSHROOM_BLOCK => 300,\n\t\tItem::WOODEN_PLANKS => 300,\n\t\tItem::SAPLING => 100,\n\t\tItem::WOODEN_AXE => 200,\n\t\tItem::WOODEN_PICKAXE => 200,\n\t\tItem::WOODEN_SWORD => 200,\n\t\tItem::WOODEN_SHOVEL => 200,\n\t\tItem::WOODEN_HOE => 200,\n\t\tItem::WOODEN_PRESSURE_PLATE => 300,\n\t\tItem::STICK => 100,\n\t\tItem::FENCE => 300,\n\t\tItem::FENCE_GATE => 300,\n\t\tItem::FENCE_GATE_SPRUCE => 300,\n\t\tItem::FENCE_GATE_BIRCH => 300,\n\t\tItem::FENCE_GATE_JUNGLE => 300,\n\t\tItem::FENCE_GATE_ACACIA => 300,\n\t\tItem::FENCE_GATE_DARK_OAK => 300,\n\t\tItem::WOODEN_STAIRS => 300,\n\t\tItem::SPRUCE_WOOD_STAIRS => 300,\n\t\tItem::BIRCH_WOOD_STAIRS => 300,\n\t\tItem::JUNGLE_WOOD_STAIRS => 300,\n\t\tItem::TRAPDOOR => 300,\n\t\tItem::WORKBENCH => 300,\n\t\tItem::NOTEBLOCK => 300,\n\t\tItem::BOOKSHELF => 300,\n\t\tItem::CHEST => 300,\n\t\tItem::TRAPPED_CHEST => 300,\n\t\tItem::DAYLIGHT_SENSOR => 300,\n\t\tItem::BUCKET => 20000,\n\t\tItem::BLAZE_ROD => 2400,\n\t];\n\n}"
  },
  {
    "path": "src/pocketmine/inventory/FurnaceInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\tile\\Furnace;\n\nclass FurnaceInventory extends ContainerInventory{\n\n\tconst SMELTING = 0;\n\tconst FUEL = 1;\n\tconst RESULT = 2;\n\n\tpublic function __construct(Furnace $tile){\n\t\tparent::__construct($tile, InventoryType::get(InventoryType::FURNACE));\n\t}\n\n\t/**\n\t * @return Furnace\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getResult(){\n\t\treturn $this->getItem(self::RESULT);\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getFuel(){\n\t\treturn $this->getItem(self::FUEL);\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getSmelting(){\n\t\treturn $this->getItem(self::SMELTING);\n\t}\n\n\t/**\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setResult(Item $item){\n\t\treturn $this->setItem(self::RESULT, $item);\n\t}\n\n\t/**\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setFuel(Item $item){\n\t\treturn $this->setItem(self::FUEL, $item);\n\t}\n\n\t/**\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setSmelting(Item $item){\n\t\treturn $this->setItem(self::SMELTING, $item);\n\t}\n\n\tpublic function onSlotChange($index, $before, $send){\n\t\tparent::onSlotChange($index, $before, $send);\n\n\t\t$this->getHolder()->scheduleUpdate();\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/inventory/FurnaceRecipe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\UUID;\n\nclass FurnaceRecipe implements Recipe{\n\n\tprivate $id = null;\n\n\t/** @var Item */\n\tprivate $output;\n\n\t/** @var Item */\n\tprivate $ingredient;\n\n\t/**\n\t * @param Item $result\n\t * @param Item $ingredient\n\t */\n\tpublic function __construct(Item $result, Item $ingredient){\n\t\t$this->output = clone $result;\n\t\t$this->ingredient = clone $ingredient;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function setId(UUID $id){\n\t\tif($this->id !== null){\n\t\t\tthrow new \\InvalidStateException(\"Id is already set\");\n\t\t}\n\n\t\t$this->id = $id;\n\t}\n\n\t/**\n\t * @param Item $item\n\t */\n\tpublic function setInput(Item $item){\n\t\t$this->ingredient = clone $item;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getInput(){\n\t\treturn clone $this->ingredient;\n\t}\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getResult(){\n\t\treturn clone $this->output;\n\t}\n\n\tpublic function registerToCraftingManager(){\n\t\tServer::getInstance()->getCraftingManager()->registerFurnaceRecipe($this);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/HopperInventory.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\tile\\Hopper;\n\nclass HopperInventory extends ContainerInventory{\n\tpublic function __construct(Hopper $tile){\n\t\tparent::__construct($tile, InventoryType::get(InventoryType::HOPPER));\n\t}\n\n\t/**\n\t * @return Hopper\n\t */\n\tpublic function getHolder(){\n\t\treturn $this->holder;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/Inventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Handles the creation of virtual inventories or mapped to an InventoryHolder\n */\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\ninterface Inventory{\n\tconst MAX_STACK = 64;\n\n\tpublic function getSize();\n\n\tpublic function getMaxStackSize();\n\n\t/**\n\t * @param int $size\n\t */\n\tpublic function setMaxStackSize($size);\n\n\tpublic function getName();\n\n\tpublic function getTitle();\n\n\t/**\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index);\n\n\t/**\n\t * Puts an Item in a slot.\n\t * If a plugin refuses the update or $index is invalid, it'll return false\n\t * If a source Player is specified, it won't send a Inventory update to it\n\t *\n\t * @param int    $index\n\t * @param Item   $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setItem($index, Item $item);\n\n\t/**\n\t * Stores the given Items in the inventory. This will try to fill\n\t * existing stacks and empty slots as well as it can.\n\t *\n\t * Returns the Items that did not fit.\n\t *\n\t * @param Item ...$item\n\t *\n\t * @return Item[]\n\t */\n\tpublic function addItem(...$slots);\n\n\t/**\n\t * Checks if a given Item can be added to the inventory\n\t *\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function canAddItem(Item $item);\n\n\t/**\n\t * Removes the given Item from the inventory.\n\t * It will return the Items that couldn't be removed.\n\t *\n\t * @param Item ...$item\n\t *\n\t * @return Item[]\n\t */\n\tpublic function removeItem(...$slots);\n\n\t/**\n\t * @return Item[]\n\t */\n\tpublic function getContents();\n\n\t/**\n\t * @param Item[] $items\n\t */\n\tpublic function setContents(array $items);\n\n\t/**\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendContents($target);\n\n\t/**\n\t * @param int             $index\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendSlot($index, $target);\n\n\t/**\n\t * Checks if the inventory contains any Item with the same material data.\n\t * It will check id, amount, and metadata (if not null)\n\t *\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function contains(Item $item);\n\n\t/**\n\t * Will return all the Items that has the same id and metadata (if not null).\n\t * Won't check amount\n\t *\n\t * @param Item $item\n\t *\n\t * @return Item[]\n\t */\n\tpublic function all(Item $item);\n\n\t/**\n\t * Will return the first slot has the same id and metadata (if not null) as the Item.\n\t * -1 if not found, will check amount\n\t *\n\t * @param Item $item\n\t *\n\t * @return int\n\t */\n\tpublic function first(Item $item);\n\n\t/**\n\t * Returns the first empty slot, or -1 if not found\n\t *\n\t * @return int\n\t */\n\tpublic function firstEmpty();\n\n\t/**\n\t * Will remove all the Items that has the same id and metadata (if not null)\n\t *\n\t * @param Item $item\n\t */\n\tpublic function remove(Item $item);\n\n\t/**\n\t * Will clear a specific slot\n\t *\n\t * @param int    $index\n\t *\n\t * @return bool\n\t */\n\tpublic function clear($index);\n\n\t/**\n\t * Clears all the slots\n\t */\n\tpublic function clearAll();\n\n\t/**\n\t * Gets all the Players viewing the inventory\n\t * Players will view their inventory at all times, even when not open.\n\t *\n\t * @return Player[]\n\t */\n\tpublic function getViewers();\n\n\t/**\n\t * @return InventoryType\n\t */\n\tpublic function getType();\n\n\t/**\n\t * @return InventoryHolder\n\t */\n\tpublic function getHolder();\n\n\t/**\n\t * @param Player $who\n\t */\n\tpublic function onOpen(Player $who);\n\n\t/**\n\t * Tries to open the inventory to a player\n\t *\n\t * @param Player $who\n\t *\n\t * @return bool\n\t */\n\tpublic function open(Player $who);\n\n\tpublic function close(Player $who);\n\n\t/**\n\t * @param Player $who\n\t */\n\tpublic function onClose(Player $who);\n\n\t/**\n\t * @param int    $index\n\t * @param Item   $before\n\t * @param bool   $send\n\t */\n\tpublic function onSlotChange($index, $before, $send);\n}\n"
  },
  {
    "path": "src/pocketmine/inventory/InventoryHolder.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\ninterface InventoryHolder{\n\n\t/**\n\t * Get the object related inventory\n\t *\n\t * @return Inventory\n\t */\n\tpublic function getInventory();\n}"
  },
  {
    "path": "src/pocketmine/inventory/InventoryType.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\n/**\n * Saves all the information regarding default inventory sizes and types\n */\nclass InventoryType{\n\tconst CHEST = 0;\n\tconst DOUBLE_CHEST = 1;\n\tconst PLAYER = 2;\n\tconst FURNACE = 3;\n\tconst CRAFTING = 4;\n\tconst WORKBENCH = 5;\n\t//const STONECUTTER = 6;\n\tconst BREWING_STAND = 7;\n\tconst ANVIL = 8;\n\tconst ENCHANT_TABLE = 9;\n\tconst DISPENSER = 10;\n\tconst DROPPER = 11;\n\tconst HOPPER = 12;\n\tconst ENDER_CHEST = 13;\n\n\tconst PLAYER_FLOATING = 254;\n\n\tprivate static $default = [];\n\n\tprivate $size;\n\tprivate $title;\n\tprivate $typeId;\n\n\t/**\n\t * @param $index\n\t *\n\t * @return InventoryType\n\t */\n\tpublic static function get($index){\n\t\treturn isset(static::$default[$index]) ? static::$default[$index] : null;\n\t}\n\n\tpublic static function init(){\n\t\tif(count(static::$default) > 0){\n\t\t\treturn;\n\t\t}\n\n\t\tstatic::$default[static::CHEST] = new InventoryType(27, \"Chest\", 0);\n\t\tstatic::$default[static::DOUBLE_CHEST] = new InventoryType(27 + 27, \"Double Chest\", 0);\n\t\tstatic::$default[static::PLAYER] = new InventoryType(36 + 4, \"Player\", 0); //36 CONTAINER, 4 ARMOR\n\t\tstatic::$default[static::FURNACE] = new InventoryType(3, \"Furnace\", 2);\n\t\tstatic::$default[static::CRAFTING] = new InventoryType(5, \"Crafting\", 1); //4 CRAFTING slots, 1 RESULT\n\t\tstatic::$default[static::WORKBENCH] = new InventoryType(10, \"Crafting\", 1); //9 CRAFTING slots, 1 RESULT\n\t\tstatic::$default[static::ENCHANT_TABLE] = new InventoryType(2, \"Enchant\", 3); //1 INPUT/OUTPUT, 1 LAPIS\n\t\tstatic::$default[static::BREWING_STAND] = new InventoryType(4, \"Brewing\", 4); //1 INPUT, 3 POTION\n\t\tstatic::$default[static::ANVIL] = new InventoryType(3, \"Anvil\", 5); //2 INPUT, 1 OUTPUT\n\t\tstatic::$default[static::DISPENSER] = new InventoryType(9, \"Dispenser\", 6); //9 CONTAINER\n\t\tstatic::$default[static::DROPPER] = new InventoryType(9, \"Dropper\", 7); //9 CONTAINER\n\t\tstatic::$default[static::HOPPER] = new InventoryType(5, \"Hopper\", 8); //5 CONTAINER\n\t\tstatic::$default[static::ENDER_CHEST] = new InventoryType(27, \"EnderChest\", 0);\n\n\t\tstatic::$default[static::PLAYER_FLOATING] = new InventoryType(36, \"Floating\", null); //Mirror all slots of main inventory (needed for large item pickups)\n\t}\n\n\t/**\n\t * @param int    $defaultSize\n\t * @param string $defaultTitle\n\t * @param int    $typeId\n\t */\n\tprivate function __construct($defaultSize, $defaultTitle, $typeId = 0){\n\t\t$this->size = $defaultSize;\n\t\t$this->title = $defaultTitle;\n\t\t$this->typeId = $typeId;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getDefaultSize(){\n\t\treturn $this->size;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getDefaultTitle(){\n\t\treturn $this->title;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getNetworkType(){\n\t\treturn $this->typeId;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/MultiRecipe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\utils\\UUID;\n\nclass MultiRecipe{\n\n\tprivate $uuid;\n\n\tpublic function __construct(UUID $uuid){\n\t\t$this->uuid = $uuid;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/inventory/PlayerInventory.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\entity\\Human;\nuse pocketmine\\event\\entity\\EntityArmorChangeEvent;\nuse pocketmine\\event\\entity\\EntityInventoryChangeEvent;\nuse pocketmine\\event\\player\\PlayerItemHeldEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\network\\protocol\\ContainerSetContentPacket;\nuse pocketmine\\network\\protocol\\ContainerSetSlotPacket;\nuse pocketmine\\network\\protocol\\MobArmorEquipmentPacket;\nuse pocketmine\\network\\protocol\\MobEquipmentPacket;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nclass PlayerInventory extends BaseInventory{\n\n\tprotected $itemInHandIndex = 0;\n\t/** @var int[] */\n\tprotected $hotbar;\n\n\tpublic function __construct(Human $player, $contents = null){\n\t\t$this->hotbar = range(0, $this->getHotbarSize() - 1, 1);\n\t\tparent::__construct($player, InventoryType::get(InventoryType::PLAYER));\n\n\t\tif($contents !== null){\n\t\t\tif($contents instanceof ListTag){ //Saved data to be loaded into the inventory\n\t\t\t\tforeach($contents as $item){\n\t\t\t\t\tif($item[\"Slot\"] >= 0 and $item[\"Slot\"] < $this->getHotbarSize()){ //Hotbar\n\t\t\t\t\t\tif(isset($item[\"TrueSlot\"])){\n\n\t\t\t\t\t\t\t//Valid slot was found, change the linkage to this slot\n\t\t\t\t\t\t\tif(0 <= $item[\"TrueSlot\"] and $item[\"TrueSlot\"] < $this->getSize()){\n\t\t\t\t\t\t\t\t$this->hotbar[$item[\"Slot\"]] = $item[\"TrueSlot\"];\n\n\t\t\t\t\t\t\t}elseif($item[\"TrueSlot\"] < 0){ //Link to an empty slot (empty hand)\n\t\t\t\t\t\t\t\t$this->hotbar[$item[\"Slot\"]] = -1;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\t/* If TrueSlot is not set, leave the slot index as its default which was filled in above\n\t\t\t\t\t\t * This only overwrites slot indexes for valid links */\n\t\t\t\t\t}elseif($item[\"Slot\"] >= 100 and $item[\"Slot\"] < 104){ //Armor\n\t\t\t\t\t\t$this->setItem($this->getSize() + $item[\"Slot\"] - 100, Item::nbtDeserialize($item), false);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->setItem($item[\"Slot\"] - $this->getHotbarSize(), Item::nbtDeserialize($item), false);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tthrow new \\InvalidArgumentException(\"Expecting ListTag, received \".gettype($contents));\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getSize(){\n\t\treturn parent::getSize() - 4; //Remove armor slots\n\t}\n\n\tpublic function setSize($size){\n\t\tparent::setSize($size + 4);\n\t\t$this->sendContents($this->getViewers());\n\t}\n\n\t/**\n\t * @param int $index\n\t *\n\t * @return int\n\t *\n\t * Returns the index of the inventory slot linked to the specified hotbar slot\n\t */\n\tpublic function getHotbarSlotIndex($index){\n\t\treturn ($index >= 0 and $index < $this->getHotbarSize()) ? $this->hotbar[$index] : -1;\n\t}\n\n\t/**\n\t * @deprecated\n\t *\n\t * Changes the linkage of the specified hotbar slot. This should never be done unless it is requested by the client.\n\t */\n\tpublic function setHotbarSlotIndex($index, $slot){\n\t\tif($this->getHolder()->getServer()->getProperty(\"settings.deprecated-verbose\") !== false){\n\t\t\ttrigger_error(\"Do not attempt to change hotbar links in plugins!\", E_USER_DEPRECATED);\n\t\t}\n\t}\n\n\t/**\n\t * @return int\n\t *\n\t * Returns the index of the inventory slot the player is currently holding\n\t */\n\tpublic function getHeldItemIndex(){\n\t\treturn $this->itemInHandIndex;\n\t}\n\n\t/**\n\t * @param int  $hotbarSlotIndex\n\t * @param bool $sendToHolder\n\t * @param int  $slotMapping\n\t *\n\t * Sets which hotbar slot the player is currently holding.\n\t * Allows slot remapping as specified by a MobEquipmentPacket. DO NOT CHANGE SLOT MAPPING IN PLUGINS!\n\t * This new implementation is fully compatible with older APIs.\n\t * NOTE: Slot mapping is the raw slot index sent by MCPE, which will be between 9 and 44.\n\t */\n\tpublic function setHeldItemIndex($hotbarSlotIndex, $sendToHolder = true, $slotMapping = null){\n\t\tif($slotMapping !== null){\n\t\t\t//Get the index of the slot in the actual inventory\n\t\t\t$slotMapping -= $this->getHotbarSize();\n\t\t}\n\t\tif(0 <= $hotbarSlotIndex and $hotbarSlotIndex < $this->getHotbarSize()){\n\t\t\t$this->itemInHandIndex = $hotbarSlotIndex;\n\t\t\tif($slotMapping !== null){\n\t\t\t\t/* Handle a hotbar slot mapping change. This allows PE to select different inventory slots.\n\t\t\t\t * This is the only time slot mapping should ever be changed. */\n\n\t\t\t\tif($slotMapping < 0 or $slotMapping >= $this->getSize()){\n\t\t\t\t\t//Mapping was not in range of the inventory, set it to -1\n\t\t\t\t\t//This happens if the client selected a blank slot (sends 255)\n\t\t\t\t\t$slotMapping = -1;\n\t\t\t\t}\n\n\t\t\t\t$item = $this->getItem($slotMapping);\n\t\t\t\tif($this->getHolder() instanceof Player){\n\t\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new PlayerItemHeldEvent($this->getHolder(), $item, $slotMapping, $hotbarSlotIndex));\n\t\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\t\t$this->sendHeldItem($this->getHolder());\n\t\t\t\t\t\t$this->sendContents($this->getHolder());\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(($key = array_search($slotMapping, $this->hotbar)) !== false and $slotMapping !== -1){\n\t\t\t\t\t/* Do not do slot swaps if the slot was null\n\t\t\t\t\t * Chosen slot is already linked to a hotbar slot, swap the two slots around.\n\t\t\t\t\t * This will already have been done on the client-side so no changes need to be sent. */\n\t\t\t\t\t$this->hotbar[$key] = $this->hotbar[$this->itemInHandIndex];\n\t\t\t\t}\n\n\t\t\t\t$this->hotbar[$this->itemInHandIndex] = $slotMapping;\n\t\t\t}\n\t\t\t$this->sendHeldItem($this->getHolder()->getViewers());\n\t\t\tif($sendToHolder){\n\t\t\t\t$this->sendHeldItem($this->getHolder());\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return Item\n\t *\n\t * Returns the item the player is currently holding\n\t */\n\tpublic function getItemInHand(){\n\t\t$item = $this->getItem($this->getHeldItemSlot());\n\t\tif($item instanceof Item){\n\t\t\treturn $item;\n\t\t}else{\n\t\t\treturn Item::get(Item::AIR, 0, 0);\n\t\t}\n\t}\n\n\t/**\n\t * @param Item $item\n\t *\n\t * @return bool\n\t *\n\t * Sets the item in the inventory slot the player is currently holding.\n\t */\n\tpublic function setItemInHand(Item $item){\n\t\treturn $this->setItem($this->getHeldItemSlot(), $item);\n\t}\n\n\t/**\n\t * @return int[]\n\t *\n\t * Returns an array of hotbar indices\n\t */\n\tpublic function getHotbar(){\n\t\treturn $this->hotbar;\n\t}\n\n\t/**\n\t * @return int\n\t *\n\t * Returns the inventory slot index of the currently equipped slot\n\t */\n\tpublic function getHeldItemSlot(){\n\t\treturn $this->getHotbarSlotIndex($this->itemInHandIndex);\n\t}\n\n\t/**\n\t * @deprecated\n\t * @param int $slot\n\t */\n\tpublic function setHeldItemSlot($slot){\n\t}\n\n\t/**\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendHeldItem($target){\n\t\t$item = $this->getItemInHand();\n\n\t\t$pk = new MobEquipmentPacket();\n\t\t$pk->eid = ($target === $this->getHolder() ? 0 : $this->getHolder()->getId());\n\t\t$pk->item = $item;\n\t\t$pk->slot = $this->getHeldItemSlot();\n\t\t$pk->selectedSlot = $this->getHeldItemIndex();\n\n\t\tif(!is_array($target)){\n\t\t\t$target->dataPacket($pk);\n\t\t\tif($target === $this->getHolder()){\n\t\t\t\t$this->sendSlot($this->getHeldItemSlot(), $target);\n\t\t\t}\n\t\t}else{\n\t\t\t$this->getHolder()->getLevel()->getServer()->broadcastPacket($target, $pk);\n\t\t\tforeach($target as $player){\n\t\t\t\tif($player === $this->getHolder()){\n\t\t\t\t\t$this->sendSlot($this->getHeldItemSlot(), $player);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function onSlotChange($index, $before, $send){\n\t\tif($send){\n\t\t\t$holder = $this->getHolder();\n\t\t\tif(!$holder instanceof Player or !$holder->spawned){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tparent::onSlotChange($index, $before, $send);\n\t\t}\n\t\tif($index === $this->itemInHandIndex){\n\t\t\t$this->sendHeldItem($this->getHolder()->getViewers());\n\t\t\tif($send){\n\t\t\t\t$this->sendHeldItem($this->getHolder());\n\t\t\t}\n\n\t\t}elseif($index >= $this->getSize()){ //Armour equipment\n\t\t\t$this->sendArmorSlot($index, $this->getViewers());\n\t\t\t$this->sendArmorSlot($index, $this->getHolder()->getViewers());\n\t\t}\n\t}\n\n\tpublic function getHotbarSize(){\n\t\treturn 9;\n\t}\n\n\tpublic function getArmorItem($index){\n\t\treturn $this->getItem($this->getSize() + $index);\n\t}\n\n\tpublic function setArmorItem($index, Item $item){\n\t\treturn $this->setItem($this->getSize() + $index, $item);\n\t}\n\t\n\tpublic function damageArmor($index, $cost){\n \t\t$this->slots[$this->getSize() + $index]->useOn($this->slots[$this->getSize() + $index], $cost);\n \t    if($this->slots[$this->getSize() + $index]->getDamage() >= $this->slots[$this->getSize() + $index]->getMaxDurability()){\n \t\t$this->setItem($this->getSize() + $index, Item::get(Item::AIR, 0, 0));\n\t\t}\n \t\t$this->sendArmorContents($this->getViewers());\n \t}\n\n\tpublic function getHelmet(){\n\t\treturn $this->getItem($this->getSize());\n\t}\n\n\tpublic function getChestplate(){\n\t\treturn $this->getItem($this->getSize() + 1);\n\t}\n\n\tpublic function getLeggings(){\n\t\treturn $this->getItem($this->getSize() + 2);\n\t}\n\n\tpublic function getBoots(){\n\t\treturn $this->getItem($this->getSize() + 3);\n\t}\n\n\tpublic function setHelmet(Item $helmet){\n\t\treturn $this->setItem($this->getSize(), $helmet);\n\t}\n\n\tpublic function setChestplate(Item $chestplate){\n\t\treturn $this->setItem($this->getSize() + 1, $chestplate);\n\t}\n\n\tpublic function setLeggings(Item $leggings){\n\t\treturn $this->setItem($this->getSize() + 2, $leggings);\n\t}\n\n\tpublic function setBoots(Item $boots){\n\t\treturn $this->setItem($this->getSize() + 3, $boots);\n\t}\n\n\tpublic function setItem($index, Item $item, $send = true){\n\t\tif($index < 0 or $index >= $this->size){\n\t\t\treturn false;\n\t\t}elseif($item->getId() === 0 or $item->getCount() <= 0){\n\t\t\treturn $this->clear($index, $send);\n\t\t}\n\n\t\tif($index >= $this->getSize()){ //Armor change\n\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityArmorChangeEvent($this->getHolder(), $this->getItem($index), $item, $index));\n\t\t\tif($ev->isCancelled() and $this->getHolder() instanceof Human){\n\t\t\t\t$this->sendArmorSlot($index, $this->getViewers());\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$item = $ev->getNewItem();\n\t\t}else{\n\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($this->getHolder(), $this->getItem($index), $item, $index));\n\t\t\tif($ev->isCancelled()){\n\t\t\t\t$this->sendSlot($index, $this->getViewers());\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$item = $ev->getNewItem();\n\t\t}\n\n\n\t\t$old = $this->getItem($index);\n\t\t$this->slots[$index] = clone $item;\n\t\t$this->onSlotChange($index, $old, $send);\n\n\t\treturn true;\n\t}\n\n\tpublic function clear($index, $send = true){\n\t\tif(isset($this->slots[$index])){\n\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t\t$old = $this->slots[$index];\n\t\t\tif($index >= $this->getSize() and $index < $this->size){ //Armor change\n\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityArmorChangeEvent($this->getHolder(), $old, $item, $index));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\tif($index >= $this->size){\n\t\t\t\t\t\t$this->sendArmorSlot($index, $this->getViewers());\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->sendSlot($index, $this->getViewers());\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$item = $ev->getNewItem();\n\t\t\t}else{\n\t\t\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityInventoryChangeEvent($this->getHolder(), $old, $item, $index));\n\t\t\t\tif($ev->isCancelled()){\n\t\t\t\t\tif($index >= $this->size){\n\t\t\t\t\t\t$this->sendArmorSlot($index, $this->getViewers());\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->sendSlot($index, $this->getViewers());\n\t\t\t\t\t}\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\t$item = $ev->getNewItem();\n\t\t\t}\n\t\t\tif($item->getId() !== Item::AIR){\n\t\t\t\t$this->slots[$index] = clone $item;\n\t\t\t}else{\n\t\t\t\tunset($this->slots[$index]);\n\t\t\t}\n\n\t\t\t$this->onSlotChange($index, $old, $send);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return Item[]\n\t */\n\tpublic function getArmorContents(){\n\t\t$armor = [];\n\n\t\tfor($i = 0; $i < 4; ++$i){\n\t\t\t$armor[$i] = $this->getItem($this->getSize() + $i);\n\t\t}\n\n\t\treturn $armor;\n\t}\n\n\tpublic function clearAll(){\n\t\t$limit = $this->getSize() + 4;\n\t\tfor($index = 0; $index < $limit; ++$index){\n\t\t\t$this->clear($index, false);\n\t\t}\n\t\t$this->hotbar = range(0, $this->getHotbarSize() - 1, 1);\n\t\t$this->sendContents($this->getViewers());\n\t}\n\n\t/**\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendArmorContents($target){\n\t\tif($target instanceof Player){\n\t\t\t$target = [$target];\n\t\t}\n\n\t\t$armor = $this->getArmorContents();\n\n\t\t$pk = new MobArmorEquipmentPacket();\n\t\t$pk->eid = $this->getHolder()->getId();\n\t\t$pk->slots = $armor;\n\t\t$pk->encode();\n\t\t$pk->isEncoded = true;\n\n\t\tforeach($target as $player){\n\t\t\tif($player === $this->getHolder()){\n\t\t\t\t$pk2 = new ContainerSetContentPacket();\n\t\t\t\t$pk2->windowid = ContainerSetContentPacket::SPECIAL_ARMOR;\n\t\t\t\t$pk2->slots = $armor;\n\t\t\t\t$player->dataPacket($pk2);\n\t\t\t}else{\n\t\t\t\t$player->dataPacket($pk);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param Item[] $items\n\t */\n\tpublic function setArmorContents(array $items){\n\t\tfor($i = 0; $i < 4; ++$i){\n\t\t\tif(!isset($items[$i]) or !($items[$i] instanceof Item)){\n\t\t\t\t$items[$i] = Item::get(Item::AIR, 0, 0);\n\t\t\t}\n\n\t\t\tif($items[$i]->getId() === Item::AIR){\n\t\t\t\t$this->clear($this->getSize() + $i);\n\t\t\t}else{\n\t\t\t\t$this->setItem($this->getSize() + $i, $items[$i]);\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * @param int             $index\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendArmorSlot($index, $target){\n\t\tif($target instanceof Player){\n\t\t\t$target = [$target];\n\t\t}\n\n\t\t$armor = $this->getArmorContents();\n\n\t\t$pk = new MobArmorEquipmentPacket();\n\t\t$pk->eid = $this->getHolder()->getId();\n\t\t$pk->slots = $armor;\n\t\t$pk->encode();\n\t\t$pk->isEncoded = true;\n\n\t\tforeach($target as $player){\n\t\t\tif($player === $this->getHolder()){\n\t\t\t\t/** @var Player $player */\n\t\t\t\t$pk2 = new ContainerSetSlotPacket();\n\t\t\t\t$pk2->windowid = ContainerSetContentPacket::SPECIAL_ARMOR;\n\t\t\t\t$pk2->slot = $index - $this->getSize();\n\t\t\t\t$pk2->item = $this->getItem($index);\n\t\t\t\t$player->dataPacket($pk2);\n\t\t\t}else{\n\t\t\t\t$player->dataPacket($pk);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendContents($target){\n\t\tif($target instanceof Player){\n\t\t\t$target = [$target];\n\t\t}\n\n\t\t$pk = new ContainerSetContentPacket();\n\t\t$pk->slots = [];\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){ //Do not send armor by error here\n\t\t\t$pk->slots[$i] = $this->getItem($i);\n\t\t}\n\n\t\t//Because PE is stupid and shows 9 less slots than you send it, give it 9 dummy slots so it shows all the REAL slots.\n\t\tfor($i = $this->getSize(); $i < $this->getSize() + $this->getHotbarSize(); ++$i){\n\t\t\t$pk->slots[$i] = Item::get(Item::AIR, 0, 0);\n\t\t}\n\n\t\tforeach($target as $player){\n\t\t\t$pk->hotbar = [];\n\t\t\tif($player === $this->getHolder()){\n\t\t\t\tfor($i = 0; $i < $this->getHotbarSize(); ++$i){\n\t\t\t\t\t$index = $this->getHotbarSlotIndex($i);\n\t\t\t\t\t$pk->hotbar[$i] = $index <= -1 ? -1 : $index + $this->getHotbarSize();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(($id = $player->getWindowId($this)) === -1 or $player->spawned !== true){\n\t\t\t\t$this->close($player);\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$pk->windowid = $id;\n\t\t\t$player->dataPacket(clone $pk);\n\t\t}\n\t}\n\n\t/**\n\t * @param int             $index\n\t * @param Player|Player[] $target\n\t */\n\tpublic function sendSlot($index, $target){\n\t\tif($target instanceof Player){\n\t\t\t$target = [$target];\n\t\t}\n\n\t\t$pk = new ContainerSetSlotPacket();\n\t\t$pk->slot = $index;\n\t\t$pk->item = clone $this->getItem($index);\n\n\t\tforeach($target as $player){\n\t\t\tif($player === $this->getHolder()){\n\t\t\t\t/** @var Player $player */\n\t\t\t\t$pk->windowid = 0;\n\t\t\t\t$player->dataPacket(clone $pk);\n\t\t\t}else{\n\t\t\t\tif(($id = $player->getWindowId($this)) === -1){\n\t\t\t\t\t$this->close($player);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$pk->windowid = $id;\n\t\t\t\t$player->dataPacket(clone $pk);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return Human|Player\n\t */\n\tpublic function getHolder(){\n\t\treturn parent::getHolder();\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/inventory/Recipe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\utils\\UUID;\n\ninterface Recipe{\n\n\t/**\n\t * @return \\pocketmine\\item\\Item\n\t */\n\tpublic function getResult();\n\n\tpublic function registerToCraftingManager();\n\n\t/**\n\t * @return UUID\n\t */\n\tpublic function getId();\n}"
  },
  {
    "path": "src/pocketmine/inventory/ShapedRecipe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\UUID;\nuse pocketmine\\math\\Vector2;\n\nclass ShapedRecipe implements Recipe{\n\t/** @var Item */\n\tprivate $output;\n\n\tprivate $id = null;\n\n\t/** @var string[] */\n\tprivate $shape = [];\n\n\t/** @var Item[][] */\n\tprivate $ingredients = [];\n\t/** @var Vector2[][] */\n\tprivate $shapeItems = [];\n\n\t/**\n\t * @param Item $result\n\t * @param int  $height\n\t * @param int  $width\n\t *\n\t * @throws \\Exception\n\t */\n\tpublic function __construct(Item $result, $height, $width){\n\t\tfor($h = 0; $h < $height; $h++){\n\t\t\tif($width === 0 or $width > 3){\n\t\t\t\tthrow new \\InvalidStateException(\"Crafting rows should be 1, 2, 3 wide, not $width\");\n\t\t\t}\n\t\t\t$this->ingredients[] = array_fill(0, $width, null);\n\t\t}\n\n\t\t$this->output = clone $result;\n\t}\n\n\tpublic function getWidth(){\n\t\treturn count($this->ingredients[0]);\n\t}\n\n\tpublic function getHeight(){\n\t\treturn count($this->ingredients);\n\t}\n\n\tpublic function getResult(){\n\t\treturn $this->output;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function setId(UUID $id){\n\t\tif($this->id !== null){\n\t\t\tthrow new \\InvalidStateException(\"Id is already set\");\n\t\t}\n\n\t\t$this->id = $id;\n\t}\n\n\tpublic function addIngredient($x, $y, Item $item){\n\t\t$this->ingredients[$y][$x] = clone $item;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * @param string $key\n\t * @param Item   $item\n\t *\n\t * @return $this\n\t * @throws \\Exception\n\t */\n\tpublic function setIngredient($key, Item $item){\n\t\tif(!array_key_exists($key, $this->shape)){\n\t\t\tthrow new \\Exception(\"Symbol does not appear in the shape: \" . $key);\n\t\t}\n\n\t\t$item->setCount(1);\n\t\t$this->fixRecipe($key, $item);\n\n\t\treturn $this;\n\t}\n\n\tprotected function fixRecipe($key, $item){\n\t\tforeach($this->shapeItems[$key] as $entry){\n\t\t\t$this->ingredients[$entry->y][$entry->x] = clone $item;\n\t\t}\n\t}\n\n\t/**\n\t * @return Item[][]\n\t */\n\tpublic function getIngredientMap(){\n\t\t$ingredients = [];\n\t\tforeach($this->ingredients as $y => $row){\n\t\t\t$ingredients[$y] = [];\n\t\t\tforeach($row as $x => $ingredient){\n\t\t\t\tif($ingredient !== null){\n\t\t\t\t\t$ingredients[$y][$x] = clone $ingredient;\n\t\t\t\t}else{\n\t\t\t\t\t$ingredients[$y][$x] = Item::get(Item::AIR);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $ingredients;\n\t}\n\n\t/**\n \t * @return Item[]\n \t */\n \tpublic function getIngredientList(){\n \t\t$ingredients = [];\n \t\tfor ($x = 0; $x < 3; ++$x){\n \t\t\tfor ($y = 0; $y < 3; ++$y){\n \t\t\t\tif (!empty($this->ingredients[$x][$y])){\n \t\t\t\t\tif ($this->ingredients[$x][$y]->getId() !== Item::AIR){\n \t\t\t\t\t\t$ingredients[] = clone $this->ingredients[$x][$y];\n \t\t\t\t\t}\n \t\t\t\t}\n \t\t\t}\n \t\t}\n \t\treturn $ingredients;\n \t}\n\n\t/**\n\t * @param $x\n\t * @param $y\n\t * @return null|Item\n\t */\n\tpublic function getIngredient($x, $y){\n\t\treturn isset($this->ingredients[$y][$x]) ? $this->ingredients[$y][$x] : Item::get(Item::AIR);\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic function getShape(){\n\t\treturn $this->shape;\n\t}\n\n\tpublic function registerToCraftingManager(){\n\t\tServer::getInstance()->getCraftingManager()->registerShapedRecipe($this);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/ShapedRecipeFromJson.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\UUID;\nuse pocketmine\\math\\Vector2;\n\nclass ShapedRecipeFromJson extends ShapedRecipe{\n\t/** @var Item */\n\tprivate $output;\n\n\tprivate $id = null;\n\n\t/** @var string[] */\n\tprivate $shape = [];\n\n\t/** @var Item[][] */\n\tprivate $ingredients = [];\n\t/** @var Vector2[][] */\n\tprivate $shapeItems = [];\n\n\t/**\n\t * @param Item     $result\n\t * @param int      $height\n\t * @param int      $width\n\t *\n\t * @throws \\Exception\n\t */\n\tpublic function __construct(Item $result, $height, $width){\n\t\tfor($h = 0; $h < $height; $h++){\n\t\t\tif($width === 0 or $width > 3){\n\t\t\t\tthrow new \\InvalidStateException(\"Crafting rows should be 1, 2, 3 wide, not $width\");\n\t\t\t}\n\t\t\t$this->ingredients[] = array_fill(0, $width, null);\n\t\t}\n\n\t\t$this->output = clone $result;\n\t}\n\n\tpublic function getWidth(){\n\t\treturn count($this->ingredients[0]);\n\t}\n\n\tpublic function getHeight(){\n\t\treturn count($this->ingredients);\n\t}\n\n\tpublic function getResult(){\n\t\treturn $this->output;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function setId(UUID $id){\n\t\tif($this->id !== null){\n\t\t\tthrow new \\InvalidStateException(\"Id is already set\");\n\t\t}\n\n\t\t$this->id = $id;\n\t}\n\n\tpublic function addIngredient($x, $y, Item $item){\n\t\t$this->ingredients[$y][$x] = clone $item;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * @param string $key\n\t * @param Item   $item\n\t *\n\t * @return $this\n\t * @throws \\Exception\n\t */\n\tpublic function setIngredient($key, Item $item){\n\t\tif(!array_key_exists($key, $this->shape)){\n\t\t\tthrow new \\Exception(\"Symbol does not appear in the shape: \" . $key);\n\t\t}\n\n\t\t$this->fixRecipe($key, $item);\n\n\t\treturn $this;\n\t}\n\n\tprotected function fixRecipe($key, $item){\n\t\tforeach($this->shapeItems[$key] as $entry){\n\t\t\t$this->ingredients[$entry->y][$entry->x] = clone $item;\n\t\t}\n\t}\n\n\t/**\n\t * @return Item[][]\n\t */\n\tpublic function getIngredientMap(){\n\t\t$ingredients = [];\n\t\tforeach($this->ingredients as $y => $row){\n\t\t\t$ingredients[$y] = [];\n\t\t\tforeach($row as $x => $ingredient){\n\t\t\t\tif($ingredient !== null){\n\t\t\t\t\t$ingredients[$y][$x] = clone $ingredient;\n\t\t\t\t}else{\n\t\t\t\t\t$ingredients[$y][$x] = Item::get(Item::AIR);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $ingredients;\n\t}\n\n\t/**\n\t * @param $x\n\t * @param $y\n\t * @return null|Item\n\t */\n\tpublic function getIngredient($x, $y){\n\t\treturn isset($this->ingredients[$y][$x]) ? $this->ingredients[$y][$x] : Item::get(Item::AIR);\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic function getShape(){\n\t\treturn $this->shape;\n\t}\n\n\tpublic function registerToCraftingManager(){\n\t\tServer::getInstance()->getCraftingManager()->registerShapedRecipe($this);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/ShapelessRecipe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\UUID;\n\nclass ShapelessRecipe implements Recipe{\n\t/** @var Item */\n\tprivate $output;\n\n\tprivate $id = null;\n\n\t/** @var Item[] */\n\tprivate $ingredients = [];\n\n\tpublic function __construct(Item $result){\n\t\t$this->output = clone $result;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function setId(UUID $id){\n\t\tif($this->id !== null){\n\t\t\tthrow new \\InvalidStateException(\"Id is already set\");\n\t\t}\n\n\t\t$this->id = $id;\n\t}\n\n\tpublic function getResult(){\n\t\treturn clone $this->output;\n\t}\n\n\t/**\n\t * @param Item $item\n\t *\n\t * @returns ShapelessRecipe\n\t *\n\t * @throws \\InvalidArgumentException\n\t */\n\tpublic function addIngredient(Item $item){\n\t\tif(count($this->ingredients) >= 9){\n\t\t\tthrow new \\InvalidArgumentException(\"Shapeless recipes cannot have more than 9 ingredients\");\n\t\t}\n\n\t\t$it = clone $item;\n\t\t$it->setCount(1);\n\n\t\twhile($item->getCount() > 0){\n\t\t\t$this->ingredients[] = clone $it;\n\t\t\t$item->setCount($item->getCount() - 1);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * @param Item $item\n\t *\n\t * @return $this\n\t */\n\tpublic function removeIngredient(Item $item){\n\t\tforeach($this->ingredients as $index => $ingredient){\n\t\t\tif($item->getCount() <= 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif($ingredient->equals($item, !$item->hasAnyDamageValue(), $item->hasCompoundTag())){\n\t\t\t\tunset($this->ingredients[$index]);\n\t\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t}\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * @return Item[]\n\t */\n\tpublic function getIngredientList(){\n\t\t$ingredients = [];\n\t\tforeach($this->ingredients as $ingredient){\n\t\t\t$ingredients[] = clone $ingredient;\n\t\t}\n\n\t\treturn $ingredients;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getIngredientCount(){\n\t\t$count = 0;\n\t\tforeach($this->ingredients as $ingredient){\n\t\t\t$count += $ingredient->getCount();\n\t\t}\n\n\t\treturn $count;\n\t}\n\n\tpublic function registerToCraftingManager(){\n\t\tServer::getInstance()->getCraftingManager()->registerShapelessRecipe($this);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/inventory/SimpleTransactionQueue.php",
    "content": "<?php\n\n/**\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\event\\inventory\\InventoryTransactionEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\Player;\n\nclass SimpleTransactionQueue implements TransactionQueue{\n\n\t/** @var Player[] */\n\tprotected $player = null;\n\n\t/** @var \\SplQueue */\n\tprotected $transactionQueue;\n\t/** @var \\SplQueue */\n\tprotected $transactionsToRetry;\n\t\n\t/** @var Inventory[] */\n\tprotected $inventories;\n\n\t/** @var float */\n\tprotected $lastUpdate = -1;\n\n\t/** @var int */\n\tprotected $transactionCount = 0;\n\n\t/**\n\t * @param Player $player\n\t */\n\tpublic function __construct(Player $player = null){\n\t\t$this->player = $player;\n\t\t$this->transactionQueue = new \\SplQueue();\n\t\t$this->transactionsToRetry = new \\SplQueue();\n\t}\n\n\t/**\n\t * @return Player\n\t */\n\tpublic function getPlayer(){\n\t\treturn $this->player;\n\t}\n\n\tpublic function getInventories(){\n\t\treturn $this->inventories;\n\t}\n\n\tpublic function getTransactions(){\n\t\treturn $this->transactionQueue;\n\t}\n\n\tpublic function getTransactionCount(){\n\t\treturn $this->transactionCount;\n\t}\n\n\tpublic function addTransaction(Transaction $transaction){\n\t\t$this->transactionQueue->enqueue($transaction);\n\t\tif($transaction->getInventory() instanceof Inventory){\n\t\t\t/** For dropping items, the target inventory is open air, a.k.a. null. */\n\t\t\t$this->inventories[spl_object_hash($transaction)] = $transaction->getInventory();\n\t\t}\n\t\t$this->lastUpdate = microtime(true);\n\t\t$this->transactionCount += 1;\n\t}\n\n\tpublic function execute(){\n\t\t/** @var Transaction[] */\n\t\t$failed = [];\n\n\t\twhile(!$this->transactionsToRetry->isEmpty()){\n\t\t\t//Some failed transactions are waiting from the previous execution to be retried\n\t\t\t$this->transactionQueue->enqueue($this->transactionsToRetry->dequeue());\n\t\t}\n\n\t\tif(!$this->transactionQueue->isEmpty()){\n\t\t\t$this->player->getServer()->getPluginManager()->callEvent($ev = new InventoryTransactionEvent($this));\n\t\t}else{\n\t\t\treturn;\n\t\t}\n\n\t\twhile(!$this->transactionQueue->isEmpty()){\n\t\t\t$transaction = $this->transactionQueue->dequeue();\n\n\t\t\tif($ev->isCancelled()){\n\t\t\t\t$this->transactionCount -= 1;\n\t\t\t\t$transaction->sendSlotUpdate($this->player); //Send update back to client for cancelled transaction\n\t\t\t\tunset($this->inventories[spl_object_hash($transaction)]);\n\t\t\t\tcontinue;\n\t\t\t}elseif(!$transaction->execute($this->player)){\n\t\t\t\t$transaction->addFailure();\n\t\t\t\tif($transaction->getFailures() >= self::DEFAULT_ALLOWED_RETRIES){\n\t\t\t\t\t/* Transaction failed completely after several retries, hold onto it to send a slot update */\n\t\t\t\t\t$this->transactionCount -= 1;\n\t\t\t\t\t$failed[] = $transaction;\n\t\t\t\t}else{\n\t\t\t\t\t/* Add the transaction to the back of the queue to be retried on the next tick */\n\t\t\t\t\t$this->transactionsToRetry->enqueue($transaction);\n\t\t\t\t}\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$this->transactionCount -= 1;\n\t\t\t$transaction->setSuccess();\n\t\t\t$transaction->sendSlotUpdate($this->player);\n\t\t\tunset($this->inventories[spl_object_hash($transaction)]);\n\t\t}\n\n\t\tforeach($failed as $f){\n\t\t\t$f->sendSlotUpdate($this->player);\n\t\t\tunset($this->inventories[spl_object_hash($f)]);\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/TemporaryInventory.php",
    "content": "<?php\n\n/**\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\Player;\n\nabstract class TemporaryInventory extends ContainerInventory{\n\t//TODO\n\n\tabstract public function getResultSlotIndex();\n\n\n\tpublic function onClose(Player $who){\n\t\tforeach($this->getContents() as $slot => $item){\n\t\t\tif($slot === $this->getResultSlotIndex()){\n\t\t\t\t//Do not drop the item in the result slot - it is a virtual item and does not actually exist.\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$who->dropItem($item);\n\t\t}\n\t\t$this->clearAll();\n\t}\n}"
  },
  {
    "path": "src/pocketmine/inventory/Transaction.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\inventory;\n\nuse pocketmine\\Player;\nuse pocketmine\\item\\Item;\n\ninterface Transaction{\n\n\t//Transaction type constants\n\tconst TYPE_NORMAL = 0;\n\tconst TYPE_DROP_ITEM = 1;\n\n\t/**\n\t * @return Inventory\n\t */\n\tpublic function getInventory();\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSlot();\n\n\t/**\n\t * @return Item\n\t */\n\tpublic function getTargetItem();\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getCreationTime();\n\n\t/**\n\t * @param Player $source\n\t * @return bool\n\t */\n\tpublic function execute(Player $source): bool;\n}"
  },
  {
    "path": "src/pocketmine/inventory/TransactionQueue.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\inventory;\n\ninterface TransactionQueue{\n\n\tconst DEFAULT_ALLOWED_RETRIES = 5;\n\n\t/**\n\t * @return Inventory\n\t */\n\tfunction getInventories();\n\n\t/**\n\t * @return \\SplQueue\n\t */\n\tfunction getTransactions();\n\n\t/**\n\t * @return int\n\t */\n\tfunction getTransactionCount();\n\n\t/**\n\t * @param Transaction $transaction\n\t *\n\t * Adds a transaction to the queue\n\t */\n\tfunction addTransaction(Transaction $transaction);\n\n\t/**\n\t * Handles transaction queue execution\n\t */\n\tfunction execute();\n\n}"
  },
  {
    "path": "src/pocketmine/item/AcaciaDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass AcaciaDoor extends Door{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::ACACIA_DOOR_BLOCK);\n\t\tparent::__construct(self::ACACIA_DOOR, 0, $count, \"Acacia Door\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Apple.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Apple extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::APPLE, 0, $count, \"Apple\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 4;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 2.4;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Armor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\utils\\Color;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nabstract class Armor extends Item{\n\tconst TIER_LEATHER = 1;\n\tconst TIER_GOLD = 2;\n\tconst TIER_CHAIN = 3;\n\tconst TIER_IRON = 4;\n\tconst TIER_DIAMOND = 5;\n\n\tconst TYPE_HELMET = 0;\n\tconst TYPE_CHESTPLATE = 1;\n\tconst TYPE_LEGGINGS = 2;\n\tconst TYPE_BOOTS = 3;\n\n\tpublic function getMaxStackSize() : int {\n\t\treturn 1;\n\t}\n\n\tpublic function isArmor(){\n\t\treturn true;\n\t}\n\n\t/**\n\t *\n\t * @param Item $object\n\t * @param int $cost\n\t *\n\t * @return bool\n\t */\n\tpublic function useOn($object, int $cost = 1){\n\t\tif($this->isUnbreakable()){\n\t\t\treturn true;\n\t\t}\n\t\t$unbreakings = [\n\t\t\t0 => 100,\n\t\t\t1 => 80,\n\t\t\t2 => 73,\n\t\t\t3 => 70\n\t\t];\n\t\t$unbreakingl = $this->getEnchantmentLevel(Enchantment::TYPE_MINING_DURABILITY);\n\t\tif(mt_rand(1, 100) > $unbreakings[$unbreakingl]){\n\t\t\treturn true;\n\t\t}\n\t\t$this->setDamage($this->getDamage() + $cost);\n\t\tif($this->getDamage() >= $this->getMaxDurability()){\n\t\t\t$this->setCount(0);\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function isUnbreakable(){\n\t\t$tag = $this->getNamedTagEntry(\"Unbreakable\");\n\t\treturn $tag !== null and $tag->getValue() > 0;\n\t}\n\n\tpublic function setCustomColor(Color $color){\n\t\tif(($hasTag = $this->hasCompoundTag())){\n\t\t\t$tag = $this->getNamedTag();\n\t\t}else{\n\t\t\t$tag = new CompoundTag(\"\", []);\n\t\t}\n\t\t$tag->customColor = new IntTag(\"customColor\", $color->getColorCode());\n\t\t$this->setCompoundTag($tag);\n\t}\n\n\tpublic function getCustomColor(){\n\t\tif(!$this->hasCompoundTag()) return null;\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->customColor)){\n\t\t\treturn $tag[\"customColor\"];\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic function clearCustomColor(){\n\t\tif(!$this->hasCompoundTag()) return;\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->customColor)){\n\t\t\tunset($tag->customColor);\n\t\t}\n\t\t$this->setCompoundTag($tag);\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn false;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn false;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn false;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn false;\n\t}\n\n\tpublic function isHelmet(){\n\t\treturn false;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn false;\n\t}\n\n\tpublic function isLeggings(){\n\t\treturn false;\n\t}\n\n\tpublic function isBoots(){\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Arrow.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass Arrow extends Item{\n\tpublic function __construct($meta = 0, $count = 1) {\n\t\tparent::__construct(self::ARROW, $meta, $count, \"Arrow\");\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/BakedPotato.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass BakedPotato extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BAKED_POTATO, $meta, $count, \"Baked Potato\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 7.2;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Bed.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Bed extends Item{\n\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::BED_BLOCK);\n\t\tparent::__construct(self::BED, 0, $count, \"Bed\");\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 1;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Beetroot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Beetroot extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BEETROOT, $meta, $count, \"Beetroot\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 1;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 1.2;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/BeetrootSeeds.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass BeetrootSeeds extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::BEETROOT_BLOCK);\n\t\tparent::__construct(self::BEETROOT_SEEDS, 0, $count, \"Beetroot Seeds\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/BeetrootSoup.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass BeetrootSoup extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BEETROOT_SOUP, 0, $count, \"Beetroot Soup\");\n\t}\n\t\n\tpublic function getMaxStackSize() : int{\n\t\treturn 1;\n\t}\n\t\n\tpublic function getFoodRestore() : int{\n\t\treturn 6;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 7.2;\n\t}\n\t\n\tpublic function getResidue(){\n\t\treturn Item::get(Item::BOWL);\n\t}\n\n\t\n}"
  },
  {
    "path": "src/pocketmine/item/BirchDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass BirchDoor extends Door{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::BIRCH_DOOR_BLOCK);\n\t\tparent::__construct(self::BIRCH_DOOR, 0, $count, \"Birch Door\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/BlazePowder.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass BlazePowder extends Item {\n    public function __construct($meta = 0, $count =1){\n        parent::__construct(self::BLAZE_POWDER, $meta, $count, \"Blaze Powder\");\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/item/Boat.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\level\\Level;\nuse pocketmine\\block\\Block;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\Player;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\entity\\Boat as BoatEntity;\n\nclass Boat extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BOAT, $meta, $count, \"Boat\");\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\t$realPos = $block->getSide($face);\n\n\t\t$boat = new BoatEntity($player->getLevel()->getChunk($realPos->getX() >> 4, $realPos->getZ() >> 4), new CompoundTag(\"\", [\n\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\tnew DoubleTag(\"\", $realPos->getX() + 0.5),\n\t\t\t\tnew DoubleTag(\"\", $realPos->getY()),\n\t\t\t\tnew DoubleTag(\"\", $realPos->getZ() + 0.5)\n\t\t\t]),\n\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t]),\n\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t]),\n\t\t\t\"WoodID\" => new IntTag(\"WoodID\", $this->getDamage())\n\t\t]));\n\t\t$boat->spawnToAll();\n\n\t\tif($player->isSurvival()) {\n\t\t\t$item = $player->getInventory()->getItemInHand();\n\t\t\t$count = $item->getCount();\n\t\t\tif(--$count <= 0){\n\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::AIR));\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$item->setCount($count);\n\t\t\t$player->getInventory()->setItemInHand($item);\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Bone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Bone extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BONE, $meta, $count, \"Bone\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Book.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Book extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BOOK, $meta, $count, \"Book\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Bow.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Bow extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BOW, $meta, $count, \"Bow\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/Bowl.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Bowl extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BOWL, 0, $count, \"Bowl\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/Bread.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Bread extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BREAD, $meta, $count, \"Bread\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 6;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/BrewingStand.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass BrewingStand extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Block::BREWING_STAND_BLOCK);\n\t\tparent::__construct(self::BREWING_STAND, $meta, $count, \"Brewing Stand\");\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Brick.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Brick extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BRICK, 0, $count, \"Brick\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/Bucket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Air;\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Liquid;\nuse pocketmine\\event\\player\\PlayerBucketFillEvent;\nuse pocketmine\\event\\player\\PlayerBucketEmptyEvent;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\n\nclass Bucket extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::BUCKET, $meta, $count, \"Bucket\");\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 1;\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\t$targetBlock = Block::get($this->meta);\n\n\t\tif($targetBlock instanceof Air){\n\t\t\tif($target instanceof Liquid and $target->getDamage() === 0){\n\t\t\t\t$result = clone $this;\n\t\t\t\t$id = $target->getId();\n\t\t\t\tif($id == self::STILL_WATER){\n\t\t\t\t\t$id = self::WATER;\n\t\t\t\t}\n\t\t\t\tif($id == self::STILL_LAVA){\n\t\t\t\t\t$id = self::LAVA;\n\t\t\t\t}\n\t\t\t\t$result->setDamage($id);\n\t\t\t\t$player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketFillEvent($player, $block, $face, $this, $result));\n\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t$player->getLevel()->setBlock($target, new Air(), true, true);\n\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t$player->getInventory()->setItemInHand($ev->getItem());\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t}else{\n\t\t\t\t\t$player->getInventory()->sendContents($player);\n\t\t\t\t}\n\t\t\t}\n\t\t}elseif($targetBlock instanceof Liquid){\n\t\t\t$result = clone $this;\n\t\t\t$result->setDamage(0);\n\t\t\t$player->getServer()->getPluginManager()->callEvent($ev = new PlayerBucketEmptyEvent($player, $block, $face, $this, $result));\n\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t//Only disallow water placement in the Nether, allow other liquids to be placed\n\t\t\t\t//In vanilla, water buckets are emptied when used in the Nether, but no water placed.\n\t\t\t\tif(!($player->getLevel()->getDimension() === Level::DIMENSION_NETHER and $targetBlock->getID() === self::WATER)){\n\t\t\t\t\t$player->getLevel()->setBlock($block, $targetBlock, true, true);\n\t\t\t\t}\n\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t$player->getInventory()->setItemInHand($ev->getItem());\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}else{\n\t\t\t\t$player->getInventory()->sendContents($player);\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Cake.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Cake extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::CAKE_BLOCK);\n\t\tparent::__construct(self::CAKE, 0, $count, \"Cake\");\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 1;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Camera.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass Camera extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CAMERA, 0, $count, \"Camera\");\n\t}\n\n\tpublic function getMaxStackSize() : int {\n\t\treturn 1;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Carrot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Carrot extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::CARROT_BLOCK);\n\t\tparent::__construct(self::CARROT, 0, $count, \"Carrot\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 3;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 4.8;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Cauldron.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Cauldron extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Block::CAULDRON_BLOCK);\n\t\tparent::__construct(self::CAULDRON, $meta, $count, \"Cauldron\");\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 1;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/ChainBoots.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass ChainBoots extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CHAIN_BOOTS, $meta, $count, \"Chainmail Boots\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_CHAIN;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_BOOTS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 196;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 1;\n\t}\n\n\tpublic function isBoots(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/ChainChestplate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass ChainChestplate extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CHAIN_CHESTPLATE, $meta, $count, \"Chain Chestplate\");\n\t}\n\t\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_CHAIN;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_CHESTPLATE;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 241;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 5;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/ChainHelmet.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass ChainHelmet extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CHAIN_HELMET, $meta, $count, \"Chainmail Helmet\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_CHAIN;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_HELMET;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 166;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 1;\n\t}\n\n\tpublic function isHelmet(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/ChainLeggings.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass ChainLeggings extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CHAIN_LEGGINGS, $meta, $count, \"Chain Leggings\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_CHAIN;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_LEGGINGS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 226;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 4;\n\t}\n\n\tpublic function isLeggings(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/ChorusFruit.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass ChorusFruit extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CHORUS_FRUIT, 0, $count, \"Chorus Fruit\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 4;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 2.4;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Clay.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Clay extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CLAY, $meta, $count, \"Clay\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Clock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Clock extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::CLOCK, $meta, $count, \"Clock\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Coal.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Coal extends Item{\n\tconst NORMAL = 0;\n\tconst CHARCOAL = 1;\n\t\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::COAL, $meta, $count, \"Coal\");\n\t\tif($this->meta === 1){\n\t\t\t$this->name = \"Charcoal\";\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/Compass.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Compass extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::COMPASS, $meta, $count, \"Compass\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/CookedChicken.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass CookedChicken extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::COOKED_CHICKEN, $meta, $count, \"Cooked Chicken\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 6;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 7.2;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/CookedFish.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass CookedFish extends Fish{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tFood::__construct(self::COOKED_FISH, $meta, $count, $meta === self::FISH_SALMON ? \"Cooked Salmon\" : \"Cooked Fish\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn $this->meta === self::FISH_SALMON ? 6 : 5;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn $this->meta === self::FISH_SALMON ? 9.6 : 6;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/CookedMutton.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\item;\n\nclass CookedMutton extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::COOKED_MUTTON, $meta, $count, \"Cooked Mutton\");\n\t}\n\t\n\tpublic function getFoodRestore() : int{\n\t\treturn 6;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 9.6;\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/CookedPorkchop.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass CookedPorkchop extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::COOKED_PORKCHOP, $meta, $count, \"Cooked Porkchop\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 8;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 12.8;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/CookedRabbit.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass CookedRabbit extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::COOKED_RABBIT, $meta, $count, \"Cooked Rabbit\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 5;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 6;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Cookie.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Cookie extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::COOKIE, $meta, $count, \"Cookie\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 2;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 0.4;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/DarkOakDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass DarkOakDoor extends Door{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::DARK_OAK_DOOR_BLOCK);\n\t\tparent::__construct(self::DARK_OAK_DOOR, 0, $count, \"Dark Oak Door\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Diamond.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Diamond extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND, 0, $count, \"Diamond\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/DiamondAxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass DiamondAxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_AXE, $meta, $count, \"Diamond Axe\");\n\t}\n\n\tpublic function isAxe(){\n\t\treturn Tool::TIER_DIAMOND;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 7;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/DiamondBoots.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass DiamondBoots extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_BOOTS, $meta, $count, \"Diamond Boots\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_DIAMOND;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_BOOTS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 430;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 3;\n\t}\n\n\tpublic function isBoots(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/DiamondChestplate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass DiamondChestplate extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_CHESTPLATE, $meta, $count, \"Diamond Chestplate\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_DIAMOND;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_CHESTPLATE;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 529;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 8;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/DiamondHelmet.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass DiamondHelmet extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_HELMET, $meta, $count, \"Diamond Helmet\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_DIAMOND;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_HELMET;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 364;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 3;\n\t}\n\n\tpublic function isHelmet(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/DiamondHoe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass DiamondHoe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_HOE, $meta, $count, \"Diamond Hoe\");\n\t}\n\n\tpublic function isHoe(){\n\t\treturn Tool::TIER_DIAMOND;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/DiamondLeggings.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass DiamondLeggings extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_LEGGINGS, $meta, $count, \"Diamond Leggings\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_DIAMOND;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_LEGGINGS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 496;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 6;\n\t}\n\n\tpublic function isLeggings(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/DiamondPickaxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass DiamondPickaxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_PICKAXE, $meta, $count, \"Diamond Pickaxe\");\n\t}\n\n\tpublic function isPickaxe(){\n\t\treturn Tool::TIER_DIAMOND;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 6;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/DiamondShovel.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass DiamondShovel extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_SHOVEL, $meta, $count, \"Diamond Shovel\");\n\t}\n\n\tpublic function isShovel(){\n\t\treturn Tool::TIER_DIAMOND;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 5;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/DiamondSword.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass DiamondSword extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::DIAMOND_SWORD, $meta, $count, \"Diamond Sword\");\n\t}\n\n\tpublic function isSword(){\n\t\treturn Tool::TIER_DIAMOND;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 8;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Door.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \n namespace pocketmine\\item;\n \n abstract class Door extends Item{\n\tpublic function getMaxStackSize() : int {\n\t\treturn 64;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Dye.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Dye extends Item{\n\tconst BLACK = 0;\n\tconst RED = 1;\n\tconst GREEN = 2;\n\tconst BROWN = 3; const COCOA_BEANS = 3;\n\tconst BLUE = 4; const LAPIS_LAZULI = 4;\n\tconst PURPLE = 5;\n\tconst CYAN = 6;\n\tconst SILVER = 7; const LIGHT_GRAY = 7;\n\tconst GRAY = 8;\n\tconst PINK = 9;\n\tconst LIME = 10;\n\tconst YELLOW = 11;\n\tconst LIGHT_BLUE = 12;\n\tconst MAGENTA = 13;\n\tconst ORANGE = 14;\n\tconst WHITE = 15; const BONE_MEAL = 15;\n\n\tpublic function __construct($meta = 0, $count = 1) {\n\t\tif ($meta === 3) {\n\t\t\t$this->block = Block::get(Item::COCOA_BLOCK);\n\t\t\tparent::__construct(self::DYE, 3, $count, \"Cocoa Beans\");\n\t\t} else {\n\t\t\tparent::__construct(self::DYE, $meta, $count, $this->getNameByMeta($meta));\n\t\t}\n\t}\n\n\tpublic function getNameByMeta(int $meta) : string{\n\t\tswitch($meta){\n\t\t\tcase self::BLACK:\n\t\t\t\treturn \"Ink Sac\";\n\t\t\tcase self::RED:\n\t\t\t\treturn \"Rose Red\";\n\t\t\tcase self::GREEN:\n\t\t\t\treturn \"Cactus Green\";\n\t\t\tcase self::BROWN:\n\t\t\t\treturn \"Cocoa Beans\";\n\t\t\tcase self::BLUE:\n\t\t\t\treturn \"Lapis Lazuli\";\n\t\t\tcase self::PURPLE:\n\t\t\t\treturn \"Purple Dye\";\n\t\t\tcase self::CYAN:\n\t\t\t\treturn \"Cyan Dye\";\n\t\t\tcase self::SILVER:\n\t\t\t\treturn \"Light Gray Dye\";\n\t\t\tcase self::GRAY:\n\t\t\t\treturn \"Gray Dye\";\n\t\t\tcase self::PINK:\n\t\t\t\treturn \"Pink Dye\";\n\t\t\tcase self::LIME:\n\t\t\t\treturn \"Lime Dye\";\n\t\t\tcase self::YELLOW:\n\t\t\t\treturn \"Dandelion Yellow\";\n\t\t\tcase self::LIGHT_BLUE:\n\t\t\t\treturn \"Light Blue Dye\";\n\t\t\tcase self::MAGENTA:\n\t\t\t\treturn \"Magenta Dye\";\n\t\t\tcase self::ORANGE:\n\t\t\t\treturn \"Orange Dye\";\n\t\t\tcase self::WHITE:\n\t\t\t\treturn \"Bone Meal\";\n\t\t\tdefault:\n\t\t\t\treturn \"Dye\";\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Egg.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Egg extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::EGG, $meta, $count, \"Egg\");\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Elytra.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass Elytra extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::ELYTRA, $meta, $count, \"Elytra Wings\");\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_CHESTPLATE;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 431;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Emerald.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Emerald extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::EMERALD, $meta, $count, \"Emerald\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/EnchantedBook.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass EnchantedBook extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::ENCHANTED_BOOK, $meta, $count, \"Enchanted Book\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/EnchantedGoldenApple.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Human;\n\nclass EnchantedGoldenApple extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::ENCHANTED_GOLDEN_APPLE, $meta, $count, \"Enchanted Golden Apple\");\n\t}\n\t\n\tpublic function canBeConsumedBy(Entity $entity): bool{\n\t\treturn $entity instanceof Human and $this->canBeConsumed();\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 4;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 9.6;\n\t}\n\n\tpublic function getAdditionalEffects() : array{\n\t\treturn [\n\t\t\tEffect::getEffect(Effect::REGENERATION)->setDuration(600)->setAmplifier(4),\n\t\t\tEffect::getEffect(Effect::ABSORPTION)->setDuration(2400)->setAmplifier(3),\n\t\t\tEffect::getEffect(Effect::DAMAGE_RESISTANCE)->setDuration(6000)->setAmplifier(0),\n\t\t\tEffect::getEffect(Effect::FIRE_RESISTANCE)->setDuration(6000)->setAmplifier(0),\n\t\t];\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/EnchantingBottle.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass EnchantingBottle extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::ENCHANTING_BOTTLE, $meta, $count, \"Bottle o' Enchanting\");\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/EnderPearl.php",
    "content": "<?php\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\item\\Item;\n\nclass EnderPearl extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::ENDER_PEARL, 0, $count, \"Ender Pearl\");\n\t}\n\n\tpublic function getMaxStackSize() : int {\n\t\treturn 16;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/EyeOfEnder.php",
    "content": "<?php\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\item\\Item;\n\nclass EyeOfEnder extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::ENDER_EYE, 0, $count, \"Eye of Ender\");\n\t}\n\n\tpublic function getMaxStackSize() : int {\n\t\treturn 64;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Feather.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Feather extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::FEATHER, 0, $count, \"Feather\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/FermentedSpiderEye.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass FermentedSpiderEye extends Item {\n    public function __construct($meta = 0, $count =1){\n\t\tparent::__construct(self::FERMENTED_SPIDER_EYE, $meta, $count, \"Fermented Spider Eye\");\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/item/Fish.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Effect;\n\nclass Fish extends Food{\n\t\n\t//Wrong! All wrong! TODO: Fix\n\t\n\tconst FISH_FISH = 0;\n\tconst FISH_SALMON = 1;\n\tconst FISH_CLOWNFISH = 2;\n\tconst FISH_PUFFERFISH = 3;\n\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$name = \"Raw Fish\";\n\t\tif($this->meta === self::FISH_SALMON){\n\t\t\t$name = \"Raw Salmon\";\n\t\t}elseif($this->meta === self::FISH_CLOWNFISH){\n\t\t\t$name = \"Clownfish\";\n\t\t}elseif($this->meta === self::FISH_PUFFERFISH){\n\t\t\t$name = \"Pufferfish\";\n\t\t}\n\t\tparent::__construct(self::RAW_FISH, $meta, $count, $name);\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\tif($this->meta === self::FISH_FISH){\n\t\t\treturn 2;\n\t\t}elseif($this->meta === self::FISH_SALMON){\n\t\t\treturn 2;\n\t\t}elseif($this->meta === self::FISH_CLOWNFISH){\n\t\t\treturn 1;\n\t\t}elseif($this->meta === self::FISH_PUFFERFISH){\n\t\t\treturn 1.2;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\tif($this->meta === self::FISH_FISH){\n\t\t\treturn 0.4;\n\t\t}elseif($this->meta === self::FISH_SALMON){\n\t\t\treturn 0.4;\n\t\t}elseif($this->meta === self::FISH_CLOWNFISH){\n\t\t\treturn 0.2;\n\t\t}elseif($this->meta === self::FISH_PUFFERFISH){\n\t\t\treturn 0.2;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic function getAdditionalEffects() : array{\n\t\treturn $this->meta === self::FISH_PUFFERFISH ? [\n\t\t\tEffect::getEffect(Effect::HUNGER)->setDuration(300)->setAmplifier(2),\n\t\t\tEffect::getEffect(Effect::NAUSEA)->setDuration(300)->setAmplifier(1),\n\t\t\tEffect::getEffect(Effect::POISON)->setDuration(1200)->setAmplifier(3),\n\t\t] : [];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/FishingRod.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass FishingRod extends Item {\n\tpublic function __construct($meta = 0, $count = 1) {\n\t\tparent::__construct(self::FISHING_ROD, 0, $count, \"Fishing Rod\");\n\t}\n} \n"
  },
  {
    "path": "src/pocketmine/item/Flint.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Flint extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::FLINT, $meta, $count, \"Flint\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/FlintSteel.php",
    "content": "<?php\n\n/*\n *\n *  ____\t\t\t_\t\t_   __  __ _\t\t\t\t  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___\t  |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|\t |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Fire;\nuse pocketmine\\block\\Portal;\nuse pocketmine\\block\\Solid;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\math\\Vector3;\n\nclass FlintSteel extends Tool{\n\t/** @var Vector3 */\n\tprivate $temporalVector = null;\n\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::FLINT_STEEL, $meta, $count, \"Flint and Steel\");\n\t\tif($this->temporalVector === null){\n\t\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t}\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\tif($target->getId() === Block::OBSIDIAN and $player->getServer()->netherEnabled){//黑曜石 4*5最小 23*23最大\n\t\t\t//$level->setBlock($block, new Fire(), true);\n\t\t\t$tx = $target->getX();\n\t\t\t$ty = $target->getY();\n\t\t\t$tz = $target->getZ();\n\t\t\t//x方向\n\t\t\t$x_max = $tx;//x最大值\n\t\t\t$x_min = $tx;//x最小值\n\t\t\tfor($x = $tx + 1; $level->getBlock($this->temporalVector->setComponents($x, $ty, $tz))->getId() == Block::OBSIDIAN; $x++){\n\t\t\t\t$x_max++;\n\t\t\t}\n\t\t\tfor($x = $tx - 1; $level->getBlock($this->temporalVector->setComponents($x, $ty, $tz))->getId() == Block::OBSIDIAN; $x--){\n\t\t\t\t$x_min--;\n\t\t\t}\n\t\t\t$count_x = $x_max - $x_min + 1;//x方向方块\n\t\t\tif($count_x >= 4 and $count_x <= 23){//4 23\n\t\t\t\t$x_max_y = $ty;//x最大值时的y最大值\n\t\t\t\t$x_min_y = $ty;//x最小值时的y最大值\n\t\t\t\tfor($y = $ty; $level->getBlock($this->temporalVector->setComponents($x_max, $y, $tz))->getId() == Block::OBSIDIAN; $y++){\n\t\t\t\t\t$x_max_y++;\n\t\t\t\t}\n\t\t\t\tfor($y = $ty; $level->getBlock($this->temporalVector->setComponents($x_min, $y, $tz))->getId() == Block::OBSIDIAN; $y++){\n\t\t\t\t\t$x_min_y++;\n\t\t\t\t}\n\t\t\t\t$y_max = min($x_max_y, $x_min_y) - 1;//y最大值\n\t\t\t\t$count_y = $y_max - $ty + 2;//方向方块\n\t\t\t\t//Server::getInstance()->broadcastMessage(\"$y_max $x_max_y $x_min_y $x_max $x_min\");\n\t\t\t\tif($count_y >= 5 and $count_y <= 23){//5 23\n\t\t\t\t\t$count_up = 0;//上面\n\t\t\t\t\tfor($ux = $x_min; ($level->getBlock($this->temporalVector->setComponents($ux, $y_max, $tz))->getId() == Block::OBSIDIAN and $ux <= $x_max); $ux++){\n\t\t\t\t\t\t$count_up++;\n\t\t\t\t\t}\n\t\t\t\t\t//Server::getInstance()->broadcastMessage(\"$count_up $count_x\");\n\t\t\t\t\tif($count_up == $count_x){\n\t\t\t\t\t\tfor($px = $x_min + 1; $px < $x_max; $px++){\n\t\t\t\t\t\t\tfor($py = $ty + 1; $py < $y_max; $py++){\n\t\t\t\t\t\t\t\t$level->setBlock($this->temporalVector->setComponents($px, $py, $tz), new Portal());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t\t$this->useOn($block, 2);\n\t\t\t\t\t\t\t$player->getInventory()->setItemInHand($this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t//z方向\n\t\t\t$z_max = $tz;//z最大值\n\t\t\t$z_min = $tz;//z最小值\n\t\t\t$count_z = 0;//z方向方块\n\t\t\tfor($z = $tz + 1; $level->getBlock($this->temporalVector->setComponents($tx, $ty, $z))->getId() == Block::OBSIDIAN; $z++){\n\t\t\t\t$z_max++;\n\t\t\t}\n\t\t\tfor($z = $tz - 1; $level->getBlock($this->temporalVector->setComponents($tx, $ty, $z))->getId() == Block::OBSIDIAN; $z--){\n\t\t\t\t$z_min--;\n\t\t\t}\n\t\t\t$count_z = $z_max - $z_min + 1;\n\t\t\tif($count_z >= 4 and $count_z <= 23){//4 23\n\t\t\t\t$z_max_y = $ty;//z最大值时的y最大值\n\t\t\t\t$z_min_y = $ty;//z最小值时的y最大值\n\t\t\t\tfor($y = $ty; $level->getBlock($this->temporalVector->setComponents($tx, $y, $z_max))->getId() == Block::OBSIDIAN; $y++){\n\t\t\t\t\t$z_max_y++;\n\t\t\t\t}\n\t\t\t\tfor($y = $ty; $level->getBlock($this->temporalVector->setComponents($tx, $y, $z_min))->getId() == Block::OBSIDIAN; $y++){\n\t\t\t\t\t$z_min_y++;\n\t\t\t\t}\n\t\t\t\t$y_max = min($z_max_y, $z_min_y) - 1;//y最大值\n\t\t\t\t$count_y = $y_max - $ty + 2;//方向方块\n\t\t\t\tif($count_y >= 5 and $count_y <= 23){//5 23\n\t\t\t\t\t$count_up = 0;//上面\n\t\t\t\t\tfor($uz = $z_min; ($level->getBlock($this->temporalVector->setComponents($tx, $y_max, $uz))->getId() == Block::OBSIDIAN and $uz <= $z_max); $uz++){\n\t\t\t\t\t\t$count_up++;\n\t\t\t\t\t}\n\t\t\t\t\t//Server::getInstance()->broadcastMessage(\"$count_up $count_z\");\n\t\t\t\t\tif($count_up == $count_z){\n\t\t\t\t\t\tfor($pz = $z_min + 1; $pz < $z_max; $pz++){\n\t\t\t\t\t\t\tfor($py = $ty + 1; $py < $y_max; $py++){\n\t\t\t\t\t\t\t\t$level->setBlock($this->temporalVector->setComponents($tx, $py, $pz), new Portal());\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t\t\t$this->useOn($block, 2);\n\t\t\t\t\t\t\t$player->getInventory()->setItemInHand($this);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t//return true;\n\t\t}\n\n\t\tif($block->getId() === self::AIR and ($target instanceof Solid)){\n\t\t\t$level->setBlock($block, new Fire(), true);\n\n\t\t\t/** @var Fire $block */\n\t\t\t$block = $level->getBlock($block);\n\t\t\tif($block->getSide(Vector3::SIDE_DOWN)->isTopFacingSurfaceSolid() or $block->canNeighborBurn()){\n\t\t\t\t$level->scheduleUpdate($block, $block->getTickRate() + mt_rand(0, 10));\n\t\t\t\t//\treturn true;\n\t\t\t}\n\n\t\t\tif($player->isSurvival()){\n\t\t\t\t$this->useOn($block, 2);//耐久跟报废分别写在 tool 跟 level 了\n\t\t\t\t$player->getInventory()->setItemInHand($this);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/FlowerPot.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass FlowerPot extends Item {\n\tpublic function __construct($meta = 0, $count = 1) {\n\t\t$this->block = Block::get(Item::FLOWER_POT_BLOCK);\n\t\tparent::__construct(self::FLOWER_POT, 0, $count, \"Flower Pot\");\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 64;\n\t}\n} \n"
  },
  {
    "path": "src/pocketmine/item/Food.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\entity\\EntityEatItemEvent;\nuse pocketmine\\network\\protocol\\EntityEventPacket;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\n\nabstract class Food extends Item implements FoodSource{\n\tpublic function canBeConsumed() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function canBeConsumedBy(Entity $entity) : bool{\n\t\treturn $entity instanceof Player and ($entity->getFood() < $entity->getMaxFood()) and $this->canBeConsumed();\n\t}\n\n\tpublic function getResidue(){\n\t\tif($this->getCount() === 1){\n\t\t\treturn Item::get(0);\n\t\t}else{\n\t\t\t$new = clone $this;\n\t\t\t$new->count--;\n\t\t\treturn $new;\n\t\t}\n\t}\n\n\tpublic function getAdditionalEffects() : array{\n\t\treturn [];\n\t}\n\n\tpublic function onConsume(Entity $human){\n\t\t$pk = new EntityEventPacket();\n\t\t$pk->eid = $human->getId();\n\t\t$pk->event = EntityEventPacket::USE_ITEM;\n\t\tif($human instanceof Player){\n\t\t\t$human->dataPacket($pk);\n\t\t}\n\t\t$human->getServer()->broadcastPacket($human->getViewers(), $pk);\n\n\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityEatItemEvent($human, $this));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$human->addSaturation($ev->getSaturationRestore());\n\t\t\t$human->addFood($ev->getFoodRestore());\n\t\t\tforeach($ev->getAdditionalEffects() as $effect){\n\t\t\t\t$human->addEffect($effect);\n\t\t\t}\n\t\t\t$human->getInventory()->setItemInHand($ev->getResidue());\n\t\t}\n\t\t\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/FoodSource.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\n\ninterface FoodSource{\n\tpublic function getResidue();\n\t\n\tpublic function getFoodRestore() : int;\n\n\tpublic function getSaturationRestore() : float;\n\n\t/**\n\t * @return Effect[]\n\t */\n\tpublic function getAdditionalEffects() : array;\n\t\n\t\n}\n"
  },
  {
    "path": "src/pocketmine/item/GlassBottle.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\Level;\nuse pocketmine\\Player;\nuse pocketmine\\event\\player\\PlayerGlassBottleEvent;\n\nclass GlassBottle extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GLASS_BOTTLE, $meta, $count, \"Glass Bottle\");\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\tif($player === null or $player->isSurvival() !== true){\n\t\t\treturn false;\n\t\t}\n\t\tif($target->getId() === Block::STILL_WATER or $target->getId() === Block::WATER){\n\t\t\t$player->getServer()->getPluginManager()->callEvent($ev = new PlayerGlassBottleEvent($player, $target, $this));\n\t\t\tif($ev->isCancelled()){\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\tif($this->count <= 1){\n\t\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::POTION, 0, 1));\n\t\t\t\t\treturn true;\n\t\t\t\t}else{\n\t\t\t\t\t$this->count--;\n\t\t\t\t\t$player->getInventory()->setItemInHand($this);\n\t\t\t\t}\n\t\t\t\tif($player->getInventory()->canAddItem(Item::get(Item::POTION, 0, 1)) === true){\n\t\t\t\t\t$player->getInventory()->AddItem(Item::get(Item::POTION, 0, 1));\n\t\t\t\t}else{\n\t\t\t\t\t$motion = $player->getDirectionVector()->multiply(0.4);\n\t\t\t\t\t$position = clone $player->getPosition();\n\t\t\t\t\t$player->getLevel()->dropItem($position->add(0 , 0.5, 0), Item::get(Item::POTION, 0, 1) , $motion, 40);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/GlisteringMelon.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass GlisteringMelon extends Item {\n    public function __construct($meta = 0, $count =1){\n        parent::__construct(self::GLISTERING_MELON, $meta, $count, \"Glistering Melon\");\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/item/GlowstoneDust.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass GlowstoneDust extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GLOWSTONE_DUST, $meta, $count, \"Glowstone Dust\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/GoldAxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass GoldAxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_AXE, $meta, $count, \"Gold Axe\");\n\t}\n\n\tpublic function isAxe(){\n\t\treturn Tool::TIER_GOLD;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 4;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/GoldBoots.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass GoldBoots extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_BOOTS, $meta, $count, \"Gold Boots\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_GOLD;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_BOOTS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 92;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 1;\n\t}\n\n\tpublic function isBoots(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/GoldChestplate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass GoldChestplate extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_CHESTPLATE, $meta, $count, \"Gold Chestplate\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_GOLD;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_CHESTPLATE;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 113;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 5;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/GoldHelmet.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass GoldHelmet extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_HELMET, $meta, $count, \"Gold Helmet\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_GOLD;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_HELMET;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 78;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 1;\n\t}\n\n\tpublic function isHelmet(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/GoldHoe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass GoldHoe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_HOE, $meta, $count, \"Gold Hoe\");\n\t}\n\n\tpublic function isHoe(){\n\t\treturn Tool::TIER_GOLD;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/GoldIngot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass GoldIngot extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_INGOT, 0, $count, \"Gold Ingot\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/GoldLeggings.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass GoldLeggings extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_LEGGINGS, $meta, $count, \"Gold Leggings\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_GOLD;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_LEGGINGS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 106;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 3;\n\t}\n\n\tpublic function isLeggings(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/GoldNugget.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass GoldNugget extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_NUGGET, $meta, $count, \"Gold Nugget\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/GoldPickaxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass GoldPickaxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_PICKAXE, $meta, $count, \"Gold Pickaxe\");\n\t}\n\n\tpublic function isPickaxe(){\n\t\treturn Tool::TIER_GOLD;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 3;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/GoldShovel.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass GoldShovel extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_SHOVEL, $meta, $count, \"Gold Shovel\");\n\t}\n\n\tpublic function isShovel(){\n\t\treturn Tool::TIER_GOLD;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 2;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/GoldSword.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass GoldSword extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLD_SWORD, $meta, $count, \"Gold Sword\");\n\t}\n\n\tpublic function isSword(){\n\t\treturn Tool::TIER_GOLD;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 5;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/GoldenApple.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Human;\n\nclass GoldenApple extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLDEN_APPLE, $meta, $count, \"Golden Apple\");\n\t}\n\t\n\tpublic function canBeConsumedBy(Entity $entity): bool{\n\t\treturn $entity instanceof Human and $this->canBeConsumed();\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 4;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 9.6;\n\t}\n\n\tpublic function getAdditionalEffects() : array{\n\t\treturn [\n\t\t\tEffect::getEffect(Effect::REGENERATION)->setDuration(100)->setAmplifier(1),\n\t\t\tEffect::getEffect(Effect::ABSORPTION)->setDuration(2400)->setAmplifier(0)\n\t\t];\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/GoldenCarrot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass GoldenCarrot extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GOLDEN_CARROT, $meta, $count, \"Golden Carrot\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 6;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 14.4;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Gunpowder.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Gunpowder extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::GUNPOWDER, $meta, $count, \"Gunpowder\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Hopper.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Hopper extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Block::HOPPER_BLOCK);\n\t\tparent::__construct(self::HOPPER, 0, $count, \"Hopper\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronAxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass IronAxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_AXE, $meta, $count, \"Iron Axe\");\n\t}\n\n\tpublic function isAxe(){\n\t\treturn Tool::TIER_IRON;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 6;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronBoots.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass IronBoots extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_BOOTS, $meta, $count, \"Iron Boots\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_IRON;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_BOOTS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 196;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 2;\n\t}\n\n\tpublic function isBoots(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronChestplate.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass IronChestplate extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_CHESTPLATE, $meta, $count, \"Iron Chestplate\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_IRON;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_CHESTPLATE;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 241;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 6;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass IronDoor extends Door{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::IRON_DOOR_BLOCK);\n\t\tparent::__construct(self::IRON_DOOR, 0, $count, \"Iron Door\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronHelmet.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass IronHelmet extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_HELMET, $meta, $count, \"Iron Helmet\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_IRON;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_HELMET;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 166;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 2;\n\t}\n\n\tpublic function isHelmet(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronHoe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass IronHoe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_HOE, $meta, $count, \"Iron Hoe\");\n\t}\n\n\tpublic function isHoe(){\n\t\treturn Tool::TIER_IRON;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronIngot.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass IronIngot extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_INGOT, 0, $count, \"Iron Ingot\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/IronLeggings.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass IronLeggings extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_LEGGINGS, $meta, $count, \"Iron Leggings\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_IRON;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_LEGGINGS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 226;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 5;\n\t}\n\n\tpublic function isLeggings(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronPickaxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass IronPickaxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_PICKAXE, $meta, $count, \"Iron Pickaxe\");\n\t}\n\n\tpublic function isPickaxe(){\n\t\treturn Tool::TIER_IRON;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 5;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronShovel.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass IronShovel extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_SHOVEL, $meta, $count, \"Iron Shovel\");\n\t}\n\n\tpublic function isShovel(){\n\t\treturn Tool::TIER_IRON;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 4;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/IronSword.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass IronSword extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::IRON_SWORD, $meta, $count, \"Iron Sword\");\n\t}\n\n\tpublic function isSword(){\n\t\treturn Tool::TIER_IRON;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 7;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Item.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * All the Item classes\n */\nnamespace pocketmine\\item;\n\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\CaveSpider;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\PigZombie;\nuse pocketmine\\entity\\Silverfish;\nuse pocketmine\\entity\\Skeleton;\nuse pocketmine\\entity\\Spider;\nuse pocketmine\\entity\\Witch;\nuse pocketmine\\entity\\Zombie;\nuse pocketmine\\inventory\\Fuel;\nuse pocketmine\\item\\enchantment\\Enchantment;\nuse pocketmine\\level\\Level;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\utils\\Config;\n\nclass Item implements ItemIds, \\JsonSerializable{\n\n\t/** @var NBT */\n\tprivate static $cachedParser = null;\n\n\tprivate static function parseCompoundTag(string $tag) : CompoundTag{\n\t\tif(self::$cachedParser === null){\n\t\t\tself::$cachedParser = new NBT(NBT::LITTLE_ENDIAN);\n\t\t}\n\n\t\tself::$cachedParser->read($tag);\n\t\treturn self::$cachedParser->getData();\n\t}\n\n\tprivate static function writeCompoundTag(CompoundTag $tag) : string{\n\t\tif(self::$cachedParser === null){\n\t\t\tself::$cachedParser = new NBT(NBT::LITTLE_ENDIAN);\n\t\t}\n\n\t\tself::$cachedParser->setData($tag);\n\t\treturn self::$cachedParser->write();\n\t}\n\n\n\t/** @var \\SplFixedArray */\n\tpublic static $list = null;\n\tprotected $block;\n\tprotected $id;\n\tprotected $meta;\n\tprivate $tags = \"\";\n\tprivate $cachedNBT = null;\n\tpublic $count;\n\tprotected $durability = 0;\n\tprotected $name;\n\n\tpublic function canBeActivated() :bool{\n\t\treturn false;\n\t}\n\n\tpublic static function init($readFromJson = false){\n\t\tif(self::$list === null){\n\t\t\t//TODO: Sort this mess into some kind of order\n\t\t\tself::$list = new \\SplFixedArray(65536);\n\t\t\tself::$list[self::SUGARCANE] = Sugarcane::class;\n\t\t\tself::$list[self::ENDER_PEARL] = EnderPearl::class;\n\t\t\t//self::$list[self::EYE_OF_ENDER] = EyeOfEnder::class;\n\t\t\t//self::$list[self::DRAGONS_BREATH] = DragonsBreath::class;\n\t\t\t//self::$list[self::SHULKER_SHELL] = ShulkerShell::class;\n\t\t\t//self::$list[self::POPPED_CHORUS_FRUIT] = PoppedChorusFruit::class;\n\t\t\tself::$list[self::WHEAT_SEEDS] = WheatSeeds::class;\n\t\t\tself::$list[self::PUMPKIN_SEEDS] = PumpkinSeeds::class;\n\t\t\tself::$list[self::MELON_SEEDS] = MelonSeeds::class;\n\t\t\tself::$list[self::MUSHROOM_STEW] = MushroomStew::class;\n\t\t\tself::$list[self::RABBIT_STEW] = RabbitStew::class;\n\t\t\tself::$list[self::BEETROOT_SOUP] = BeetrootSoup::class;\n\t\t\tself::$list[self::BEETROOT_SEEDS] = BeetrootSeeds::class;\n\t\t\tself::$list[self::SIGN] = Sign::class;\n\t\t\tself::$list[self::WOODEN_DOOR] = WoodenDoor::class;\n\t\t\tself::$list[self::SPRUCE_DOOR] = SpruceDoor::class;\n\t\t\tself::$list[self::BIRCH_DOOR] = BirchDoor::class;\n\t\t\tself::$list[self::JUNGLE_DOOR] = JungleDoor::class;\n\t\t\tself::$list[self::ACACIA_DOOR] = AcaciaDoor::class;\n\t\t\tself::$list[self::DARK_OAK_DOOR] = DarkOakDoor::class;\n\t\t\tself::$list[self::BUCKET] = Bucket::class;\n\t\t\tself::$list[self::IRON_DOOR] = IronDoor::class;\n\t\t\tself::$list[self::CAKE] = Cake::class;\n\t\t\tself::$list[self::BED] = Bed::class;\n\t\t\tself::$list[self::PAINTING] = Painting::class;\n\t\t\tself::$list[self::COAL] = Coal::class;\n\t\t\tself::$list[self::APPLE] = Apple::class;\n\t\t\tself::$list[self::SPAWN_EGG] = SpawnEgg::class;\n\t\t\tself::$list[self::DIAMOND] = Diamond::class;\n\t\t\tself::$list[self::STICK] = Stick::class;\n\t\t\tself::$list[self::SNOWBALL] = Snowball::class;\n\t\t\tself::$list[self::BOWL] = Bowl::class;\n\t\t\tself::$list[self::FEATHER] = Feather::class;\n\t\t\tself::$list[self::BRICK] = Brick::class;\n\t\t\tself::$list[self::LEATHER_CAP] = LeatherCap::class;\n\t\t\tself::$list[self::LEATHER_TUNIC] = LeatherTunic::class;\n\t\t\tself::$list[self::LEATHER_PANTS] = LeatherPants::class;\n\t\t\tself::$list[self::LEATHER_BOOTS] = LeatherBoots::class;\n\t\t\tself::$list[self::CHAIN_HELMET] = ChainHelmet::class;\n\t\t\tself::$list[self::CHAIN_CHESTPLATE] = ChainChestplate::class;\n\t\t\tself::$list[self::CHAIN_LEGGINGS] = ChainLeggings::class;\n\t\t\tself::$list[self::CHAIN_BOOTS] = ChainBoots::class;\n\t\t\tself::$list[self::IRON_HELMET] = IronHelmet::class;\n\t\t\tself::$list[self::IRON_CHESTPLATE] = IronChestplate::class;\n\t\t\tself::$list[self::IRON_LEGGINGS] = IronLeggings::class;\n\t\t\tself::$list[self::IRON_BOOTS] = IronBoots::class;\n\t\t\tself::$list[self::GOLD_HELMET] = GoldHelmet::class;\n\t\t\tself::$list[self::GOLD_CHESTPLATE] = GoldChestplate::class;\n\t\t\tself::$list[self::GOLD_LEGGINGS] = GoldLeggings::class;\n\t\t\tself::$list[self::GOLD_BOOTS] = GoldBoots::class;\n\t\t\tself::$list[self::DIAMOND_HELMET] = DiamondHelmet::class;\n\t\t\tself::$list[self::DIAMOND_CHESTPLATE] = DiamondChestplate::class;\n\t\t\tself::$list[self::DIAMOND_LEGGINGS] = DiamondLeggings::class;\n\t\t\tself::$list[self::DIAMOND_BOOTS] = DiamondBoots::class;\n\t\t\tself::$list[self::IRON_SWORD] = IronSword::class;\n\t\t\tself::$list[self::IRON_INGOT] = IronIngot::class;\n\t\t\tself::$list[self::GOLD_INGOT] = GoldIngot::class;\n\t\t\tself::$list[self::IRON_SHOVEL] = IronShovel::class;\n\t\t\tself::$list[self::IRON_PICKAXE] = IronPickaxe::class;\n\t\t\tself::$list[self::IRON_AXE] = IronAxe::class;\n\t\t\tself::$list[self::IRON_HOE] = IronHoe::class;\n\t\t\tself::$list[self::DIAMOND_SWORD] = DiamondSword::class;\n\t\t\tself::$list[self::DIAMOND_SHOVEL] = DiamondShovel::class;\n\t\t\tself::$list[self::DIAMOND_PICKAXE] = DiamondPickaxe::class;\n\t\t\tself::$list[self::DIAMOND_AXE] = DiamondAxe::class;\n\t\t\tself::$list[self::DIAMOND_HOE] = DiamondHoe::class;\n\t\t\tself::$list[self::GOLD_SWORD] = GoldSword::class;\n\t\t\tself::$list[self::GOLD_SHOVEL] = GoldShovel::class;\n\t\t\tself::$list[self::GOLD_PICKAXE] = GoldPickaxe::class;\n\t\t\tself::$list[self::GOLD_AXE] = GoldAxe::class;\n\t\t\tself::$list[self::GOLD_HOE] = GoldHoe::class;\n\t\t\tself::$list[self::STONE_SWORD] = StoneSword::class;\n\t\t\tself::$list[self::STONE_SHOVEL] = StoneShovel::class;\n\t\t\tself::$list[self::STONE_PICKAXE] = StonePickaxe::class;\n\t\t\tself::$list[self::STONE_AXE] = StoneAxe::class;\n\t\t\tself::$list[self::STONE_HOE] = StoneHoe::class;\n\t\t\tself::$list[self::WOODEN_SWORD] = WoodenSword::class;\n\t\t\tself::$list[self::WOODEN_SHOVEL] = WoodenShovel::class;\n\t\t\tself::$list[self::WOODEN_PICKAXE] = WoodenPickaxe::class;\n\t\t\tself::$list[self::WOODEN_AXE] = WoodenAxe::class;\n\t\t\tself::$list[self::WOODEN_HOE] = WoodenHoe::class;\n\t\t\tself::$list[self::FLINT_STEEL] = FlintSteel::class;\n\t\t\tself::$list[self::SHEARS] = Shears::class;\n\t\t\tself::$list[self::BOW] = Bow::class;\n\n\t\t\tself::$list[self::RAW_FISH] = Fish::class;\n\t\t\tself::$list[self::COOKED_FISH] = CookedFish::class;\n\n\t\t\tself::$list[self::NETHER_QUARTZ] = NetherQuartz::class;\n\t\t\tself::$list[self::POTION] = Potion::class;\n\t\t\tself::$list[self::GLASS_BOTTLE] = GlassBottle::class;\n\t\t\tself::$list[self::SPLASH_POTION] = SplashPotion::class;\n\t\t\tself::$list[self::ENCHANTING_BOTTLE] = EnchantingBottle::class;\n\t\t\tself::$list[self::BOAT] = Boat::class;\n\t\t\tself::$list[self::MINECART] = Minecart::class;\n\n\t\t\tself::$list[self::ARROW] = Arrow::class;\n\t\t\tself::$list[self::STRING] = ItemString::class;\n\t\t\tself::$list[self::GUNPOWDER] = Gunpowder::class;\n\t\t\tself::$list[self::WHEAT] = Wheat::class;\n\t\t\tself::$list[self::BREAD] = Bread::class;\n\t\t\tself::$list[self::FLINT] = Flint::class;\n\t\t\tself::$list[self::FLINT] = Flint::class;\n\t\t\tself::$list[self::RAW_PORKCHOP] = RawPorkchop::class;\n\t\t\tself::$list[self::COOKED_PORKCHOP] = CookedPorkchop::class;\n\t\t\tself::$list[self::GOLDEN_APPLE] = GoldenApple::class;\n\t\t\tself::$list[self::MINECART] = Minecart::class;\n\t\t\tself::$list[self::REDSTONE] = Redstone::class;\n\t\t\tself::$list[self::LEATHER] = Leather::class;\n\t\t\tself::$list[self::CLAY] = Clay::class;\n\t\t\tself::$list[self::PAPER] = Paper::class;\n\t\t\tself::$list[self::BOOK] = Book::class;\n\t\t\tself::$list[self::SLIMEBALL] = Slimeball::class;\n\t\t\tself::$list[self::EGG] = Egg::class;\n\t\t\tself::$list[self::COMPASS] = Compass::class;\n\t\t\tself::$list[self::CLOCK] = Clock::class;\n\t\t\tself::$list[self::GLOWSTONE_DUST] = GlowstoneDust::class;\n\t\t\tself::$list[self::DYE] = Dye::class;\n\t\t\tself::$list[self::BONE] = Bone::class;\n\t\t\tself::$list[self::SUGAR] = Sugar::class;\n\t\t\tself::$list[self::COOKIE] = Cookie::class;\n\t\t\tself::$list[self::MELON] = Melon::class;\n\t\t\tself::$list[self::RAW_BEEF] = RawBeef::class;\n\t\t\tself::$list[self::STEAK] = Steak::class;\n\t\t\tself::$list[self::RAW_CHICKEN] = RawChicken::class;\n\t\t\tself::$list[self::COOKED_CHICKEN] = CookedChicken::class;\n\t\t\tself::$list[self::GOLD_NUGGET] = GoldNugget::class;\n\t\t\tself::$list[self::EMERALD] = Emerald::class;\n\t\t\tself::$list[self::ITEM_FRAME] = ItemFrame::class;\n\t\t\tself::$list[self::FLOWER_POT] = FlowerPot::class;\n\t\t\tself::$list[self::CARROT] = Carrot::class;\n\t\t\tself::$list[self::POTATO] = Potato::class;\n\t\t\tself::$list[self::BAKED_POTATO] = BakedPotato::class;\n\t\t\tself::$list[self::PUMPKIN_PIE] = PumpkinPie::class;\n\t\t\tself::$list[self::NETHER_BRICK] = NetherBrick::class;\n\t\t\tself::$list[self::QUARTZ] = Quartz::class;\n\t\t\tself::$list[self::BREWING_STAND] = BrewingStand::class;\n\t\t\tself::$list[self::CAMERA] = Camera::class;\n\t\t\tself::$list[self::BEETROOT] = Beetroot::class;\n\t\t\tself::$list[self::SKULL] = Skull::class;\n\t\t\tself::$list[self::RAW_RABBIT] = RawRabbit::class;\n\t\t\tself::$list[self::COOKED_RABBIT] = CookedRabbit::class;\n\t\t\tself::$list[self::GOLDEN_CARROT] = GoldenCarrot::class;\n\t\t\tself::$list[self::NETHER_WART] = NetherWart::class;\n\t\t\tself::$list[self::SPIDER_EYE] = SpiderEye::class;\n\t\t\tself::$list[self::FERMENTED_SPIDER_EYE] = FermentedSpiderEye::class;\n\t\t\tself::$list[self::BLAZE_POWDER] = BlazePowder::class;\n\t\t\tself::$list[self::MAGMA_CREAM] = MagmaCream::class;\n\t\t\tself::$list[self::GLISTERING_MELON] = GlisteringMelon::class;\n\t\t\tself::$list[self::ENCHANTED_BOOK] = EnchantedBook::class;\n\t\t\tself::$list[self::REPEATER] = Repeater::class;\n\t\t\tself::$list[self::CAULDRON] = Cauldron::class;\n\t\t\tself::$list[self::ROTTEN_FLESH] = RottenFlesh::class;\n\t\t\tself::$list[self::ENCHANTED_GOLDEN_APPLE] = EnchantedGoldenApple::class;\n\t\t\tself::$list[self::RAW_MUTTON] = RawMutton::class;\n\t\t\tself::$list[self::COOKED_MUTTON] = CookedMutton::class;\n\t\t\tself::$list[self::HOPPER] = Hopper::class;\n\t\t\tself::$list[self::ELYTRA] = Elytra::class;\n\t\t\tself::$list[self::NETHER_STAR] = NetherStar::class;\n\t\t\tself::$list[self::CHORUS_FRUIT] = ChorusFruit::class;\n\t\t\tself::$list[self::PRISMARINE_CRYSTALS] = PrismarineCrystals::class;\n\t\t\tself::$list[self::PRISMARINE_SHARD] = PrismarineShard::class;\n\n\t\t\tfor($i = 0; $i < 256; ++$i){\n\t\t\t\tif(Block::$list[$i] !== null){\n\t\t\t\t\tself::$list[$i] = Block::$list[$i];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tself::initCreativeItems();\n\t}\n\n\tprivate static $creative = [];\n\n\tprivate static function initCreativeItems(){\n\t\tself::clearCreativeItems();\n\n\t\t$creativeItems = new Config(Server::getInstance()->getFilePath() . \"src/pocketmine/resources/creativeitems.json\", Config::JSON, []);\n\n\t\tforeach($creativeItems->getAll() as $data){\n\t\t\t$item = Item::get($data[\"id\"], $data[\"damage\"], $data[\"count\"], $data[\"nbt\"]);\n\t\t\tif($item->getName() === \"Unknown\"){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tself::addCreativeItem($item);\n\t\t}\n\t}\n\n\tpublic static function clearCreativeItems(){\n\t\tItem::$creative = [];\n\t}\n\n\tpublic static function getCreativeItems() : array{\n\t\treturn Item::$creative;\n\t}\n\t\n\tpublic static function addCreativeItem(Item $item){\n\t\tItem::$creative[] = clone $item;\n\t}\n\n\tpublic static function removeCreativeItem(Item $item){\n\t\t$index = self::getCreativeItemIndex($item);\n\t\tif($index !== -1){\n\t\t\tunset(Item::$creative[$index]);\n\t\t}\n\t}\n\n\tpublic static function isCreativeItem(Item $item) : bool{\n\t\tforeach(Item::$creative as $i => $d){\n\t\t\tif($item->equals($d, !$item->isTool())){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param $index\n\t * @return Item\n\t */\n\tpublic static function getCreativeItem(int $index){\n\t\treturn isset(Item::$creative[$index]) ? Item::$creative[$index] : null;\n\t}\n\n\tpublic static function getCreativeItemIndex(Item $item) : int{\n\t\tforeach(Item::$creative as $i => $d){\n\t\t\tif($item->equals($d, !$item->isTool())){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\tpublic static function get(int $id, int $meta = 0, int $count = 1, string $tags = \"\") : Item{\n\t\ttry{\n\t\t\t$class = self::$list[$id];\n\t\t\tif($class === null){\n\t\t\t\treturn (new Item($id, $meta, $count))->setCompoundTag($tags);\n\t\t\t}elseif($id < 256){\n\t\t\t\treturn (new ItemBlock(new $class($meta), $meta, $count))->setCompoundTag($tags);\n\t\t\t}else{\n\t\t\t\treturn (new $class($meta, $count))->setCompoundTag($tags);\n\t\t\t}\n\t\t}catch(\\RuntimeException $e){\n\t\t\treturn (new Item($id, $meta, $count))->setCompoundTag($tags);\n\t\t}\n\t}\n\n\t/**\n\t * @param string $str\n\t * @param bool   $multiple\n\t * @return Item[]|Item\n\t */\n\tpublic static function fromString(string $str, bool $multiple = false){\n\t\tif($multiple === true){\n\t\t\t$blocks = [];\n\t\t\tforeach(explode(\",\", $str) as $b){\n\t\t\t\t$blocks[] = self::fromString($b, false);\n\t\t\t}\n\n\t\t\treturn $blocks;\n\t\t}else{\n\t\t\t$b = explode(\":\", str_replace([\" \", \"minecraft:\"], [\"_\", \"\"], trim($str)));\n\t\t\tif(!isset($b[1])){\n\t\t\t\t$meta = 0;\n\t\t\t}else{\n\t\t\t\t$meta = $b[1] & 0xFFFF;\n\t\t\t}\n\n\t\t\tif(defined(Item::class . \"::\" . strtoupper($b[0]))){\n\t\t\t\t$item = self::get(constant(Item::class . \"::\" . strtoupper($b[0])), $meta);\n\t\t\t\tif($item->getId() === self::AIR and strtoupper($b[0]) !== \"AIR\"){\n\t\t\t\t\t$item = self::get($b[0] & 0xFFFF, $meta);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$item = self::get($b[0] & 0xFFFF, $meta);\n\t\t\t}\n\n\t\t\treturn $item;\n\t\t}\n\t}\n\n\tpublic function __construct(int $id, int $meta = 0, int $count = 1, string $name = \"Unknown\"){\n\t\t$this->id = $id & 0xffff;\n\t\t$this->meta = $meta !== -1 ? $meta & 0xffff : -1;\n\t\t$this->count = $count;\n\t\t$this->name = $name;\n\t\tif(!isset($this->block) and $this->id <= 0xff and isset(Block::$list[$this->id])){\n\t\t\t$this->block = Block::get($this->id, $this->meta);\n\t\t\t$this->name = $this->block->getName();\n\t\t}\n\t}\n\n\tpublic function setCompoundTag($tags){\n\t\tif($tags instanceof CompoundTag){\n\t\t\t$this->setNamedTag($tags);\n\t\t}else{\n\t\t\t$this->tags = (string) $tags;\n\t\t\t$this->cachedNBT = null;\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getCompoundTag() : string{\n\t\treturn $this->tags;\n\t}\n\n\tpublic function hasCompoundTag() : bool{\n\t\treturn $this->tags !== \"\";\n\t}\n\n\tpublic function hasCustomBlockData() : bool{\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->BlockEntityTag) and $tag->BlockEntityTag instanceof CompoundTag){\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function clearCustomBlockData(){\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn $this;\n\t\t}\n\t\t$tag = $this->getNamedTag();\n\n\t\tif(isset($tag->BlockEntityTag) and $tag->BlockEntityTag instanceof CompoundTag){\n\t\t\tunset($tag->display->BlockEntityTag);\n\t\t\t$this->setNamedTag($tag);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\tpublic function setCustomBlockData(CompoundTag $compound){\n\t\t$tags = clone $compound;\n\t\t$tags->setName(\"BlockEntityTag\");\n\n\t\tif(!$this->hasCompoundTag()){\n\t\t\t$tag = new CompoundTag(\"\", []);\n\t\t}else{\n\t\t\t$tag = $this->getNamedTag();\n\t\t}\n\n\t\t$tag->BlockEntityTag = $tags;\n\t\t$this->setNamedTag($tag);\n\n\t\treturn $this;\n\t}\n\n\tpublic function getCustomBlockData(){\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn null;\n\t\t}\n\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->BlockEntityTag) and $tag->BlockEntityTag instanceof CompoundTag){\n\t\t\treturn $tag->BlockEntityTag;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function hasEnchantments() : bool{\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->ench)){\n\t\t\t$tag = $tag->ench;\n\t\t\tif($tag instanceof ListTag){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param $id\n\t * @return Enchantment|null\n\t */\n\tpublic function getEnchantment(int $id){\n\t\tif(!$this->hasEnchantments()){\n\t\t\treturn null;\n\t\t}\n\n\t\tforeach($this->getNamedTag()->ench as $entry){\n\t\t\tif($entry[\"id\"] === $id){\n\t\t\t\t$e = Enchantment::getEnchantment($entry[\"id\"]);\n\t\t\t\t$e->setLevel($entry[\"lvl\"]);\n\t\t\t\treturn $e;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param int  $id\n\t * @param int  $level\n\t * @param bool $compareLevel\n\t * @return bool\n\t */\n\tpublic function hasEnchantment(int $id, int $level = 1, bool $compareLevel = false) : bool{\n\t\tif($this->hasEnchantments()){\n\t\t\tforeach($this->getEnchantments() as $enchantment){\n\t\t\t\tif($enchantment->getId() == $id){\n\t\t\t\t\tif($compareLevel){\n\t\t\t\t\t\tif($enchantment->getLevel() == $level){\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t\n\t/**\n\t * @param $id\n\t * @return Int level|0(for null)\n\t */\n\tpublic function getEnchantmentLevel(int $id){\n\t\tif(!$this->hasEnchantments()){\n\t\t\treturn 0;\n\t\t}\n\n\t\tforeach($this->getNamedTag()->ench as $entry){\n\t\t\tif($entry[\"id\"] === $id){\n\t\t\t\t$e = Enchantment::getEnchantment($entry[\"id\"]);\n\t\t\t\t$e->setLevel($entry[\"lvl\"]);\n\t\t\t\t$E_level = $e->getLevel() > Enchantment::getEnchantMaxLevel($id) ? Enchantment::getEnchantMaxLevel($id) : $e->getLevel();\n\t\t\t\treturn $E_level;\n\t\t\t}\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\t/**\n\t * @param Enchantment $ench\n\t */\n\tpublic function addEnchantment(Enchantment $ench){\n\t\tif(!$this->hasCompoundTag()){\n\t\t\t$tag = new CompoundTag(\"\", []);\n\t\t}else{\n\t\t\t$tag = $this->getNamedTag();\n\t\t}\n\n\t\tif(!isset($tag->ench)){\n\t\t\t$tag->ench = new ListTag(\"ench\", []);\n\t\t\t$tag->ench->setTagType(NBT::TAG_Compound);\n\t\t}\n\n\t\t$found = false;\n\n\t\tforeach($tag->ench as $k => $entry){\n\t\t\tif($entry[\"id\"] === $ench->getId()){\n\t\t\t\t$tag->ench->{$k} = new CompoundTag(\"\", [\n\t\t\t\t\t\"id\" => new ShortTag(\"id\", $ench->getId()),\n\t\t\t\t\t\"lvl\" => new ShortTag(\"lvl\", $ench->getLevel())\n\t\t\t\t]);\n\t\t\t\t$found = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!$found){\n\t\t\t$count = 0;\n\t\t\tforeach($tag->ench as $key => $value){\n\t\t\t\tif(is_numeric($key)){\n\t\t\t\t\t$count++;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$tag->ench->{$count + 1} = new CompoundTag(\"\", [\n\t\t\t\t\"id\" => new ShortTag(\"id\", $ench->getId()),\n\t\t\t\t\"lvl\" => new ShortTag(\"lvl\", $ench->getLevel())\n\t\t\t]);\n\t\t}\n\n\t\t$this->setNamedTag($tag);\n\t}\n\n\t/**\n\t * @return Enchantment[]\n\t */\n\tpublic function getEnchantments() : array{\n\t\tif(!$this->hasEnchantments()){\n\t\t\treturn [];\n\t\t}\n\n\t\t$enchantments = [];\n\n\t\tforeach($this->getNamedTag()->ench as $entry){\n\t\t\t$e = Enchantment::getEnchantment($entry[\"id\"]);\n\t\t\t$e->setLevel($entry[\"lvl\"]);\n\t\t\t$enchantments[] = $e;\n\t\t}\n\n\t\treturn $enchantments;\n\t}\n\n\tpublic function hasRepairCost() : bool{\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->RepairCost)){\n\t\t\t$tag = $tag->RepairCost;\n\t\t\tif($tag instanceof IntTag){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getRepairCost() : int{\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn 1;\n\t\t}\n\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->display)){\n\t\t\t$tag = $tag->RepairCost;\n\t\t\tif($tag instanceof IntTag){\n\t\t\t\treturn $tag->getValue();\n\t\t\t}\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\n\tpublic function setRepairCost(int $cost){\n\t\tif($cost === 1){\n\t\t\t$this->clearRepairCost();\n\t\t}\n\n\t\tif(!($hadCompoundTag = $this->hasCompoundTag())){\n\t\t\t$tag = new CompoundTag(\"\", []);\n\t\t}else{\n\t\t\t$tag = $this->getNamedTag();\n\t\t}\n\n\t\t$tag->RepairCost = new IntTag(\"RepairCost\", $cost);\n\n\t\tif(!$hadCompoundTag){\n\t\t\t$this->setCompoundTag($tag);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\tpublic function clearRepairCost(){\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn $this;\n\t\t}\n\t\t$tag = $this->getNamedTag();\n\n\t\tif(isset($tag->RepairCost) and $tag->RepairCost instanceof IntTag){\n\t\t\tunset($tag->RepairCost);\n\t\t\t$this->setNamedTag($tag);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\n\tpublic function hasCustomName() : bool{\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->display)){\n\t\t\t$tag = $tag->display;\n\t\t\tif($tag instanceof CompoundTag and isset($tag->Name) and $tag->Name instanceof StringTag){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function getCustomName() : string{\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn \"\";\n\t\t}\n\n\t\t$tag = $this->getNamedTag();\n\t\tif(isset($tag->display)){\n\t\t\t$tag = $tag->display;\n\t\t\tif($tag instanceof CompoundTag and isset($tag->Name) and $tag->Name instanceof StringTag){\n\t\t\t\treturn $tag->Name->getValue();\n\t\t\t}\n\t\t}\n\n\t\treturn \"\";\n\t}\n\n\tpublic function setCustomName(string $name){\n\t\tif($name === \"\"){\n\t\t\t$this->clearCustomName();\n\t\t}\n\n\t\tif(!($hadCompoundTag = $this->hasCompoundTag())){\n\t\t\t$tag = new CompoundTag(\"\", []);\n\t\t}else{\n\t\t\t$tag = $this->getNamedTag();\n\t\t}\n\n\t\tif(isset($tag->display) and $tag->display instanceof CompoundTag){\n\t\t\t$tag->display->Name = new StringTag(\"Name\", $name);\n\t\t}else{\n\t\t\t$tag->display = new CompoundTag(\"display\", [\n\t\t\t\t\"Name\" => new StringTag(\"Name\", $name)\n\t\t\t]);\n\t\t}\n\n\t\tif(!$hadCompoundTag){\n\t\t\t$this->setCompoundTag($tag);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\tpublic function clearCustomName(){\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn $this;\n\t\t}\n\t\t$tag = $this->getNamedTag();\n\n\t\tif(isset($tag->display) and $tag->display instanceof CompoundTag){\n\t\t\tunset($tag->display->Name);\n\t\t\tif($tag->display->getCount() === 0){\n\t\t\t\tunset($tag->display);\n\t\t\t}\n\n\t\t\t$this->setNamedTag($tag);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\tpublic function getNamedTagEntry($name){\n\t\t$tag = $this->getNamedTag();\n\t\tif($tag !== null){\n\t\t\treturn isset($tag->{$name}) ? $tag->{$name} : null;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function getNamedTag(){\n\t\tif(!$this->hasCompoundTag()){\n\t\t\treturn null;\n\t\t}elseif($this->cachedNBT !== null){\n\t\t\treturn $this->cachedNBT;\n\t\t}\n\t\treturn $this->cachedNBT = self::parseCompoundTag($this->tags);\n\t}\n\n\tpublic function setNamedTag(CompoundTag $tag){\n\t\tif($tag->getCount() === 0){\n\t\t\treturn $this->clearNamedTag();\n\t\t}\n\n\t\t$this->cachedNBT = $tag;\n\t\t$this->tags = self::writeCompoundTag($tag);\n\n\t\treturn $this;\n\t}\n\n\tpublic function clearNamedTag(){\n\t\treturn $this->setCompoundTag(\"\");\n\t}\n\n\tpublic function getCount() : int{\n\t\treturn $this->count;\n\t}\n\n\tpublic function setCount(int $count){\n\t\t$this->count = $count;\n\t}\n\n\tfinal public function getName() : string{\n\t\treturn $this->hasCustomName() ? $this->getCustomName() : $this->name;\n\t}\n\n\tfinal public function canBePlaced() : bool{\n\t\treturn $this->block !== null and $this->block->canBePlaced();\n\t}\n\n\tfinal public function isPlaceable() : bool{\n\t\treturn $this->canBePlaced();\n\t}\n\n\tpublic function canBeConsumed() : bool{\n\t\treturn false;\n\t}\n\n\tpublic function canBeConsumedBy(Entity $entity) : bool{\n\t\treturn $this->canBeConsumed();\n\t}\n\n\tpublic function onConsume(Entity $entity){\n\t}\n\n\tpublic function getBlock() : Block{\n\t\tif($this->block instanceof Block){\n\t\t\treturn clone $this->block;\n\t\t}else{\n\t\t\treturn Block::get(self::AIR);\n\t\t}\n\t}\n\n\tfinal public function getId() : int{\n\t\treturn $this->id;\n\t}\n\n\tfinal public function getDamage() : int{\n\t\treturn $this->meta;\n\t}\n\n\tpublic function setDamage(int $meta){\n\t\t$this->meta = $meta !== -1 ? $meta & 0xFFFF : -1;\n\t}\n\n\tpublic function hasAnyDamageValue() : bool{\n\t\treturn $this->meta === -1;\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 64;\n\t}\n\n\tfinal public function getFuelTime(){\n\t\tif(!isset(Fuel::$duration[$this->id])){\n\t\t\treturn null;\n\t\t}\n\t\tif($this->id !== self::BUCKET or $this->meta === 10){\n\t\t\treturn Fuel::$duration[$this->id];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param Entity|Block $object\n\t *\n\t * @return bool\n\t */\n\tpublic function useOn($object){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isTool(){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return int|bool\n\t */\n\tpublic function getMaxDurability(){\n\t\treturn false;\n\t}\n\n\tpublic function isPickaxe(){\n\t\treturn false;\n\t}\n\n\tpublic function isAxe(){\n\t\treturn false;\n\t}\n\n\tpublic function isSword(){\n\t\treturn false;\n\t}\n\n\tpublic function isShovel(){\n\t\treturn false;\n\t}\n\n\tpublic function isHoe(){\n\t\treturn false;\n\t}\n\n\tpublic function isShears(){\n\t\treturn false;\n\t}\n\n\tpublic function isArmor(){\n\t\treturn false;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn false;\n\t}\n\n\tpublic function isBoots(){\n\t\treturn false;\n\t}\n\n\tpublic function isHelmet(){\n\t\treturn false;\n\t}\n\n\tpublic function isLeggings(){\n\t\treturn false;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn false;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 1;\n\t}\n\n\tpublic function getModifyAttackDamage(Entity $target){\n\t\t$rec = $this->getAttackDamage();\n\t\t$sharpL = $this->getEnchantmentLevel(Enchantment::TYPE_WEAPON_SHARPNESS);\n\t\tif($sharpL > 0){\n\t\t\t$rec += 0.5 * ($sharpL + 1);\n\t\t}\n\n\t\tif($target instanceof Skeleton or $target instanceof Zombie or\n\t\t\t$target instanceof Witch or $target instanceof PigZombie){\n\t\t\t//SMITE    wither skeletons\n\t\t\t$rec += 2.5 * $this->getEnchantmentLevel(Enchantment::TYPE_WEAPON_SMITE);\n\n\t\t}elseif($target instanceof Spider or $target instanceof CaveSpider or\n\t\t\t$target instanceof Silverfish){\n\t\t\t//Bane of Arthropods    wither skeletons\n\t\t\t$rec += 2.5 * $this->getEnchantmentLevel(Enchantment::TYPE_WEAPON_ARTHROPODS);\n\n\t\t}\n\t\treturn $rec;\n\t}\n\n\tpublic function getDestroySpeed(Block $block, Player $player){\n\t\treturn 1;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\treturn false;\n\t}\n\n\tpublic final function equals(Item $item, bool $checkDamage = true, bool $checkCompound = true, bool $checkCount = false) : bool{\n\t\treturn $this->id === $item->getId() and ($checkCount === false or $this->getCount() === $item->getCount()) and($checkDamage === false or $this->getDamage() === $item->getDamage()) and ($checkCompound === false or $this->getCompoundTag() === $item->getCompoundTag());\n\t}\n\n\tpublic final function deepEquals(Item $item, bool $checkDamage = true, bool $checkCompound = true, bool $checkCount = false) : bool{\n\t\tif($this->equals($item, $checkDamage, $checkCompound, $checkCount)){\n\t\t\treturn true;\n\t\t}elseif($item->hasCompoundTag() and $this->hasCompoundTag()){\n\t\t\treturn NBT::matchTree($this->getNamedTag(), $item->getNamedTag());\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tfinal public function __toString() : string{\n\t\treturn \"Item \" . $this->name . \" (\" . $this->id . \":\" . ($this->meta === null ? \"?\" : $this->meta) . \")x\" . $this->count . ($this->hasCompoundTag() ? \" tags:0x\" . bin2hex($this->getCompoundTag()) : \"\");\n\t}\n\n\tfinal public function jsonSerialize(){\n\t\treturn [\n\t\t\t\"id\" => $this->id,\n\t\t\t\"damage\" => $this->meta,\n\t\t\t\"count\" => $this->count, //TODO: separate items and stacks\n\t\t\t\"nbt\" => $this->tags\n\t\t];\n\t}\n\n\t/**\n\t * Serializes the item to an NBT CompoundTag\n\t *\n\t * @param int    $slot optional, the inventory slot of the item\n\t * @param string $tagName the name to assign to the CompoundTag object\n\t *\n\t * @return CompoundTag\n\t */\n\tpublic function nbtSerialize(int $slot = -1, string $tagName = \"\") : CompoundTag{\n\t\t$tag = new CompoundTag($tagName, [\n\t\t\t\"id\" => new ShortTag(\"id\", $this->id),\n\t\t\t\"Count\" => new ByteTag(\"Count\", $this->count ?? -1),\n\t\t\t\"Damage\" => new ShortTag(\"Damage\", $this->meta),\n\t\t]);\n\n\t\tif($this->hasCompoundTag()){\n\t\t\t$tag->tag = clone $this->getNamedTag();\n\t\t\t$tag->tag->setName(\"tag\");\n\t\t}\n\t\t\n\t\tif($slot !== -1){\n\t\t\t$tag->Slot = new ByteTag(\"Slot\", $slot);\n\t\t}\n\n\t\treturn $tag;\n\t}\n\n\t/**\n\t * Deserializes an Item from an NBT CompoundTag\n\t *\n\t * @param CompoundTag $tag\n\t *\n\t * @return Item\n\t */\n\tpublic static function nbtDeserialize(CompoundTag $tag) : Item{\n\t\tif(!isset($tag->id) or !isset($tag->Count)){\n\t\t\treturn Item::get(0);\n\t\t}\n\n\t\tif($tag->id instanceof ShortTag){\n\t\t\t$item = Item::get($tag->id->getValue(), !isset($tag->Damage) ? 0 : $tag->Damage->getValue(), $tag->Count->getValue());\n\t\t}elseif($tag->id instanceof StringTag){ //PC item save format\n\t\t\t$item = Item::fromString($tag->id->getValue());\n\t\t\t$item->setDamage(!isset($tag->Damage) ? 0 : $tag->Damage->getValue());\n\t\t\t$item->setCount($tag->Count->getValue());\n\t\t}else{\n\t\t\tthrow new \\InvalidArgumentException(\"Item CompoundTag ID must be an instance of StringTag or ShortTag, \" . get_class($tag->id) . \" given\");\n\t\t}\n\n\t\tif(isset($tag->tag) and $tag->tag instanceof CompoundTag){\n\t\t\t$item->setNamedTag($tag->tag);\n\t\t}\n\n\t\treturn $item;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/item/ItemBlock.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\n/**\n * Class used for Items that can be Blocks\n */\nclass ItemBlock extends Item{\n\tpublic function __construct(Block $block, $meta = 0, int $count = 1){\n\t\t$this->block = $block;\n\t\tparent::__construct($block->getId(), $block->getDamage(), $count, $block->getName());\n\t}\n\n\tpublic function setDamage(int $meta){\n\t\t$this->meta = $meta !== -1 ? $meta & 0xf : -1;\n\t\t$this->block->setDamage($this->meta !== -1 ? $this->meta : 0);\n\t}\n\n\tpublic function __clone(){\n\t\t$this->block = clone $this->block;\n\t}\n\n\tpublic function getBlock() : Block{\n\t\treturn $this->block;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/item/ItemFrame.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass ItemFrame extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::ITEM_FRAME_BLOCK);\n\t\tparent::__construct(self::ITEM_FRAME, 0, $count, \"Item Frame\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/ItemIds.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \n namespace pocketmine\\item;\n \n use pocketmine\\block\\BlockIds;\n \n interface ItemIds extends BlockIds{\n\t\n\t//All BlockIds are also accessible through this interface.\n\tconst IRON_SHOVEL = 256;\n\tconst IRON_PICKAXE = 257;\n\tconst IRON_AXE = 258;\n\tconst FLINT_AND_STEEL = 259; const FLINT_STEEL = 259;\n\tconst APPLE = 260;\n\tconst BOW = 261;\n\tconst ARROW = 262;\n\tconst COAL = 263;\n\tconst DIAMOND = 264;\n\tconst IRON_INGOT = 265;\n\tconst GOLD_INGOT = 266;\n\tconst IRON_SWORD = 267;\n\tconst WOODEN_SWORD = 268;\n\tconst WOODEN_SHOVEL = 269;\n\tconst WOODEN_PICKAXE = 270;\n\tconst WOODEN_AXE = 271;\n\tconst STONE_SWORD = 272;\n\tconst STONE_SHOVEL = 273;\n\tconst STONE_PICKAXE = 274;\n\tconst STONE_AXE = 275;\n\tconst DIAMOND_SWORD = 276;\n\tconst DIAMOND_SHOVEL = 277;\n\tconst DIAMOND_PICKAXE = 278;\n\tconst DIAMOND_AXE = 279;\n\tconst STICK = 280; const STICKS = 280;\n\tconst BOWL = 281;\n\tconst MUSHROOM_STEW = 282;\n\tconst GOLD_SWORD = 283; const GOLDEN_SWORD = 283;\n\tconst GOLD_SHOVEL = 284; const GOLDEN_SHOVEL = 284;\n\tconst GOLD_PICKAXE = 285; const GOLDEN_PICKAXE = 285;\n\tconst GOLD_AXE = 286; const GOLDEN_AXE = 286;\n\tconst STRING = 287;\n\tconst FEATHER = 288;\n\tconst GUNPOWDER = 289;\n\tconst WOODEN_HOE = 290;\n\tconst STONE_HOE = 291;\n\tconst IRON_HOE = 292;\n\tconst DIAMOND_HOE = 293;\n\tconst GOLD_HOE = 294; const GOLDEN_HOE = 294;\n\tconst SEEDS = 295; const WHEAT_SEEDS = 295;\n\tconst WHEAT = 296;\n\tconst BREAD = 297;\n\tconst LEATHER_CAP = 298;\n\tconst LEATHER_TUNIC = 299;\n\tconst LEATHER_PANTS = 300;\n\tconst LEATHER_BOOTS = 301;\n\tconst CHAIN_HELMET = 302;\n\tconst CHAIN_CHESTPLATE = 303;\n\tconst CHAIN_LEGGINGS = 304;\n\tconst CHAIN_BOOTS = 305;\n\tconst IRON_HELMET = 306;\n\tconst IRON_CHESTPLATE = 307;\n\tconst IRON_LEGGINGS = 308;\n\tconst IRON_BOOTS = 309;\n\tconst DIAMOND_HELMET = 310;\n\tconst DIAMOND_CHESTPLATE = 311;\n\tconst DIAMOND_LEGGINGS = 312;\n\tconst DIAMOND_BOOTS = 313;\n\tconst GOLD_HELMET = 314;\n\tconst GOLD_CHESTPLATE = 315;\n\tconst GOLD_LEGGINGS = 316;\n\tconst GOLD_BOOTS = 317;\n\tconst FLINT = 318;\n\tconst RAW_PORKCHOP = 319;\n\tconst COOKED_PORKCHOP = 320;\n\tconst PAINTING = 321;\n\tconst GOLDEN_APPLE = 322;\n\tconst SIGN = 323;\n\tconst WOODEN_DOOR = 324; const OAK_DOOR = 324;\n\tconst BUCKET = 325;\n\n\tconst MINECART = 328;\n\tconst SADDLE = 329;\n\tconst IRON_DOOR = 330;\n\tconst REDSTONE = 331;\n\tconst REDSTONE_DUST = 331;\n\tconst SNOWBALL = 332;\n\tconst BOAT = 333;\n\tconst LEATHER = 334;\n\t\n\tconst BRICK = 336;\n\tconst CLAY = 337;\n\tconst SUGARCANE = 338; const SUGAR_CANE = 338; const SUGAR_CANES = 338;\n\tconst PAPER = 339;\n\tconst BOOK = 340;\n\tconst SLIMEBALL = 341;\n\tconst MINECART_WITH_CHEST = 342;\n\t\n\tconst EGG = 344;\n\tconst COMPASS = 345;\n\tconst FISHING_ROD = 346;\n\tconst CLOCK = 347;\n\tconst GLOWSTONE_DUST = 348;\n\tconst RAW_FISH = 349;\n\tconst COOKED_FISH = 350;\n\tconst DYE = 351;\n\tconst BONE = 352;\n\tconst SUGAR = 353;\n\tconst CAKE = 354;\n\tconst BED = 355;\n\tconst REPEATER = 356;\n\tconst COOKIE = 357;\n\tconst FILLED_MAP = 358;\n\tconst SHEARS = 359;\n\tconst MELON = 360; const MELON_SLICE = 360;\n\tconst PUMPKIN_SEEDS = 361;\n\tconst MELON_SEEDS = 362;\n\tconst RAW_BEEF = 363;\n\tconst STEAK = 364; const COOKED_BEEF = 364;\n\tconst RAW_CHICKEN = 365;\n\tconst COOKED_CHICKEN = 366;\n\tconst ROTTEN_FLESH = 367;\n\tconst ENDERPEARL = 368; const ENDER_PEARL = 368;\n\tconst BLAZE_ROD = 369;\n\tconst GHAST_TEAR = 370;\n\tconst GOLD_NUGGET = 371; const GOLDEN_NUGGET = 371;\n\tconst NETHER_WART = 372;\n\tconst POTION = 373;\n\tconst GLASS_BOTTLE = 374;\n\tconst SPIDER_EYE = 375;\n\tconst FERMENTED_SPIDER_EYE = 376;\n\tconst BLAZE_POWDER = 377;\n\tconst MAGMA_CREAM = 378;\n\tconst BREWING_STAND = 379;\n\tconst CAULDRON = 380;\n\tconst ENDER_EYE = 381;\n\tconst GLISTERING_MELON = 382;\n\tconst SPAWN_EGG = 383;\n\tconst BOTTLE_O_ENCHANTING = 384; const ENCHANTING_BOTTLE = 384;\n\tconst FIRE_CHARGE = 385;\n\t\n\tconst EMERALD = 388;\n\tconst ITEM_FRAME = 389;\n\tconst FLOWER_POT = 390;\n\tconst CARROT = 391; const CARROTS = 391;\n\tconst POTATO = 392; const POTATOES = 392;\n\tconst BAKED_POTATO = 393; const BAKED_POTATOES = 393;\n\tconst POISONOUS_POTATO = 394;\n\tconst MAP = 395; const EMPTY_MAP = 395;\n\tconst GOLDEN_CARROT = 396;\n\tconst MOB_HEAD = 397; const SKULL = 397;\n\tconst CARROT_ON_A_STICK = 398;\n\tconst NETHER_STAR = 399;\n\tconst PUMPKIN_PIE = 400;\n\n\tconst ENCHANTED_BOOK = 403;\n\tconst COMPARATOR = 404;\n\tconst NETHER_BRICK = 405;\n\tconst QUARTZ = 406;\n\tconst NETHER_QUARTZ = 406;\n\tconst MINECART_WITH_TNT = 407;\n\tconst MINECART_WITH_HOPPER = 408;\n\tconst PRISMARINE_SHARD = 409;\n\tconst HOPPER = 410;\n\tconst RAW_RABBIT = 411;\n\tconst COOKED_RABBIT = 412;\n\tconst RABBIT_STEW = 413;\n\tconst RABBIT_FOOT = 414;\n\tconst RABBIT_HIDE = 415;\n\tconst LEATHER_HORSE_ARMOR = 416;\n\tconst IRON_HORSE_ARMOR = 417;\n\tconst GOLD_HORSE_ARMOR = 418;\n\tconst DIAMOND_HORSE_ARMOR = 419;\n\tconst LEAD = 420; const LEASH = 420;\n\tconst NAMETAG = 421;\n\tconst PRISMARINE_CRYSTALS = 422;\n\tconst RAW_MUTTON = 423;\n\tconst COOKED_MUTTON = 424;\n\n\tconst END_CRYSTAL = 426;\n\tconst SPRUCE_DOOR = 427;\n\tconst BIRCH_DOOR = 428;\n\tconst JUNGLE_DOOR = 429;\n\tconst ACACIA_DOOR = 430;\n\tconst DARK_OAK_DOOR = 431;\n\tconst CHORUS_FRUIT = 432;\n\tconst CHORUS_FRUIT_POPPED = 433;\n\t\n\tconst DRAGON_BREATH = 437;\n\tconst SPLASH_POTION = 438;\n\n\tconst LINGERING_SPLASH_POTION = 441;\n\n\tconst ELYTRA = 444; const ELYTRA_WINGS = 444; const ELYTRA_WING = 444;\n\tconst SHULKER_SHELL = 445;\n\t\n\tconst BEETROOT = 457;\n\tconst BEETROOT_SEEDS = 458; const BEETROOT_SEED = 458;\n\tconst BEETROOT_SOUP = 459;\n\tconst RAW_SALMON = 460;\n\tconst CLOWN_FISH = 461;\n\tconst PUFFER_FISH = 462;\n\tconst COOKED_SALMON = 463;\n\n\tconst ENCHANTED_GOLDEN_APPLE = 466;\n\n\tconst CAMERA = 498;\n }\n"
  },
  {
    "path": "src/pocketmine/item/ItemString.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass ItemString extends Item {\n\tpublic function __construct($meta = 0, $count = 1) {\n\t\tparent::__construct(self::STRING, $meta, $count, \"String\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/JungleDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass JungleDoor extends Door{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::JUNGLE_DOOR_BLOCK);\n\t\tparent::__construct(self::JUNGLE_DOOR, 0, $count, \"Jungle Door\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Leather.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Leather extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::LEATHER, $meta, $count, \"Leather\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/LeatherBoots.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass LeatherBoots extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::LEATHER_BOOTS, $meta, $count, \"Leather Boots\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_LEATHER;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_BOOTS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 66;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 1;\n\t}\n\n\tpublic function isBoots(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/LeatherCap.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass LeatherCap extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::LEATHER_CAP, $meta, $count, \"Leather Cap\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_LEATHER;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_HELMET;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 56;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 1;\n\t}\n\n\tpublic function isHelmet(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/LeatherPants.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass LeatherPants extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::LEATHER_PANTS, $meta, $count, \"Leather Pants\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_LEATHER;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_LEGGINGS;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 76;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 2;\n\t}\n\n\tpublic function isLeggings(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/LeatherTunic.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\n\nclass LeatherTunic extends Armor{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::LEATHER_TUNIC, $meta, $count, \"Leather Tunic\");\n\t}\n\n\tpublic function getArmorTier(){\n\t\treturn Armor::TIER_LEATHER;\n\t}\n\n\tpublic function getArmorType(){\n\t\treturn Armor::TYPE_CHESTPLATE;\n\t}\n\n\tpublic function getMaxDurability(){\n\t\treturn 81;\n\t}\n\n\tpublic function getArmorValue(){\n\t\treturn 3;\n\t}\n\n\tpublic function isChestplate(){\n\t\treturn true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/MagmaCream.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass MagmaCream extends Item {\n    public function __construct($meta = 0, $count =1){\n        parent::__construct(self::MAGMA_CREAM, $meta, $count, \"Magma Cream\");\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/item/Melon.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Melon extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::MELON, $meta, $count, \"Melon\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 2;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 1.2;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/MelonSeeds.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass MelonSeeds extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::MELON_STEM);\n\t\tparent::__construct(self::MELON_SEEDS, 0, $count, \"Melon Seeds\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Minecart.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\level\\Level;\nuse pocketmine\\block\\Block;\nuse pocketmine\\Player;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\entity\\Minecart as MinecartEntity;\n\nclass Minecart extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::MINECART, $meta, $count, \"Minecart\");\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\t$minecart = new MinecartEntity($player->getLevel()->getChunk($block->getX() >> 4, $block->getZ() >> 4), new CompoundTag(\"\", [\n\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\tnew DoubleTag(\"\", $block->getX()),\n\t\t\t\tnew DoubleTag(\"\", $block->getY() + 0.8),\n\t\t\t\tnew DoubleTag(\"\", $block->getZ())\n\t\t\t]),\n\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t]),\n\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t]),\n\t\t]));\n\t\t$minecart->spawnToAll();\n\n\t\tif($player->isSurvival()){\n\t\t\t$item = $player->getInventory()->getItemInHand();\n\t\t\t$count = $item->getCount();\n\t\t\tif(--$count <= 0){\n\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::AIR));\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\t$item->setCount($count);\n\t\t\t$player->getInventory()->setItemInHand($item);\n\t\t}\n\t\t\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/MobHead.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass MobHead extends Item{\n\t\n\tconst SLOT_NUMBER = 0;\n\t\n\tconst SKELETON = 0;\n\tconst WITHER_SKELETON = 1;\n\tconst ZOMBIE = 2;\n\tconst STEVE = 3;\n\tconst CREEPER = 4;\n\t\n\tstatic $names = [\n\t\tself::SKELETON => \"Skeleton Head\",\n\t\tself::WITHER_SKELETON => \"Wither Skeleton Head\",\n\t\tself::STEVE => \"Steve Head\",\n\t\tself::CREEPER => \"Creeper Head\",\n\t];\n\t\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Block::MOB_HEAD_BLOCK);\n\t\tparent::__construct(self::MOB_HEAD, $meta, $count, self::$names[$meta]);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/MushroomStew.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass MushroomStew extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::MUSHROOM_STEW, 0, $count, \"Mushroom Stew\");\n\t}\n\n\tpublic function getMaxStackSize() :int{\n\t\treturn 1;\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 6;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 7.2;\n\t}\n\n\tpublic function getResidue(){\n\t\treturn Item::get(Item::BOWL);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/NetherBrick.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass NetherBrick extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::NETHER_BRICK, $meta, $count, \"Nether Brick\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/NetherQuartz.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass NetherQuartz extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::NETHER_QUARTZ, 0, $count, \"Nether Quartz\");\n\t}\n} \n"
  },
  {
    "path": "src/pocketmine/item/NetherStar.php",
    "content": "<?php\n\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author H4PM Team\n * @link http://www.github.net/H4PM\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass NetherStar extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::NETHER_STAR, $meta, $count, \"Nether Star\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/NetherWart.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass NetherWart extends Item {\n    public function __construct($meta = 0, $count =1){\n    \t$this->block = Block::get(Item::NETHER_WART_BLOCK);\n    \tparent::__construct(self::NETHER_WART, $meta, $count, \"Nether Wart\");\n    }\n}\n"
  },
  {
    "path": "src/pocketmine/item/Painting.php",
    "content": "<?php\n/*\n * This file is translated from the Nukkit Project\n * which is written by MagicDroidX\n * @link https://github.com/Nukkit/Nukkit\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Player;\nuse pocketmine\\entity\\Painting as PaintingEntity;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\n\nclass Painting extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::PAINTING, 0, $count, \"Painting\");\n\t}\n\n\tpublic function canBeActivated() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\tif($target->isTransparent() === false and $face > 1 and $block->isSolid() === false){\n\t\t\t$faces = [\n\t\t\t\t2 => 1,\n\t\t\t\t3 => 3,\n\t\t\t\t4 => 0,\n\t\t\t\t5 => 2,\n\t\t\t];\n\t\t\t$motives = [\n\t\t\t\t// Motive Width Height\n\t\t\t\t[\"Kebab\", 1, 1],\n\t\t\t\t[\"Aztec\", 1, 1],\n\t\t\t\t[\"Alban\", 1, 1],\n\t\t\t\t[\"Aztec2\", 1, 1],\n\t\t\t\t[\"Bomb\", 1, 1],\n\t\t\t\t[\"Plant\", 1, 1],\n\t\t\t\t[\"Wasteland\", 1, 1],\n\t\t\t\t[\"Wanderer\", 1, 2],\n\t\t\t\t[\"Graham\", 1, 2],\n\t\t\t\t[\"Pool\", 2, 1],\n\t\t\t\t[\"Courbet\", 2, 1],\n\t\t\t\t[\"Sunset\", 2, 1],\n\t\t\t\t[\"Sea\", 2, 1],\n\t\t\t\t[\"Creebet\", 2, 1],\n\t\t\t\t[\"Match\", 2, 2],\n\t\t\t\t[\"Bust\", 2, 2],\n\t\t\t\t[\"Stage\", 2, 2],\n\t\t\t\t[\"Void\", 2, 2],\n\t\t\t\t[\"SkullAndRoses\", 2, 2],\n\t\t\t\t//array(\"Wither\", 2, 2),\n\t\t\t\t[\"Fighters\", 4, 2],\n\t\t\t\t[\"Skeleton\", 4, 3],\n\t\t\t\t[\"DonkeyKong\", 4, 3],\n\t\t\t\t[\"Pointer\", 4, 4],\n\t\t\t\t[\"Pigscene\", 4, 4],\n\t\t\t\t[\"Flaming Skull\", 4, 4],\n\t\t\t];\n\n\t\t\t$right = [4, 5, 3, 2];\n\n\t\t\t$validMotives = [];\n\t\t\tforeach($motives as $motive){\n\t\t\t\t$valid = true;\n\t\t\t\tfor($x = 0; $x < $motive[1] && $valid; $x++){\n\t\t\t\t\tfor($z = 0; $z < $motive[2] && $valid; $z++){\n\t\t\t\t\t\tif($target->getSide($right[$face - 2], $x)->isTransparent() ||\n\t\t\t\t\t\t\t$target->getSide(Vector3::SIDE_UP, $z)->isTransparent() ||\n\t\t\t\t\t\t\t$block->getSide($right[$face - 2], $x)->isSolid() ||\n\t\t\t\t\t\t\t$block->getSide(Vector3::SIDE_UP, $z)->isSolid()\n\t\t\t\t\t\t){\n\t\t\t\t\t\t\t$valid = false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif($valid){\n\t\t\t\t\t$validMotives[] = $motive;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$motive = $motives[mt_rand(0, count($validMotives) - 1)];\n\t\t\t$data = [\n\t\t\t\t\"x\" => $target->x,\n\t\t\t\t\"y\" => $target->y,\n\t\t\t\t\"z\" => $target->z,\n\t\t\t\t\"yaw\" => $faces[$face] * 90,\n\t\t\t\t\"Motive\" => $motive[0],\n\t\t\t];\n\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\"Motive\" => new StringTag(\"Motive\", $data[\"Motive\"]),\n\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\tnew DoubleTag(\"\", $data[\"x\"]),\n\t\t\t\t\tnew DoubleTag(\"\", $data[\"y\"]),\n\t\t\t\t\tnew DoubleTag(\"\", $data[\"z\"])\n\t\t\t\t]),\n\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\tnew FloatTag(\"\", $data[\"yaw\"]),\n\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t]);\n\n\t\t\t$painting = new PaintingEntity($player->getLevel()->getChunk($block->getX() >> 4, $block->getZ() >> 4), $nbt);\n\t\t\t$painting->spawnToAll();\n\n\t\t\tif($player->isSurvival()){\n\t\t\t\t$item = $player->getInventory()->getItemInHand();\n\t\t\t\t$count = $item->getCount();\n\t\t\t\tif(--$count <= 0){\n\t\t\t\t\t$player->getInventory()->setItemInHand(Item::get(Item::AIR));\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\t$item->setCount($count);\n\t\t\t\t$player->getInventory()->setItemInHand($item);\n\t\t\t}\n\t\t\t//TODO\n\t\t\t//$e = $server->api->entity->add($level, ENTITY_OBJECT, OBJECT_PAINTING, $data);\n\t\t\t//$e->spawnToAll();\n\t\t\t/*if(($player->gamemode & 0x01) === 0x00){\n\t\t\t\t$player->removeItem(Item::get($this->getId(), $this->getDamage(), 1));\n\t\t\t}*/\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/Paper.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Paper extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::PAPER, $meta, $count, \"Paper\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Potato.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Potato extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::POTATO_BLOCK);\n\t\tparent::__construct(self::POTATO, 0, $count, \"Potato\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Potion.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\Server;\nuse pocketmine\\Player;\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Human;\nuse pocketmine\\event\\entity\\EntityDrinkPotionEvent;\nuse pocketmine\\network\\protocol\\EntityEventPacket;\n\nclass Potion extends Item{\n\t\n\t//No effects\n\tconst WATER_BOTTLE = 0;\n\tconst MUNDANE = 1;\n\tconst MUNDANE_EXTENDED = 2;\n\tconst THICK = 3;\n\tconst AWKWARD = 4;\n\t\n\t//Actual potions\n\tconst NIGHT_VISION = 5;\n\tconst NIGHT_VISION_T = 6;\n\tconst INVISIBILITY = 7;\n\tconst INVISIBILITY_T = 8;\n\tconst LEAPING = 9;\n\tconst LEAPING_T = 10;\n\tconst LEAPING_TWO = 11;\n\tconst FIRE_RESISTANCE = 12;\n\tconst FIRE_RESISTANCE_T = 13;\n\tconst SWIFTNESS = 14;\n\tconst SWIFTNESS_T = 15;\n\tconst SWIFTNESS_TWO = 16;\n\tconst SLOWNESS = 17;\n\tconst SLOWNESS_T = 18;\n\tconst WATER_BREATHING = 19;\n\tconst WATER_BREATHING_T = 20;\t\n\tconst HEALING = 21;\n\tconst HEALING_TWO = 22;\n\tconst HARMING = 23;\n\tconst HARMING_TWO = 24;\n\tconst POISON = 25;\n\tconst POISON_T = 26;\n\tconst POISON_TWO = 27;\n\tconst REGENERATION = 28;\n\tconst REGENERATION_T = 29;\n\tconst REGENERATION_TWO = 30;\n\tconst STRENGTH = 31;\n\tconst STRENGTH_T = 32;\n\tconst STRENGTH_TWO = 33;\n\tconst WEAKNESS = 34;\n\tconst WEAKNESS_T = 35;\n\tconst DECAY = 36; //TODO\n\t\n\t//Structure: Potion ID => [matching effect, duration in ticks, amplifier]\n\t//Use false if no effects.\n\tconst POTIONS = [\n\t\tself::WATER_BOTTLE => false,\n\t\tself::MUNDANE => false,\n\t\tself::MUNDANE_EXTENDED => false,\n\t\tself::THICK => false,\n\t\tself::AWKWARD => false,\n\t\t\n\t\tself::NIGHT_VISION => [Effect::NIGHT_VISION, (180 * 20), 0],\n\t\tself::NIGHT_VISION_T =>\t[Effect::NIGHT_VISION, (480 * 20), 0],\n\t\t\n\t\tself::INVISIBILITY => [Effect::INVISIBILITY, (180 * 20), 0],\n\t\tself::INVISIBILITY_T => [Effect::INVISIBILITY, (480 * 20), 0],\n\t\t\n\t\tself::LEAPING => [Effect::JUMP, (180 * 20), 0],\n\t\tself::LEAPING_T => [Effect::JUMP, (480 * 20), 0],\n\t\tself::LEAPING_TWO => [Effect::JUMP, (90 * 20), 1],\n\t\t\n\t\tself::FIRE_RESISTANCE => [Effect::FIRE_RESISTANCE, (180 * 20), 0],\n\t\tself::FIRE_RESISTANCE_T => [Effect::FIRE_RESISTANCE, (480 * 20), 0],\n\t\t\n\t\tself::SWIFTNESS => [Effect::SPEED, (180 * 20), 0],\n\t\tself::SWIFTNESS_T => [Effect::SPEED, (480 * 20), 0],\n\t\tself::SWIFTNESS_TWO => [Effect::SPEED, (90 * 20), 1],\n\t\t\n\t\tself::SLOWNESS => [Effect::SLOWNESS, (90 * 20), 0],\n\t\tself::SLOWNESS_T => [Effect::SLOWNESS, (240 * 20), 0],\n\t\t\n\t\tself::WATER_BREATHING => [Effect::WATER_BREATHING, (180 * 20), 0],\n\t\tself::WATER_BREATHING_T => [Effect::WATER_BREATHING, (480 * 20), 0],\n\t\t\n\t\tself::HEALING => [Effect::HEALING, (1), 0],\n\t\tself::HEALING_TWO => [Effect::HEALING, (1), 1],\n\t\t\n\t\tself::HARMING => [Effect::HARMING, (1), 0],\n\t\tself::HARMING_TWO => [Effect::HARMING, (1), 1],\n\t\t\n\t\tself::POISON => [Effect::POISON, (45 * 20), 0],\n\t\tself::POISON_T => [Effect::POISON, (120 * 20), 0],\n\t\tself::POISON_TWO => [Effect::POISON, (22 * 20), 1],\n\t\t\n\t\tself::REGENERATION => [Effect::REGENERATION, (45 * 20), 0],\n\t\tself::REGENERATION_T => [Effect::REGENERATION, (120 * 20), 0],\n\t\tself::REGENERATION_TWO => [Effect::REGENERATION, (22 * 20), 1],\n\t\t\n\t\tself::STRENGTH => [Effect::STRENGTH, (180 * 20), 0],\n\t\tself::STRENGTH_T => [Effect::STRENGTH, (480 * 20), 0],\n\t\tself::STRENGTH_TWO => [Effect::STRENGTH, (90 * 20), 1],\n\t\t\n\t\tself::WEAKNESS => [Effect::WEAKNESS, (90 * 20), 0],\n\t\tself::WEAKNESS_T => [Effect::WEAKNESS, (240 * 20), 0]\n\t];\n\t\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::POTION, $meta, $count, self::getNameByMeta($meta));\n\t}\n\n\tpublic static function getColor(int $meta){\n\t\t$effect = Effect::getEffect(self::getEffectId($meta));\n\t\tif($effect !== null){\n\t\t\treturn $effect->getColor();\n\t\t}\n\t\treturn [0, 0, 0];\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 1;\n\t}\n\t\n\tpublic function canBeConsumed() : bool{\n\t\treturn $this->meta > 0;\n\t}\n\t\n\tpublic function canBeConsumedBy(Entity $entity) : bool{\n\t\treturn $entity instanceof Human;\n\t}\n\t\n\tpublic function getEffects(): array{\n\t\treturn self::getEffectsById($this->meta);\n\t}\n\n\t/**\n\t * @param int $id\n\t * @return Effect[]\n\t */\n\tpublic static function getEffectsById(int $id) : array{\n\t\tif(count(self::POTIONS[$id] ?? []) === 3){\n\t\t\treturn [Effect::getEffect(self::POTIONS[$id][0])->setDuration(self::POTIONS[$id][1])->setAmplifier(self::POTIONS[$id][2])];\n\t\t}\n\t\treturn [];\n\t}\n\t\n\t\n\tpublic function onConsume(Entity $human){\n\t\t$pk = new EntityEventPacket();\n\t\t$pk->eid = $human->getId();\n\t\t$pk->event = EntityEventPacket::USE_ITEM;\n\t\tif($human instanceof Player){\n\t\t\t$human->dataPacket($pk);\n\t\t}\n        Server::getInstance()->broadcastPacket($human->getViewers(), $pk);\n\t\t\n\t\tServer::getInstance()->getPluginManager()->callEvent($ev = new EntityDrinkPotionEvent($human, $this));\n\t\t\n\t\tif(!$ev->isCancelled()){\n\t\t\tforeach($ev->getEffects() as $effect){\n\t\t\t\t$human->addEffect($effect);\n\t\t\t}\n\t\t\t//Don't set the held item to glass bottle if we're in creative\n\t\t\tif($human instanceof Player){\n\t\t\t\tif($human->getGamemode() === 1){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$human->getInventory()->setItemInHand(Item::get(self::GLASS_BOTTLE));\n\t\t}\n\n\t\t\n\t}\n\t\n\tpublic static function getEffectId(int $meta) : int{\n\t\tswitch($meta){\n\t\t\tcase self::INVISIBILITY:\n\t\t\tcase self::INVISIBILITY_T:\n\t\t\t\treturn Effect::INVISIBILITY;\n\t\t\tcase self::LEAPING:\n\t\t\tcase self::LEAPING_T:\n\t\t\tcase self::LEAPING_TWO:\n\t\t\t\treturn Effect::JUMP;\n\t\t\tcase self::FIRE_RESISTANCE:\n\t\t\tcase self::FIRE_RESISTANCE_T:\n\t\t\t\treturn Effect::FIRE_RESISTANCE;\n\t\t\tcase self::SWIFTNESS:\n\t\t\tcase self::SWIFTNESS_T:\n\t\t\tcase self::SWIFTNESS_TWO:\n\t\t\t\treturn Effect::SPEED;\n\t\t\tcase self::SLOWNESS:\n\t\t\tcase self::SLOWNESS_T:\n\t\t\t\treturn Effect::SLOWNESS;\n\t\t\tcase self::WATER_BREATHING:\n\t\t\tcase self::WATER_BREATHING_T:\n\t\t\t\treturn Effect::WATER_BREATHING;\n\t\t\tcase self::HARMING:\n\t\t\tcase self::HARMING_TWO:\n\t\t\t\treturn Effect::HARMING;\n\t\t\tcase self::POISON:\n\t\t\tcase self::POISON_T:\n\t\t\tcase self::POISON_TWO:\n\t\t\t\treturn Effect::POISON;\n\t\t\tcase self::HEALING:\n\t\t\tcase self::HEALING_TWO:\n\t\t\t\treturn Effect::HEALING;\n\t\t\tcase self::NIGHT_VISION:\n\t\t\tcase self::NIGHT_VISION_T:\n\t\t\t\treturn Effect::NIGHT_VISION;\n\t\t\tcase self::REGENERATION:\n\t\t\tcase self::REGENERATION_T:\n\t\t\tcase self::REGENERATION_TWO:\n\t\t\t\treturn Effect::REGENERATION;\n\t\t\tdefault:\n\t\t\t\treturn 0;\n\t\t}\n\t}\n\t\n\tpublic static function getNameByMeta(int $meta) : string{\n\t\tswitch($meta){\n\t\t\tcase self::WATER_BOTTLE:\n\t\t\t\treturn \"Water Bottle\"; \n\t\t\tcase self::MUNDANE:\n\t\t\tcase self::MUNDANE_EXTENDED:\n\t\t\t\treturn \"Mundane Potion\";\n\t\t\tcase self::THICK:\n\t\t\t\treturn \"Thick Potion\";\n\t\t\tcase self::AWKWARD:\n\t\t\t\treturn \"Awkward Potion\";\n\t\t\tcase self::INVISIBILITY:\n\t\t\tcase self::INVISIBILITY_T:\n\t\t\t\treturn \"Potion of Invisibility\";\n\t\t\tcase self::LEAPING:\n\t\t\tcase self::LEAPING_T:\n\t\t\t\treturn \"Potion of Leaping\";\n\t\t\tcase self::LEAPING_TWO:\n\t\t\t\treturn \"Potion of Leaping II\";\n\t\t\tcase self::FIRE_RESISTANCE:\n\t\t\tcase self::FIRE_RESISTANCE_T:\n\t\t\t\treturn \"Potion of Fire Resistance\";\n\t\t\tcase self::SWIFTNESS:\n\t\t\tcase self::SWIFTNESS_T:\n\t\t\t\treturn \"Potion of Swiftness\";\n\t\t\tcase self::SWIFTNESS_TWO:\n\t\t\t\treturn \"Potion of Swiftness II\";\n\t\t\tcase self::SLOWNESS:\n\t\t\tcase self::SLOWNESS_T:\n\t\t\t\treturn \"Potion of Slowness\";\n\t\t\tcase self::WATER_BREATHING:\n\t\t\tcase self::WATER_BREATHING_T:\n\t\t\t\treturn \"Potion of Water Breathing\";\n\t\t\tcase self::HARMING:\n\t\t\t\treturn \"Potion of Harming\";\n\t\t\tcase self::HARMING_TWO:\n\t\t\t\treturn \"Potion of Harming II\";\n\t\t\tcase self::POISON:\n\t\t\tcase self::POISON_T:\n\t\t\t\treturn \"Potion of Poison\";\n\t\t\tcase self::POISON_TWO:\n\t\t\t\treturn \"Potion of Poison II\";\n\t\t\tcase self::HEALING:\n\t\t\t\treturn \"Potion of Healing\";\n\t\t\tcase self::HEALING_TWO:\n\t\t\t\treturn \"Potion of Healing II\";\n\t\t\tcase self::NIGHT_VISION:\n\t\t\tcase self::NIGHT_VISION_T:\n\t\t\t\treturn \"Potion of Night Vision\";\n\t\t\tcase self::STRENGTH:\n\t\t\tcase self::STRENGTH_T:\n\t\t\t\treturn \"Potion of Strength\";\n\t\t\tcase self::STRENGTH_TWO:\n\t\t\t\treturn \"Potion of Strength II\";\n\t\t\tcase self::REGENERATION:\n\t\t\tcase self::REGENERATION_T:\n\t\t\t\treturn \"Potion of Regeneration\";\n\t\t\tcase self::REGENERATION_TWO:\n\t\t\t\treturn \"Potion of Regeneration II\";\n\t\t\tcase self::WEAKNESS:\n\t\t\tcase self::WEAKNESS_T:\n\t\t\t\treturn \"Potion of Weakness\";\n\t\t\tdefault:\n\t\t\t\treturn \"Potion\";\n\t\t}\n\t}\n\t\n}\n"
  },
  {
    "path": "src/pocketmine/item/PrismarineCrystals.php",
    "content": "<?php\n\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author H4PM Team\n * @link http://www.github.net/H4PM\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass PrismarineCrystals extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::PRISMARINE_CRYSTALS, $meta, $count, \"Prismarine Crystals\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/PrismarineShard.php",
    "content": "<?php\n\n/*\n *\n *  ____          \n * |  __|_              _\n * | |__| |      _    _(_)_ __   ___\n * |  __| |_   _| |  | | | '_ \\ / _ \\\n * | |__| | | | | |/\\| | | | | | (_) |\n * |____|_|\\ \\/ \\__/\\__/_|_| |_|\\___ |\n *         _|  /                 __| |\n *        |___/                 |____/\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author H4PM Team\n * @link http://www.github.net/H4PM\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass PrismarineShard extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::PRISMARINE_SHARD, $meta, $count, \"Prismarine Shard\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/PumpkinPie.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass PumpkinPie extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::PUMPKIN_PIE, $meta, $count, \"Pumpkin Pie\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 8;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 4.8;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/PumpkinSeeds.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass PumpkinSeeds extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::PUMPKIN_STEM);\n\t\tparent::__construct(self::PUMPKIN_SEEDS, 0, $count, \"Pumpkin Seeds\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Quartz.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Quartz extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::QUARTZ, $meta, $count, \"Quartz\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/RabbitStew.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass RabbitStew extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::RABBIT_STEW, 0, $count, \"Rabbit Stew\");\n\t}\n\n\tpublic function getMaxStackSize() :int{\n\t\treturn 1;\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 10;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 12;\n\t}\n\n\tpublic function getResidue(){\n\t\treturn Item::get(Item::BOWL);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/RawBeef.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass RawBeef extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::RAW_BEEF, $meta, $count, \"Raw Beef\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 3;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 1.8;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/RawChicken.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Effect;\n\nclass RawChicken extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::RAW_CHICKEN, $meta, $count, \"Raw Chicken\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 2;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 1.2;\n\t}\n\t\n\tpublic function getAdditionalEffects() : array{\n\t\t$chance = mt_rand(0, 100);\n\t\tif($chance >= 70){\n\t\t\treturn [Effect::getEffect(Effect::HUNGER)->setDuration(30 * 20)];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/RawMutton.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\item;\n\nclass RawMutton extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::RAW_MUTTON, $meta, $count, \"Raw Mutton\");\n\t}\n\t\n\tpublic function getFoodRestore() : int{\n\t\treturn 2;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 1.2;\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/RawPorkchop.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass RawPorkchop extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::RAW_PORKCHOP, $meta, $count, \"Raw Porkchop\");\n\t}\n\t\n\tpublic function getFoodRestore() : int{\n\t\treturn 3;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 0.6;\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/RawRabbit.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\item;\n\nclass RawRabbit extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::RAW_RABBIT, $meta, $count, \"Raw Rabbit\");\n\t}\n\t\n\tpublic function getFoodRestore() : int{\n\t\treturn 3;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 1.8;\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Redstone.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\block;\n\nclass Redstone extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::REDSTONE_WIRE);\n\t\tparent::__construct(self::REDSTONE, 0, $count, \"Redstone\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Repeater.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Repeater extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Block::UNPOWERED_REPEATER_BLOCK);\n\t\tparent::__construct(self::REPEATER, $meta, $count, \"Repeater\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/RottenFlesh.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Effect;\n\nclass RottenFlesh extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::ROTTEN_FLESH, 0, $count, \"Rotten Flesh\");\n\t}\n\t\n\tpublic function getFoodRestore() : int{\n\t\treturn 4;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 0.8;\n\t}\n\n\tpublic function getAdditionalEffects() : array{\n\t\t$chance = mt_rand(0, 100);\n\t\tif($chance >= 20){\n\t\t\treturn [Effect::getEffect(Effect::HUNGER)->setDuration(30 * 20)];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Shears.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Shears extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::SHEARS, $meta, $count, \"Shears\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Sign.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Sign extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::SIGN_POST);\n\t\tparent::__construct(self::SIGN, 0, $count, \"Sign\");\n\t}\n\n\tpublic function getMaxStackSize() : int {\n\t\treturn 16;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Skull.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Skull extends Item{\n\tconst SKELETON = 0;\n\tconst WITHER_SKELETON = 1;\n\tconst ZOMBIE = 2;\n\tconst STEVE = 3;\n\tconst CREEPER = 4;\n\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Block::SKULL_BLOCK);\n\t\tparent::__construct(self::SKULL, $meta, $count, \"Skull\");\n\t}\n\n\tpublic function getMaxStackSize() : int {\n\t\treturn 64;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/Slimeball.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Slimeball extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::SLIMEBALL, $meta, $count, \"Slimeball\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Snowball.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Snowball extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::SNOWBALL, 0, $count, \"Snowball\");\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/item/SpawnEgg.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\MobSpawner;\n\nclass SpawnEgg extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::SPAWN_EGG, $meta, $count, \"Spawn Egg\");\n\t}\n\n\tpublic function canBeActivated() : bool {\n\t\treturn true;\n\t}\n\n\tpublic function onActivate(Level $level, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){\n\t\tif($target->getId() == Block::MONSTER_SPAWNER){\n\t\t\treturn true;\n\t\t}else{\n\t\t\t$entity = null;\n\t\t\t$chunk = $level->getChunk($block->getX() >> 4, $block->getZ() >> 4);\n\n\t\t\tif(!($chunk instanceof Chunk)){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\tnew DoubleTag(\"\", $block->getX() + 0.5),\n\t\t\t\t\tnew DoubleTag(\"\", $block->getY()),\n\t\t\t\t\tnew DoubleTag(\"\", $block->getZ() + 0.5)\n\t\t\t\t]),\n\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\tnew FloatTag(\"\", lcg_value() * 360),\n\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t]);\n\n\t\t\tif($this->hasCustomName()){\n\t\t\t\t$nbt->CustomName = new StringTag(\"CustomName\", $this->getCustomName());\n\t\t\t}\n\n\t\t\t$entity = Entity::createEntity($this->meta, $chunk, $nbt);\n\n\t\t\tif($entity instanceof Entity){\n\t\t\t\tif($player->isSurvival()){\n\t\t\t\t\t--$this->count;\n\t\t\t\t}\n\t\t\t\t$entity->spawnToAll();\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/SpiderEye.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\entity\\Effect;\n\nclass SpiderEye extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::SPIDER_EYE, $meta, $count, \"Spider Eye\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 2;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 3.2;\n\t}\n\n\tpublic function getAdditionalEffects() : array{\n\t\treturn [Effect::getEffect(Effect::POISON)->setDuration(80)];\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/SplashPotion.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item;\n\nclass SplashPotion extends Item{\n\t\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::SPLASH_POTION, $meta, $count, $this->getNameByMeta($meta));\n\t}\n\n\tpublic function getMaxStackSize() : int{\n\t\treturn 1;\n\t}\n\t\n\tpublic function getNameByMeta(int $meta){\n\t\treturn \"Splash \".Potion::getNameByMeta($meta);\n\t}\n\n\t\n}\n"
  },
  {
    "path": "src/pocketmine/item/SpruceDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass SpruceDoor extends Door{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::SPRUCE_DOOR_BLOCK);\n\t\tparent::__construct(self::SPRUCE_DOOR, 0, $count, \"Spruce Door\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Steak.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Steak extends Food{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STEAK, $meta, $count, \"Steak\");\n\t}\n\n\tpublic function getFoodRestore() : int{\n\t\treturn 8;\n\t}\n\n\tpublic function getSaturationRestore() : float{\n\t\treturn 12.8;\n\t}\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Stick.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass Stick extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STICK, 0, $count, \"Stick\");\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/StoneAxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass StoneAxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STONE_AXE, $meta, $count, \"Stone Axe\");\n\t}\n\n\tpublic function isAxe(){\n\t\treturn Tool::TIER_STONE;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 5;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/StoneHoe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass StoneHoe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STONE_HOE, $meta, $count, \"Stone Hoe\");\n\t}\n\n\tpublic function isHoe(){\n\t\treturn Tool::TIER_STONE;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/StonePickaxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass StonePickaxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STONE_PICKAXE, $meta, $count, \"Stone Pickaxe\");\n\t}\n\n\tpublic function isPickaxe(){\n\t\treturn Tool::TIER_STONE;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 4;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/StoneShovel.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass StoneShovel extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STONE_SHOVEL, $meta, $count, \"Stone Shovel\");\n\t}\n\n\tpublic function isShovel(){\n\t\treturn Tool::TIER_STONE;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 3;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/StoneSword.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass StoneSword extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STONE_SWORD, $meta, $count, \"Stone Sword\");\n\t}\n\n\tpublic function isSword(){\n\t\treturn Tool::TIER_STONE;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 6;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/StringItem.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\item;\n\nclass StringItem extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::STRING, $meta, $count, \"String\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Sugar.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Sugar extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::SUGAR, $meta, $count, \"Sugar\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/Sugarcane.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass Sugarcane extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::SUGARCANE_BLOCK);\n\t\tparent::__construct(self::SUGARCANE, 0, $count, \"Sugar Cane\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/Tool.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\item\\enchantment\\enchantment;\n\nabstract class Tool extends Item{\n\tconst TIER_WOODEN = 1;\n\tconst TIER_GOLD = 2;\n\tconst TIER_STONE = 3;\n\tconst TIER_IRON = 4;\n\tconst TIER_DIAMOND = 5;\n\n\tconst TYPE_NONE = 0;\n\tconst TYPE_SWORD = 1;\n\tconst TYPE_SHOVEL = 2;\n\tconst TYPE_PICKAXE = 3;\n\tconst TYPE_AXE = 4;\n\tconst TYPE_SHEARS = 5;\n\n\tpublic function __construct($id, $meta = 0, $count = 1, $name = \"Unknown\"){\n\t\tparent::__construct($id, $meta, $count, $name);\n\t}\n\n\tpublic function getMaxStackSize() : int {\n\t\treturn 1;\n\t}\n\n\t/**\n\t * TODO: Move this to each item\n\t *\n\t * @param Entity|Block $object\n\t * @param 1 for break|2 for Touch $type\n\t *\n\t * @return bool\n\t */\n\tpublic function useOn($object, $type = 1){\n\t\tif($this->isUnbreakable()){\n\t\t\treturn true;\n\t\t}\n\n\t\t$unbreakingl = $this->getEnchantmentLevel(Enchantment::TYPE_MINING_DURABILITY);\n\t\t$unbreakingl = $unbreakingl > 3 ? 3 : $unbreakingl;\n\t\tif (mt_rand(1, $unbreakingl + 1) !== 1) {\n\t\t\treturn true;\n\t\t}\n\n\t\tif ($type === 1) {\n\t\t\tif ($object instanceof Entity) {\n\t\t\t\tif ($this->isHoe() !== false or $this->isSword() !== false) {\n\t\t\t\t\t//Hoe and Sword\n\t\t\t\t\t$this->meta++;\n\t\t\t\t\treturn true;\n\t\t\t\t} elseif ($this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false) {\n\t\t\t\t\t//Pickaxe Axe and Shovel\n\t\t\t\t\t$this->meta += 2;\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t\treturn true;//Other tool do not lost durability white hitting\n\t\t\t} elseif ($object instanceof Block) {\n\t\t\t\tif ($this->isShears() !== false) {\n\t\t\t\t\tif ($object->getToolType() === Tool::TYPE_SHEARS) {//This should be checked in each block\n\t\t\t\t\t\t$this->meta++;\n\t\t\t\t\t}\n\t\t\t\t\treturn true;\n\t\t\t\t} elseif ($object->getHardness() > 0) {//Sword Pickaxe Axe and Shovel\n\t\t\t\t\tif ($this->isSword() !== false) {\n\t\t\t\t\t\t$this->meta += 2;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t} elseif ($this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false) {\n\t\t\t\t\t\t$this->meta += 1;\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t} elseif ($type === 2) {//For Touch. only trigger when OnActivate return true\n\t\t\tif ($this->isHoe() !== false or $this->id === self::FLINT_STEEL or $this->isShovel() !== false) {\n\t\t\t\t$this->meta++;\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * TODO: Move this to each item\n\t *\n\t * @return int|bool\n\t */\n\tpublic function getMaxDurability(){\n\n\t\t$levels = [\n\t\t\tTool::TIER_GOLD => 33,\n\t\t\tTool::TIER_WOODEN => 60,\n\t\t\tTool::TIER_STONE => 132,\n\t\t\tTool::TIER_IRON => 251,\n\t\t\tTool::TIER_DIAMOND => 1562,\n\t\t\tself::FLINT_STEEL => 65,\n\t\t\tself::SHEARS => 239,\n\t\t\tself::BOW => 385,\n\t\t];\n\n\t\tif(($type = $this->isPickaxe()) === false){\n\t\t\tif(($type = $this->isAxe()) === false){\n\t\t\t\tif(($type = $this->isSword()) === false){\n\t\t\t\t\tif(($type = $this->isShovel()) === false){\n\t\t\t\t\t\tif(($type = $this->isHoe()) === false){\n\t\t\t\t\t\t\t$type = $this->id;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $levels[$type];\n\t}\n\n\tpublic function isUnbreakable(){\n\t\t$tag = $this->getNamedTagEntry(\"Unbreakable\");\n\t\treturn $tag !== null and $tag->getValue() > 0;\n\t}\n\n\tpublic function isPickaxe(){\n\t\treturn false;\n\t}\n\n\tpublic function isAxe(){\n\t\treturn false;\n\t}\n\n\tpublic function isSword(){\n\t\treturn false;\n\t}\n\n\tpublic function isShovel(){\n\t\treturn false;\n\t}\n\n\tpublic function isHoe(){\n\t\treturn false;\n\t}\n\n\tpublic function isShears(){\n\t\treturn ($this->id === self::SHEARS);\n\t}\n\n\tpublic function isTool(){\n\t\treturn ($this->id === self::FLINT_STEEL or $this->id === self::SHEARS or $this->id === self::BOW or $this->isPickaxe() !== false or $this->isAxe() !== false or $this->isShovel() !== false or $this->isSword() !== false or $this->isHoe() !== false);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/Wheat.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nclass Wheat extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::WHEAT, $meta, $count, \"Wheat\");\n\t}\n\n}\n\n"
  },
  {
    "path": "src/pocketmine/item/WheatSeeds.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass WheatSeeds extends Item{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::WHEAT_BLOCK);\n\t\tparent::__construct(self::WHEAT_SEEDS, 0, $count, \"Wheat Seeds\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/WoodenAxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass WoodenAxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::WOODEN_AXE, $meta, $count, \"Wooden Axe\");\n\t}\n\n\tpublic function isAxe(){\n\t\treturn Tool::TIER_WOODEN;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 4;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/WoodenDoor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\nuse pocketmine\\block\\Block;\n\nclass WoodenDoor extends Door{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\t$this->block = Block::get(Item::WOODEN_DOOR_BLOCK);\n\t\tparent::__construct(self::WOODEN_DOOR, 0, $count, \"Wooden Door\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/WoodenHoe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass WoodenHoe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::WOODEN_HOE, $meta, $count, \"Wooden Hoe\");\n\t}\n\n\tpublic function isHoe(){\n\t\treturn Tool::TIER_WOODEN;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/item/WoodenPickaxe.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass WoodenPickaxe extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::WOODEN_PICKAXE, $meta, $count, \"Wooden Pickaxe\");\n\t}\n\n\tpublic function isPickaxe(){\n\t\treturn Tool::TIER_WOODEN;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 3;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/WoodenShovel.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass WoodenShovel extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::WOODEN_SHOVEL, $meta, $count, \"Wooden Shovel\");\n\t}\n\n\tpublic function isShovel(){\n\t\treturn Tool::TIER_WOODEN;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 2;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/WoodenSword.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item;\n\n\nclass WoodenSword extends Tool{\n\tpublic function __construct($meta = 0, $count = 1){\n\t\tparent::__construct(self::WOODEN_SWORD, $meta, $count, \"Wooden Sword\");\n\t}\n\n\tpublic function isSword(){\n\t\treturn Tool::TIER_WOODEN;\n\t}\n\n\tpublic function getAttackDamage(){\n\t\treturn 5;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/enchantment/Enchantment.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item\\enchantment;\n\nuse pocketmine\\item\\ChainBoots;\nuse pocketmine\\item\\ChainChestplate;\nuse pocketmine\\item\\ChainHelmet;\nuse pocketmine\\item\\ChainLeggings;\nuse pocketmine\\item\\DiamondAxe;\nuse pocketmine\\item\\DiamondBoots;\nuse pocketmine\\item\\DiamondChestplate;\nuse pocketmine\\item\\DiamondHelmet;\nuse pocketmine\\item\\DiamondHoe;\nuse pocketmine\\item\\DiamondLeggings;\nuse pocketmine\\item\\DiamondPickaxe;\nuse pocketmine\\item\\DiamondShovel;\nuse pocketmine\\item\\DiamondSword;\nuse pocketmine\\item\\GoldAxe;\nuse pocketmine\\item\\GoldBoots;\nuse pocketmine\\item\\GoldChestplate;\nuse pocketmine\\item\\GoldHelmet;\nuse pocketmine\\item\\GoldHoe;\nuse pocketmine\\item\\GoldLeggings;\nuse pocketmine\\item\\GoldPickaxe;\nuse pocketmine\\item\\GoldShovel;\nuse pocketmine\\item\\GoldSword;\nuse pocketmine\\item\\IronAxe;\nuse pocketmine\\item\\IronBoots;\nuse pocketmine\\item\\IronChestplate;\nuse pocketmine\\item\\IronHelmet;\nuse pocketmine\\item\\IronHoe;\nuse pocketmine\\item\\IronLeggings;\nuse pocketmine\\item\\IronPickaxe;\nuse pocketmine\\item\\IronShovel;\nuse pocketmine\\item\\IronSword;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\LeatherBoots;\nuse pocketmine\\item\\LeatherCap;\nuse pocketmine\\item\\LeatherPants;\nuse pocketmine\\item\\LeatherTunic;\nuse pocketmine\\item\\StoneAxe;\nuse pocketmine\\item\\StoneHoe;\nuse pocketmine\\item\\StonePickaxe;\nuse pocketmine\\item\\StoneShovel;\nuse pocketmine\\item\\StoneSword;\nuse pocketmine\\item\\WoodenAxe;\nuse pocketmine\\item\\WoodenHoe;\nuse pocketmine\\item\\WoodenPickaxe;\nuse pocketmine\\item\\WoodenShovel;\nuse pocketmine\\item\\WoodenSword;\n\nclass Enchantment{\n\n\tconst TYPE_INVALID = -1;\n\n\tconst TYPE_ARMOR_PROTECTION = 0;\n\tconst TYPE_ARMOR_FIRE_PROTECTION = 1;\n\tconst TYPE_ARMOR_FALL_PROTECTION = 2;\n\tconst TYPE_ARMOR_EXPLOSION_PROTECTION = 3;\n\tconst TYPE_ARMOR_PROJECTILE_PROTECTION = 4;\n\tconst TYPE_ARMOR_THORNS = 5;\n\tconst TYPE_WATER_BREATHING = 6;\n\tconst TYPE_WATER_SPEED = 7;\n\tconst TYPE_WATER_AFFINITY = 8;\n\tconst TYPE_WEAPON_SHARPNESS = 9;\n\tconst TYPE_WEAPON_SMITE = 10;\n\tconst TYPE_WEAPON_ARTHROPODS = 11;\n\tconst TYPE_WEAPON_KNOCKBACK = 12;\n\tconst TYPE_WEAPON_FIRE_ASPECT = 13;\n\tconst TYPE_WEAPON_LOOTING = 14;\n\tconst TYPE_MINING_EFFICIENCY = 15;\n\tconst TYPE_MINING_SILK_TOUCH = 16;\n\tconst TYPE_MINING_DURABILITY = 17;\n\tconst TYPE_MINING_FORTUNE = 18;\n\tconst TYPE_BOW_POWER = 19;\n\tconst TYPE_BOW_KNOCKBACK = 20;\n\tconst TYPE_BOW_FLAME = 21;\n\tconst TYPE_BOW_INFINITY = 22;\n\tconst TYPE_FISHING_FORTUNE = 23;\n\tconst TYPE_FISHING_LURE = 24;\n\n\tconst RARITY_COMMON = 0;\n\tconst RARITY_UNCOMMON = 1;\n\tconst RARITY_RARE = 2;\n\tconst RARITY_MYTHIC = 3;\n\n\tconst ACTIVATION_EQUIP = 0;\n\tconst ACTIVATION_HELD = 1;\n\tconst ACTIVATION_SELF = 2;\n\n\tconst SLOT_NONE = 0;\n\tconst SLOT_ALL = 0b11111111111111;\n\tconst SLOT_ARMOR = 0b1111;\n\tconst SLOT_HEAD = 0b1;\n\tconst SLOT_TORSO = 0b10;\n\tconst SLOT_LEGS = 0b100;\n\tconst SLOT_FEET = 0b1000;\n\tconst SLOT_SWORD = 0b10000;\n\tconst SLOT_BOW = 0b100000;\n\tconst SLOT_TOOL = 0b111000000;\n\tconst SLOT_HOE = 0b1000000;\n\tconst SLOT_SHEARS = 0b10000000;\n\tconst SLOT_FLINT_AND_STEEL = 0b10000000;\n\tconst SLOT_DIG = 0b111000000000;\n\tconst SLOT_AXE = 0b1000000000;\n\tconst SLOT_PICKAXE = 0b10000000000;\n\tconst SLOT_SHOVEL = 0b10000000000;\n\tconst SLOT_FISHING_ROD = 0b100000000000;\n\tconst SLOT_CARROT_STICK = 0b1000000000000;\n\n\tpublic static $words = [\"the\", \"elder\", \"scrolls\", \"klaatu\", \"berata\", \"niktu\", \"xyzzy\", \"bless\", \"curse\", \"light\", \"darkness\", \"fire\", \"air\",\n\t\t\"earth\", \"water\", \"hot\", \"dry\", \"cold\", \"wet\", \"ignite\", \"snuff\", \"embiggen\", \"twist\", \"shorten\", \"stretch\", \"fiddle\", \"destroy\", \"imbue\", \"galvanize\",\n\t\t\"enchant\", \"free\", \"limited\", \"range\", \"of\", \"towards\", \"inside\", \"sphere\", \"cube\", \"self\", \"other\", \"ball\", \"mental\", \"physical\", \"grow\", \"shrink\",\n\t\t\"demon\", \"elemental\", \"spirit\", \"animal\", \"creature\", \"beast\", \"humanoid\", \"undead\", \"fresh\", \"stale\"];\n\n\n\t/** @var Enchantment[] */\n\tprotected static $enchantments;\n\n\tpublic static function init(){\n\t\tself::$enchantments = new \\SplFixedArray(256);\n\n\t\tself::$enchantments[self::TYPE_ARMOR_PROTECTION] = new Enchantment(self::TYPE_ARMOR_PROTECTION, \"%enchantment.protect.all\", self::RARITY_COMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR);\n\t\tself::$enchantments[self::TYPE_ARMOR_FIRE_PROTECTION] = new Enchantment(self::TYPE_ARMOR_FIRE_PROTECTION, \"%enchantment.protect.fire\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR);\n\t\tself::$enchantments[self::TYPE_ARMOR_FALL_PROTECTION] = new Enchantment(self::TYPE_ARMOR_FALL_PROTECTION, \"%enchantment.protect.fall\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FEET);\n\n\t\tself::$enchantments[self::TYPE_ARMOR_EXPLOSION_PROTECTION] = new Enchantment(self::TYPE_ARMOR_EXPLOSION_PROTECTION, \"%enchantment.protect.explosion\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR);\n\t\tself::$enchantments[self::TYPE_ARMOR_PROJECTILE_PROTECTION] = new Enchantment(self::TYPE_ARMOR_PROJECTILE_PROTECTION, \"%enchantment.protect.projectile\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_ARMOR);\n\t\tself::$enchantments[self::TYPE_ARMOR_THORNS] = new Enchantment(self::TYPE_ARMOR_THORNS, \"%enchantment.protect.thorns\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_SWORD);\n\t\tself::$enchantments[self::TYPE_WATER_BREATHING] = new Enchantment(self::TYPE_WATER_BREATHING, \"%enchantment.protect.waterbrething\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FEET);\n\t\tself::$enchantments[self::TYPE_WATER_SPEED] = new Enchantment(self::TYPE_WATER_SPEED, \"%enchantment.waterspeed\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FEET);\n\t\tself::$enchantments[self::TYPE_WATER_AFFINITY] = new Enchantment(self::TYPE_WATER_AFFINITY, \"%enchantment.protect.wateraffinity\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FEET);\n\n\t\tself::$enchantments[self::TYPE_WEAPON_SHARPNESS] = new Enchantment(self::TYPE_WEAPON_SHARPNESS, \"%enchantment.weapon.sharpness\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_SWORD);\n\t\tself::$enchantments[self::TYPE_WEAPON_SMITE] = new Enchantment(self::TYPE_WEAPON_SMITE, \"%enchantment.weapon.smite\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_SWORD);\n\t\tself::$enchantments[self::TYPE_WEAPON_ARTHROPODS] = new Enchantment(self::TYPE_WEAPON_ARTHROPODS, \"%enchantment.weapon.arthropods\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_SWORD);\n\t\tself::$enchantments[self::TYPE_WEAPON_KNOCKBACK] = new Enchantment(self::TYPE_WEAPON_KNOCKBACK, \"%enchantment.weapon.knockback\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_SWORD);\n\t\tself::$enchantments[self::TYPE_WEAPON_FIRE_ASPECT] = new Enchantment(self::TYPE_WEAPON_FIRE_ASPECT, \"%enchantment.weapon.fireaspect\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_SWORD);\n\t\tself::$enchantments[self::TYPE_WEAPON_LOOTING] = new Enchantment(self::TYPE_WEAPON_LOOTING, \"%enchantment.weapon.looting\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_SWORD);\n\t\tself::$enchantments[self::TYPE_MINING_EFFICIENCY] = new Enchantment(self::TYPE_MINING_EFFICIENCY, \"%enchantment.mining.efficiency\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_TOOL);\n\t\tself::$enchantments[self::TYPE_MINING_SILK_TOUCH] = new Enchantment(self::TYPE_MINING_SILK_TOUCH, \"%enchantment.mining.silktouch\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_TOOL);\n\t\tself::$enchantments[self::TYPE_MINING_DURABILITY] = new Enchantment(self::TYPE_MINING_DURABILITY, \"%enchantment.mining.durability\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_TOOL);\n\t\tself::$enchantments[self::TYPE_MINING_FORTUNE] = new Enchantment(self::TYPE_MINING_FORTUNE, \"%enchantment.mining.fortune\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_TOOL);\n\t\tself::$enchantments[self::TYPE_BOW_POWER] = new Enchantment(self::TYPE_BOW_POWER, \"%enchantment.bow.power\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_BOW);\n\t\tself::$enchantments[self::TYPE_BOW_KNOCKBACK] = new Enchantment(self::TYPE_BOW_KNOCKBACK, \"%enchantment.bow.knockback\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_BOW);\n\t\tself::$enchantments[self::TYPE_BOW_FLAME] = new Enchantment(self::TYPE_BOW_FLAME, \"%enchantment.bow.flame\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_BOW);\n\t\tself::$enchantments[self::TYPE_BOW_INFINITY] = new Enchantment(self::TYPE_BOW_INFINITY, \"%enchantment.bow.infinity\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_BOW);\n\t\tself::$enchantments[self::TYPE_FISHING_FORTUNE] = new Enchantment(self::TYPE_FISHING_FORTUNE, \"%enchantment.fishing.fortune\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FISHING_ROD);\n\t\tself::$enchantments[self::TYPE_FISHING_LURE] = new Enchantment(self::TYPE_FISHING_LURE, \"%enchantment.fishing.lure\", self::RARITY_UNCOMMON, self::ACTIVATION_EQUIP, self::SLOT_FISHING_ROD);\n\n\t}\n\n\t/**\n\t * @param int $id\n\t * @return $this\n\t */\n\tpublic static function getEnchantment($id){\n\t\tif(isset(self::$enchantments[$id])){\n\t\t\treturn clone self::$enchantments[(int) $id];\n\t\t}\n\t\treturn new Enchantment(self::TYPE_INVALID, \"unknown\", 0, 0, 0);\n\t}\n\n\tpublic static function getEnchantmentByName($name){\n\t\tif(defined(Enchantment::class . \"::TYPE_\" . strtoupper($name))){\n\t\t\treturn self::getEnchantment(constant(Enchantment::class . \"::TYPE_\" . strtoupper($name)));\n\t\t}elseif(defined(Enchantment::class . \"::TYPE_WEAPON_\" . strtoupper($name))){\n\t\t\treturn self::getEnchantment(constant(Enchantment::class . \"::TYPE_WEAPON_\" . strtoupper($name))); \n\t\t}elseif(defined(Enchantment::class . \"::TYPE_ARMOR_\" . strtoupper($name))){\n\t\t\treturn self::getEnchantment(constant(Enchantment::class . \"::TYPE_ARMOR_\" . strtoupper($name))); \n\t\t}elseif(defined(Enchantment::class . \"::TYPE_MINING_\" . strtoupper($name))){\n\t\t\treturn self::getEnchantment(constant(Enchantment::class . \"::TYPE_MINING_\" . strtoupper($name))); \n\t\t}elseif(defined(Enchantment::class . \"::TYPE_BOW_\" . strtoupper($name))){\n\t\t\treturn self::getEnchantment(constant(Enchantment::class . \"::TYPE_BOW_\" . strtoupper($name))); \n\t\t}elseif(defined(Enchantment::class . \"::TYPE_FISHING_\" . strtoupper($name))){\n\t\t\treturn self::getEnchantment(constant(Enchantment::class . \"::TYPE_FISHING_\" . strtoupper($name))); \n\t\t}else{\n\t\t\treturn new Enchantment(self::TYPE_INVALID, \"unknown\", 0, 0, 0);\n\t    }\n\t}\n\n\tpublic static function getEnchantAbility(Item $item){\n\t\tswitch($item->getId()){\n\t\t\tcase Item::BOOK:\n\t\t\tcase Item::BOW:\n\t\t\tcase Item::FISHING_ROD:\n\t\t\t\treturn 4;\n\t\t}\n\n\t\tif($item->isArmor()){\n\t\t\tif($item instanceof ChainBoots or $item instanceof ChainChestplate or $item instanceof ChainHelmet or $item instanceof ChainLeggings) return 12;\n\t\t\tif($item instanceof IronBoots or $item instanceof IronChestplate or $item instanceof IronHelmet or $item instanceof IronLeggings) return 9;\n\t\t\tif($item instanceof DiamondBoots or $item instanceof DiamondChestplate or $item instanceof DiamondHelmet or $item instanceof DiamondLeggings) return 10;\n\t\t\tif($item instanceof LeatherBoots or $item instanceof LeatherTunic or $item instanceof LeatherCap or $item instanceof LeatherPants) return 15;\n\t\t\tif($item instanceof GoldBoots or $item instanceof GoldChestplate or $item instanceof GoldHelmet or $item instanceof GoldLeggings) return 25;\n\t\t}\n\n\t\tif($item->isTool()){\n\t\t\tif($item instanceof WoodenAxe or $item instanceof WoodenHoe or $item instanceof WoodenPickaxe or $item instanceof WoodenShovel or $item instanceof WoodenSword) return 15;\n\t\t\tif($item instanceof StoneAxe or $item instanceof StoneHoe or $item instanceof StonePickaxe or $item instanceof StoneShovel or $item instanceof StoneSword) return 5;\n\t\t\tif($item instanceof DiamondAxe or $item instanceof DiamondHoe or $item instanceof DiamondPickaxe or $item instanceof DiamondShovel or $item instanceof DiamondSword) return 10;\n\t\t\tif($item instanceof IronAxe or $item instanceof IronHoe or $item instanceof IronPickaxe or $item instanceof IronShovel or $item instanceof IronSword) return 14;\n\t\t\tif($item instanceof GoldAxe or $item instanceof GoldHoe or $item instanceof GoldPickaxe or $item instanceof GoldShovel or $item instanceof GoldSword) return 22;\n\t\t}\n\n\t\treturn 0;\n\t}\n\n\tpublic static function getEnchantWeight(int $enchantmentId){\n\t\tswitch($enchantmentId){\n\t\t\tcase self::TYPE_ARMOR_PROTECTION:\n\t\t\t\treturn 10;\n\t\t\tcase self::TYPE_ARMOR_FIRE_PROTECTION:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_ARMOR_FALL_PROTECTION:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_ARMOR_EXPLOSION_PROTECTION:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_WATER_BREATHING:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_WATER_AFFINITY:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_WEAPON_SHARPNESS:\n\t\t\t\treturn 10;\n\t\t\tcase self::TYPE_WEAPON_SMITE:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_WEAPON_ARTHROPODS:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_WEAPON_KNOCKBACK:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_WEAPON_FIRE_ASPECT:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_WEAPON_LOOTING:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_MINING_EFFICIENCY:\n\t\t\t\treturn 10;\n\t\t\tcase self::TYPE_MINING_SILK_TOUCH:\n\t\t\t\treturn 1;\n\t\t\tcase self::TYPE_MINING_DURABILITY:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_MINING_FORTUNE:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_BOW_POWER:\n\t\t\t\treturn 10;\n\t\t\tcase self::TYPE_BOW_KNOCKBACK:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_BOW_FLAME:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_BOW_INFINITY:\n\t\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic static function getEnchantMaxLevel(int $enchantmentId){\n\t\tswitch($enchantmentId){\n\t\t\tcase self::TYPE_ARMOR_PROTECTION:\n\t\t\tcase self::TYPE_ARMOR_FIRE_PROTECTION:\n\t\t\tcase self::TYPE_ARMOR_FALL_PROTECTION:\n\t\t\tcase self::TYPE_ARMOR_EXPLOSION_PROTECTION:\n\t\t\tcase self::TYPE_ARMOR_PROJECTILE_PROTECTION:\n\t\t\t\treturn 4;\n\t\t\tcase self::TYPE_ARMOR_THORNS:\n\t\t\t\treturn 3;\n\t\t\tcase self::TYPE_WATER_BREATHING:\n\t\t\tcase self::TYPE_WATER_SPEED:\n\t\t\t\treturn 3;\n\t\t\tcase self::TYPE_WATER_AFFINITY:\n\t\t\t\treturn 1;\n\t\t\tcase self::TYPE_WEAPON_SHARPNESS:\n\t\t\tcase self::TYPE_WEAPON_SMITE:\n\t\t\tcase self::TYPE_WEAPON_ARTHROPODS:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_WEAPON_KNOCKBACK:\n\t\t\tcase self::TYPE_WEAPON_FIRE_ASPECT:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_WEAPON_LOOTING:\n\t\t\t\treturn 3;\n\t\t\tcase self::TYPE_MINING_EFFICIENCY:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_MINING_SILK_TOUCH:\n\t\t\t\treturn 1;\n\t\t\tcase self::TYPE_MINING_DURABILITY:\n\t\t\tcase self::TYPE_MINING_FORTUNE:\n\t\t\t\treturn 3;\n\t\t\tcase self::TYPE_BOW_POWER:\n\t\t\t\treturn 5;\n\t\t\tcase self::TYPE_BOW_KNOCKBACK:\n\t\t\t\treturn 2;\n\t\t\tcase self::TYPE_BOW_FLAME:\n\t\t\tcase self::TYPE_BOW_INFINITY:\n\t\t\t\treturn 1;\n\t\t\tcase self::TYPE_FISHING_FORTUNE:\n\t\t\tcase self::TYPE_FISHING_LURE:\n\t\t\t\treturn 3;\n\t\t}\n\t\treturn 999;\n\t}\n\n\tprivate $id;\n\tprivate $level = 1;\n\tprivate $name;\n\tprivate $rarity;\n\tprivate $activationType;\n\tprivate $slot;\n\n\tprivate function __construct($id, $name, $rarity, $activationType, $slot){\n\t\t$this->id = (int) $id;\n\t\t$this->name = (string) $name;\n\t\t$this->rarity = (int) $rarity;\n\t\t$this->activationType = (int) $activationType;\n\t\t$this->slot = (int) $slot;\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->name;\n\t}\n\n\tpublic function getRarity(){\n\t\treturn $this->rarity;\n\t}\n\n\tpublic function getActivationType(){\n\t\treturn $this->activationType;\n\t}\n\n\tpublic function getSlot(){\n\t\treturn $this->slot;\n\t}\n\n\tpublic function hasSlot($slot){\n\t\treturn ($this->slot & $slot) > 0;\n\t}\n\n\tpublic function getLevel(){\n\t\treturn $this->level;\n\t}\n\n\tpublic function setLevel(int $level){\n\t\t$this->level = $level;\n\n\t\treturn $this;\n\t}\n\n\tpublic function equals(Enchantment $ent){\n\t\tif($ent->getId() == $this->getId() and $ent->getLevel() == $this->getLevel() and $ent->getActivationType() == $this->getActivationType() and $ent->getRarity() == $this->getRarity()){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic static function getRandomName(){\n\t\t$count = mt_rand(3, 6);\n\t\t$set = [];\n\t\twhile(count($set) < $count){\n\t\t\t$set[] = self::$words[mt_rand(0, count(self::$words) - 1)];\n\t\t}\n\t\treturn implode(\" \", $set);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/item/enchantment/EnchantmentEntry.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item\\enchantment;\n\n\nclass EnchantmentEntry{\n\n\t/** @var Enchantment[] */\n\tprivate $enchantments;\n\tprivate $cost;\n\tprivate $randomName;\n\n\t/**\n\t * @param Enchantment[] $enchantments\n\t * @param $cost\n\t * @param $randomName\n\t */\n\tpublic function __construct(array $enchantments, $cost, $randomName){\n\t\t$this->enchantments = $enchantments;\n\t\t$this->cost = (int) $cost;\n\t\t$this->randomName = $randomName;\n\t}\n\n\tpublic function getEnchantments(){\n\t\treturn $this->enchantments;\n\t}\n\n\tpublic function getCost(){\n\t\treturn $this->cost;\n\t}\n\n\tpublic function getRandomName(){\n\t\treturn $this->randomName;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/item/enchantment/EnchantmentLevelTable.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\item\\enchantment;\n\nuse pocketmine\\item\\Armor;\nuse pocketmine\\item\\Item;\nuse pocketmine\\utils\\Range;\n\nclass EnchantmentLevelTable{\n\n\tprivate static $map = [];\n\n\tpublic static function init(){\n\t\tself::$map = [\n\t\t\tEnchantment::TYPE_ARMOR_PROTECTION => [\n\t\t\t\tnew Range(1, 21),\n\t\t\t\tnew Range(12, 32),\n\t\t\t\tnew Range(23, 43),\n\t\t\t\tnew Range(34, 54)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_ARMOR_FIRE_PROTECTION => [\n\t\t\t\tnew Range(10, 22),\n\t\t\t\tnew Range(18, 30),\n\t\t\t\tnew Range(26, 38),\n\t\t\t\tnew Range(34, 46)],\n\n\t\t\tEnchantment::TYPE_ARMOR_FALL_PROTECTION => [\n\t\t\t\tnew Range(5, 12),\n\t\t\t\tnew Range(11, 21),\n\t\t\t\tnew Range(17, 27),\n\t\t\t\tnew Range(23, 33)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_ARMOR_EXPLOSION_PROTECTION => [\n\t\t\t\tnew Range(5, 17),\n\t\t\t\tnew Range(13, 25),\n\t\t\t\tnew Range(21, 33),\n\t\t\t\tnew Range(29, 41)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_ARMOR_PROJECTILE_PROTECTION => [\n\t\t\t\tnew Range(3, 18),\n\t\t\t\tnew Range(9, 24),\n\t\t\t\tnew Range(15, 30),\n\t\t\t\tnew Range(21, 36)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_WATER_BREATHING => [\n\t\t\t\tnew Range(10, 40),\n\t\t\t\tnew Range(20, 50),\n\t\t\t\tnew Range(30, 60)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_WATER_AFFINITY => [\n\t\t\t\tnew Range(10, 41)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_ARMOR_THORNS => [\n\t\t\t\tnew Range(10, 60),\n\t\t\t\tnew Range(30, 80),\n\t\t\t\tnew Range(50, 100)\n\t\t\t],\n\n\t\t\t//Weapon\n\t\t\tEnchantment::TYPE_WEAPON_SHARPNESS => [\n\t\t\t\tnew Range(1, 21),\n\t\t\t\tnew Range(12, 32),\n\t\t\t\tnew Range(23, 43),\n\t\t\t\tnew Range(34, 54),\n\t\t\t\tnew Range(45, 65)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_WEAPON_SMITE => [\n\t\t\t\tnew Range(5, 25),\n\t\t\t\tnew Range(13, 33),\n\t\t\t\tnew Range(21, 41),\n\t\t\t\tnew Range(29, 49),\n\t\t\t\tnew Range(37, 57)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_WEAPON_ARTHROPODS => [\n\t\t\t\tnew Range(5, 25),\n\t\t\t\tnew Range(13, 33),\n\t\t\t\tnew Range(21, 41),\n\t\t\t\tnew Range(29, 49),\n\t\t\t\tnew Range(37, 57)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_WEAPON_KNOCKBACK => [\n\t\t\t\tnew Range(5, 55),\n\t\t\t\tnew Range(25, 75)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_WEAPON_FIRE_ASPECT => [\n\t\t\t\tnew Range(10, 60),\n\t\t\t\tnew Range(30, 80)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_WEAPON_LOOTING => [\n\t\t\t\tnew Range(15, 65),\n\t\t\t\tnew Range(24, 74),\n\t\t\t\tnew Range(33, 83)\n\t\t\t],\n\n\t\t\t//Bow\n\t\t\tEnchantment::TYPE_BOW_POWER => [\n\t\t\t\tnew Range(1, 16),\n\t\t\t\tnew Range(11, 26),\n\t\t\t\tnew Range(21, 36),\n\t\t\t\tnew Range(31, 46),\n\t\t\t\tnew Range(41, 56)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_BOW_KNOCKBACK => [\n\t\t\t\tnew Range(12, 37),\n\t\t\t\tnew Range(32, 57)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_BOW_FLAME => [\n\t\t\t\tnew Range(20, 50)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_BOW_INFINITY => [\n\t\t\t\tnew Range(20, 50)\n\t\t\t],\n\n\t\t\t//Mining\n\t\t\tEnchantment::TYPE_MINING_EFFICIENCY => [\n\t\t\t\tnew Range(1, 51),\n\t\t\t\tnew Range(11, 61),\n\t\t\t\tnew Range(21, 71),\n\t\t\t\tnew Range(31, 81),\n\t\t\t\tnew Range(41, 91)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_MINING_SILK_TOUCH => [\n\t\t\t\tnew Range(15, 65)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_MINING_DURABILITY => [\n\t\t\t\tnew Range(5, 55),\n\t\t\t\tnew Range(13, 63),\n\t\t\t\tnew Range(21, 71)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_MINING_FORTUNE => [\n\t\t\t\tnew Range(15, 55),\n\t\t\t\tnew Range(24, 74),\n\t\t\t\tnew Range(33, 83)\n\t\t\t],\n\n\t\t\t//Fishing\n\t\t\tEnchantment::TYPE_FISHING_FORTUNE => [\n\t\t\t\tnew Range(15, 65),\n\t\t\t\tnew Range(24, 74),\n\t\t\t\tnew Range(33, 83)\n\t\t\t],\n\n\t\t\tEnchantment::TYPE_FISHING_LURE => [\n\t\t\t\tnew Range(15, 65),\n\t\t\t\tnew Range(24, 74),\n\t\t\t\tnew Range(33, 83)\n\t\t\t]\n\t\t];\n\t}\n\n\t/**\n\t * @param Item $item\n\t * @param int  $modifiedLevel\n\t * @return Enchantment[]\n\t */\n\tpublic static function getPossibleEnchantments(Item $item, int $modifiedLevel){\n\t\t$result = [];\n\n\t\t$enchantmentIds = [];\n\n\t\tif($item->getId() == Item::BOOK){\n\t\t\t$enchantmentIds = array_keys(self::$map);\n\t\t}elseif($item->isArmor()){\n\t\t\t$enchantmentIds[] = Enchantment::TYPE_ARMOR_PROTECTION; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_ARMOR_FIRE_PROTECTION; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_ARMOR_EXPLOSION_PROTECTION; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_ARMOR_PROJECTILE_PROTECTION; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_ARMOR_THORNS; \n\n\t\t\tif($item->isBoots()){\n\t\t\t\t$enchantmentIds[] = Enchantment::TYPE_ARMOR_FALL_PROTECTION; \n\t\t\t}\n\n\t\t\tif($item->isHelmet()){\n\t\t\t\t$enchantmentIds[] = Enchantment::TYPE_WATER_BREATHING; \n\t\t\t\t$enchantmentIds[] = Enchantment::TYPE_WATER_AFFINITY; \n\t\t\t}\n\n\t\t}elseif($item->isSword()){\n\t\t\t$enchantmentIds[] = Enchantment::TYPE_WEAPON_SHARPNESS; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_WEAPON_SMITE; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_WEAPON_ARTHROPODS; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_WEAPON_KNOCKBACK; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_WEAPON_FIRE_ASPECT; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_WEAPON_LOOTING; \n\n\t\t}elseif($item->isTool()){\n\t\t\t$enchantmentIds[] = Enchantment::TYPE_MINING_EFFICIENCY; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_MINING_SILK_TOUCH; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_MINING_FORTUNE; \n\n\t\t}elseif($item->getId() == Item::BOW){\n\t\t\t$enchantmentIds[] = Enchantment::TYPE_BOW_POWER; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_BOW_KNOCKBACK; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_BOW_FLAME; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_BOW_INFINITY; \n\n\t\t}elseif($item->getId() == Item::FISHING_ROD){\n\t\t\t$enchantmentIds[] = Enchantment::TYPE_FISHING_FORTUNE; \n\t\t\t$enchantmentIds[] = Enchantment::TYPE_FISHING_LURE; \n\n\t\t}\n\n\t\tif($item->isTool() || $item->isArmor()){\n\t\t\t$enchantmentIds[] = Enchantment::TYPE_MINING_DURABILITY; \n\t\t}\n\n\t\tforeach($enchantmentIds as $enchantmentId) {\n\t\t\t$enchantment = Enchantment::getEnchantment($enchantmentId);\n            $ranges = self::$map[$enchantmentId];\n            $i = 0;\n\t\t\t/** @var Range $range */\n\t\t\tforeach($ranges as $range) {\n\t            $i++;\n\t            if($range->isInRange($modifiedLevel)){\n\t\t            $result[] = $enchantment->setLevel($i);\n\t            }\n            }\n        }\n\n        return $result;\n    }\n\n}\n"
  },
  {
    "path": "src/pocketmine/item/enchantment/EnchantmentList.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\item\\enchantment;\n\n\nclass EnchantmentList{\n\n\t/** @var EnchantmentEntry[] */\n\tprivate $enchantments;\n\n\tpublic function __construct($size){\n\t\t$this->enchantments = new \\SplFixedArray($size);\n\t}\n\n\t/**\n\t * @param $slot\n\t * @param EnchantmentEntry $entry\n\t */\n\tpublic function setSlot($slot, EnchantmentEntry $entry){\n\t\t$this->enchantments[$slot] = $entry;\n\t}\n\n\t/**\n\t * @param $slot\n\t * @return EnchantmentEntry\n\t */\n\tpublic function getSlot($slot){\n\t\treturn $this->enchantments[$slot];\n\t}\n\n\tpublic function getSize(){\n\t\treturn $this->enchantments->getSize();\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/lang/BaseLang.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\lang;\n\nuse pocketmine\\event\\TextContainer;\nuse pocketmine\\event\\TranslationContainer;\n\nclass BaseLang{\n\n\tconst FALLBACK_LANGUAGE = \"eng\";\n\n\tprotected $langName;\n\n\tprotected $lang = [];\n\tprotected $fallbackLang = [];\n\n\tpublic function __construct($lang, $path = null, $fallback = self::FALLBACK_LANGUAGE){\n\n\t\t$this->langName = strtolower($lang);\n\n\t\tif($path === null){\n\t\t\t$path = \\pocketmine\\PATH . \"src/pocketmine/lang/locale/\";\n\t\t}\n\n\t\t$this->loadLang($path . $this->langName . \".ini\", $this->lang);\n\t\t$this->loadLang($path . $fallback . \".ini\", $this->fallbackLang);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->get(\"language.name\");\n\t}\n\n\tpublic function getLang(){\n\t\treturn $this->langName;\n\t}\n\n\tprotected function loadLang($path, array &$d){\n\t\tif(file_exists($path) and strlen($content = file_get_contents($path)) > 0){\n\t\t\tforeach(explode(\"\\n\", $content) as $line){\n\t\t\t\t$line = trim($line);\n\t\t\t\tif($line === \"\" or $line{0} === \"#\"){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$t = explode(\"=\", $line);\n\t\t\t\tif(count($t) < 2){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$key = trim(array_shift($t));\n\t\t\t\t$value = trim(implode(\"=\", $t));\n\n\t\t\t\tif($value === \"\"){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$d[$key] = $value;\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param string   $str\n\t * @param string[] $params\n\t *\n\t * @return string\n\t */\n\tpublic function translateString($str, array $params = [], $onlyPrefix = null){\n\t\t$baseText = $this->get($str);\n\t\t$baseText = $this->parseTranslation(($baseText !== null and ($onlyPrefix === null or strpos($str, $onlyPrefix) === 0)) ? $baseText : $str, $onlyPrefix);\n\n\t\tforeach($params as $i => $p){\n\t\t\t$baseText = str_replace(\"{%$i}\", $this->parseTranslation((string) $p), $baseText, $onlyPrefix);\n\t\t}\n\n\t\treturn str_replace(\"%0\", \"\", $baseText); //fixes a client bug where %0 in translation will cause freeze\n\t}\n\n\tpublic function translate(TextContainer $c){\n\t\tif($c instanceof TranslationContainer){\n\t\t\t$baseText = $this->internalGet($c->getText());\n\t\t\t$baseText = $this->parseTranslation($baseText !== null ? $baseText : $c->getText());\n\n\t\t\tforeach($c->getParameters() as $i => $p){\n\t\t\t\t$baseText = str_replace(\"{%$i}\", $this->parseTranslation($p), $baseText);\n\t\t\t}\n\t\t}else{\n\t\t\t$baseText = $this->parseTranslation($c->getText());\n\t\t}\n\n\t\treturn $baseText;\n\t}\n\n\tpublic function internalGet($id){\n\t\tif(isset($this->lang[$id])){\n\t\t\treturn $this->lang[$id];\n\t\t}elseif(isset($this->fallbackLang[$id])){\n\t\t\treturn $this->fallbackLang[$id];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function get($id){\n\t\tif(isset($this->lang[$id])){\n\t\t\treturn $this->lang[$id];\n\t\t}elseif(isset($this->fallbackLang[$id])){\n\t\t\treturn $this->fallbackLang[$id];\n\t\t}\n\n\t\treturn $id;\n\t}\n\n\tprotected function parseTranslation($text, $onlyPrefix = null){\n\t\t$newString = \"\";\n\n\t\t$replaceString = null;\n\n\t\t$len = strlen($text);\n\t\tfor($i = 0; $i < $len; ++$i){\n\t\t\t$c = $text{$i};\n\t\t\tif($replaceString !== null){\n\t\t\t\t$ord = ord($c);\n\t\t\t\tif(\n\t\t\t\t\t($ord >= 0x30 and $ord <= 0x39) // 0-9\n\t\t\t\t\tor ($ord >= 0x41 and $ord <= 0x5a) // A-Z\n\t\t\t\t\tor ($ord >= 0x61 and $ord <= 0x7a) or // a-z\n\t\t\t\t\t$c === \".\" or $c === \"-\"\n\t\t\t\t){\n\t\t\t\t\t$replaceString .= $c;\n\t\t\t\t}else{\n\t\t\t\t\tif(($t = $this->internalGet(substr($replaceString, 1))) !== null and ($onlyPrefix === null or strpos($replaceString, $onlyPrefix) === 1)){\n\t\t\t\t\t\t$newString .= $t;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$newString .= $replaceString;\n\t\t\t\t\t}\n\t\t\t\t\t$replaceString = null;\n\n\t\t\t\t\tif($c === \"%\"){\n\t\t\t\t\t\t$replaceString = $c;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$newString .= $c;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}elseif($c === \"%\"){\n\t\t\t\t$replaceString = $c;\n\t\t\t}else{\n\t\t\t\t$newString .= $c;\n\t\t\t}\n\t\t}\n\n\t\tif($replaceString !== null){\n\t\t\tif(($t = $this->internalGet(substr($replaceString, 1))) !== null and ($onlyPrefix === null or strpos($replaceString, $onlyPrefix) === 1)){\n\t\t\t\t$newString .= $t;\n\t\t\t}else{\n\t\t\t\t$newString .= $replaceString;\n\t\t\t}\n\t\t}\n\n\t\treturn $newString;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/chs.ini",
    "content": "language_has_been_selected = 您现在选择了简体中文.\nskip_installer = 您想跳过安装向导吗?\n\nwelcome_to_pocketmine = 欢迎来到Elywing!\\n在开始使用您的新服务器之前，您需要接受以下协议\\nElywing使用了LGPL协议，\\n你可以在这个文件夹中找到LICENCE文件。\naccept_license = 您接受协议内容吗？\nyou_have_to_accept_the_license = 您要接受LGPL协议才可继续使用Elywing\n\nsetting_up_server_now = 你现在要开始设置您的服务器了。\ndefault_values_info = 如果您希望使用默认设置，请直接按下回车键。\nserver_properties = 您以后可以在server.properties中修改设置.\n\nname_your_server = 给你的服务器起个名字吧:\nport_warning = 如果这是您第一次设置服务器，尽量不要改变端口。\nserver_port = 设置你的服务器端口:\ninvalid_port = 服务器端口不正确。\nonline_mode_info = 联机模式下, 服务器将强制玩家需要 Xbox 登录\\n当联机时, 建议让服务器开启此功能\nonline_mode = 您想启用联机模式?\nram_warning = 设置Elywing可用的最大内存.\nserver_ram = 分配给服务器的内存(RAM)(MB):\ngamemode_info = 选择模式: (0)生存模式 或 (1)创造模式\ndefault_gamemode = 默认游戏模式\nmax_players = 最多在线人数\nspawn_protection_info = 出生点保护可以在出生点范围内保护所有方块不被改变。\nspawn_protection = 启用出生点保护嘛?\nlevel_name = 为您的服务器世界设置一个名称:\nlevel_type = 设置您服务器的世界类型:\ninvalid_level_type = 无效的世界类型\nannounce_player_achievements = 当玩家获得成就时是否公布？\n\nop_info = OP是服务器的管理员, 可以执行比普通玩家更多的命令.\nop_who = OP的用户名是什么?\nop_warning = 你可以执行\\\"/op <用户名>\\\"来添加OP.\nwhitelist_info = 白名单可以只允许在其列表内的玩家加入.\nwhitelist_enable = 您想启用白名单吗?\nwhitelist_warning = 你可以用\"/whitelist add <用户名>\"把别人加入白名单.\n\nquery_warning1 = Query可用来获取您服务器数据和登录的玩家.\nquery_warning2 = 如果您禁止了它, 您将不能使用服务器列表.\nquery_disable = 您希望禁用Query请求吗?\nrcon_info = RCON可用来远程连接到服务器控制台(需要密码).\nrcon_enable = 您希望启用RCON吗?\nrcon_password = RCON密码 (您也以后更改它) :\nusage_info = 匿名数据让我们可以获得全球的PocketMine-MP和它的插件的统计信息. 您可以在 stats.pocketmine.net 查看统计信息.\nusage_disable = 您希望禁用匿名数据吗?\nip_get = 获得你的外部IP和内部IP\nip_warning = 您的外部IP是 {{EXTERNAL_IP}} . 您可能需要端口转发到您的内网IP {{INTERNAL_IP}} .\nip_confirm = 请确认，如没有问题请按下\\\"回车\\\"键\n\nyou_have_finished = 您已经成功完成了服务器设置向导.\npocketmine_will_start = 现在，尽情使用吧~. 输入 \\\"/help\\\" 来看所有可用的命令.\npocketmine_plugins = 请查看插件源来添加新的功能, 迷你游戏或者对服务器的高级保护.\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/deu.ini",
    "content": "language_has_been_selected = Deutsch wurde erfolgreich als Sprache ausgewählt.\nskip_installer = Möchtest du den Einrichtungsassistenten überspringen?\n\nwelcome_to_pocketmine = Willkommen bei Elywing!\\nBevor es mit der Einrichtung deines neuen Servers losgehen kann, musst du die Lizenz akzeptieren.\\nElywing ist unter der GPL Lizenz Version 3 und neuer lizenziert, welche du in der Datei LICENCE nachlesen kannst.\naccept_license = Akzeptierst du die Lizenz?\nyou_have_to_accept_the_license = Um Elywing weiterverwenden zu können, musst du der Lizenz zustimmen.\n\nsetting_up_server_now = Du bist nun dabei, deinen Server einzurichten.\ndefault_values_info = Drücke einfach Enter, um die Standardwerte zu übernehmen.\nserver_properties = Du kannst sie auch später in der Datei server.properties ändern.\n\nname_your_server = Gib deinem Server einen Namen.\nport_warning = Ändere nicht den Wert für den Standart-Port, falls dies dein erster Server ist.\nserver_port = Server-Port\ninvalid_port = Ungültiger Server-Port\nonline_mode_info = Im Online-Modus wird der Spieler gezwungen, sich mit seinem XBOX-Account zu authentifizieren.\\nEs wird die Aktivierung des Online-Modus empfohlen, falls der Server für externe Spieler geöffnet ist.\nonline_mode = Möchtest du den Online-Modus aktivieren?\nram_warning = Der RAM ist die maximale Menge an Arbeitsspeicher, welchen Elywing verwenden darf. Es wird ein Wert von 128-256 MB empfohlen.\nserver_ram = Server RAM in MB\ngamemode_info = Wähle zwischen Kreativmodus (1) oder Überlebensmodus (0)\ndefault_gamemode = Standard Spielmodus\nmax_players = Max. Online-Spieler\nspawn_protection_info = Der Spawnschutz (spawn protection) verhindert das Setzen oder Abbauen von Blöcken im Spawn-Bereich, außer für OPs.\nspawn_protection = Spawnschutz aktivieren?\nlevel_name = Bestimme den Namen der Welt\nlevel_type = Lege fest, welchen Welttyp der Server verwenden soll\ninvalid_level_type = Ungültiger Welttyp\nannounce_player_achievements = Sollen die Spieler benachrichtigt werden, wenn ein Erfolg erzielt wird?\n\nop_info = Ein OP ist ein Spieler, der Admin ist. OPs können mehr Befehle ausführen als normale Spieler.\nop_who = OP Spielername (z.B. dein Spielername)\nop_warning = Du kannst später weitere OP Spieler hinzufügen, indem du eingibst /op <Spielername>\nwhitelist_info = Mit Aktivierung der Whitelist dürfen nur noch Spieler joinen, die darin enthalten sind.\nwhitelist_enable = Möchtest du die Whitelist aktivieren?\nwhitelist_warning = Du musst die Spieler dann noch zur Whitelist hinzufügen\n\nquery_warning1 = Query ist ein Protokoll, das von verschiedenen Tools verwendet wird, um Informationen zu deinem Servers und die darauf angemeldeten Spieler abzufragen.\nquery_warning2 = Wenn du es deaktivierst, kannst du keine Serverlisten nutzen.\nquery_disable = Möchtest du Query deaktivieren?\nrcon_info = RCON ist ein Protokoll, über welches man sich aus der Ferne mit einem Passwort zur Serverkonsole verbinden kann.\nrcon_enable = Möchtest du RCON aktivieren?\nrcon_password = RCON Passwort (du kannst es später ändern)\nusage_info = Die anonymen Nutzungsdaten ermöglichen uns, eine globale Statistik für Pocketmine-MP und dessen Plugins zu generieren. Du kannst sie dir auf stats.pocketmine.net ansehen.\nusage_disable = Möchtest du die anonymen Nutzungsdaten deaktivieren?\nip_get = Deine interne und externe IP-Adresse wird ermittelt\nip_warning = Deine externe IP ist {{EXTERNAL_IP}}. Möglicherweise muss eine Port-Weiterleitung zu deiner internen IP {{INTERNAL_IP}} eingerichtet werden.\nip_confirm = Stelle sicher, dass du das geprüft hast. Falls du eine Weiterleitung benötigst, aber nicht einrichtest, wird kein externer Spieler joinen können. [Drücke Enter]\n\nyou_have_finished = Du hast den Einrichtungsassistenten nun erfolgreich abgeschlossen.\npocketmine_will_start = Elywing wird jetzt gestartet. Gib /help ein, um dir eine Liste verfügbarer Befehle anzeigen zu lassen.\npocketmine_plugins = Prüfe auch das Plugin-Repository im Web, um deinem Server weitere Features, Minigames oder erweiterten Schutz hinzuzufügen.\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/eng.ini",
    "content": "language_has_been_selected = English has been correctly selected.\nskip_installer = Do you want to skip the set-up wizard?\n\nwelcome_to_pocketmine = Welcome to Elywing!\\nBefore starting setting up your new server you have to accept the license.\\nT is licensed under the LGPL License,\\nthat you can read opening the LICENSE file on this folder.\naccept_license = Do you accept the License?\nyou_have_to_accept_the_license = You have to accept the LGPL license to continue using Elywing\n\nsetting_up_server_now = You are going to set up your server now.\ndefault_values_info = If you don't want to change the default value, just press Enter.\nserver_properties = You can edit them later on the server.properties file.\n\nname_your_server = Give a name to your server\nport_warning = Do not change the default port value if this is your first server.\nserver_port = Server port\ninvalid_port = Invalid server port\nonline_mode_info = In online mode, the server will force the user to login via XBOX.\\nEnabling online mode is recommended if the server is opened to external players.\nonline_mode = Do you want to enable online mode?\ngamemode_info = Choose between Creative (1), Survival (0), or Spectator (3)\ndefault_gamemode = Default gamemode\nmax_players = Max. online players\nspawn_protection_info = The spawn protection disallows placing/breaking blocks in the spawn zone except for OPs\nspawn_protection = Enable spawn protection?\nlevel_name = Set the name of the level\nlevel_type = Set the server's level type\ninvalid_level_type = Invalid level type\nannounce_player_achievements = Announce when a player gets an achievement?\n\nop_info = An OP is the player admin of the server. OPs can run more commands than normal players\nop_who = OP player name (example, your game name)\nop_warning = You will be able to add an OP user later using /op <player>\nwhitelist_info = The white-list only allows players in it to join.\nwhitelist_enable = Do you want to enable the white-list?\nwhitelist_warning = You will have to add the players to the white-list\n\nquery_warning1 = Query is a protocol used by different tools to get information of your server and players logged in.\nquery_warning2 = If you disable it, you won't be able to use server lists.\nquery_disable = Do you want to disable Query?\nrcon_info = RCON is a protocol to remote connect with the server console using a password.\nrcon_enable = Do you want to enable RCON?\nrcon_password = RCON password (you can change it later)\nusage_info = The anonymous usage data allows us to calculate global statistics for PocketMine-MP and its plugins. You can view them on stats.pocketmine.net\nusage_disable = Do you want to disable the anonymous usage?\nip_get = Getting your external IP and internal IP\nip_warning = Your external IP is {{EXTERNAL_IP}}. You may have to port-forward to your internal IP {{INTERNAL_IP}}\nip_confirm = Be sure to check it, if you have to forward and you skip that, no external players will be able to join. [Press Enter]\n\nyou_have_finished = You have finished the set-up wizard correctly\npocketmine_will_start = Elywing will now start. Type /help to view the list of available commands.\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/fra.ini",
    "content": "language_has_been_selected = Français a été correctement sélectionné.\nskip_installer = Voulez-vous passer l'assistant d'installation?\n\nwelcome_to_pocketmine = Bienvenue sur Elywing!\\nAvant de commencer à paramétrer votre nouveau serveur, vous devez accepter la license d'utilisation.\\nElywing est sous licence LGPL,\\nvous pouvez la lire en ouvrant le fichier LICENSE dans ce dossier.\naccept_license = Acceptez-vous la Licence?\nyou_have_to_accept_the_license = Vous devez accepter la licence LGPL pour continuer à utiliser Elywing\n\nsetting_up_server_now = Vous êtes maintenant prêt à paramétrer votre serveur.\ndefault_values_info = Si vous ne voulez pas changer la valeur par défaut, appuyez sur entrée.\nserver_properties = Vous pouvez éditer cela plus tard dans le fichier server.properties.\n\nname_your_server = Donnez un nom à votre serveur\nport_warning = Ne changez pas la valeur par défaut du port si c'est votre premier serveur.\nserver_port = Port du serveur\ninvalid_port = Port du serveur invalide\nram_warning = La RAM est au maximum de sa capacité par rapport à la mémoire utilisée par PocketMine-MP. Une valeur de 128-256 MB est recommandée\nserver_ram = RAM du serveur en MB\ngamemode_info = Choisir entre Créatif (1) ou Survie (0)\ndefault_gamemode = Mode de jeu par défaut\nmax_players = Joueurs max. en ligne\nspawn_protection_info = La protection de spawn désactive le placement/cassement de blocs dans la zone de spawn excepté pour les OPs\nspawn_protection = Activer la protection de spawn?\nlevel_name = Donnez un nom à votre niveau\nlevel_type = Définissez le type de niveau du serveur \ninvalid_level_type = Type de niveau invalide\nannounce_player_achievements = Annoncer les succés dans le salon de discussion? \n\nop_info = Un OP est un administrateur du serveur. Les OPs peuvent exécuter plus de commandes que les joueurs normaux\nop_who = Nom de joueur OP (exemple, votre nom de jeu)\nop_warning = Vous serez en mesure d'ajouter un OP plus tard en utilisant /op <player>\nwhitelist_info = La white-list autorise seulement les joueurs présents sur celle-ci.\nwhitelist_enable = Voulez-vous activer la white-list?\nwhitelist_warning = Vous devrez ajouter les joueurs à la white-list\n\nquery_warning1 = Query est un protocole utilisé par différents outils pour avoir des informations sur votre serveur et les joueurs connectés.\nquery_warning2 = Si vous le désactivez, vous ne pourrez pas utiliser les listes du serveur.\nquery_disable = Voulez-vous désactiver Query?\nrcon_info = RCON est un protocole pour se connecter à distance à la console du serveur par un mot de passe.\nrcon_enable = Voulez-vous activer RCON?\nrcon_password = Mot de passe RCON (vous pouvez le changer plus tard)\nusage_info = Les données d'utilisation anonyme vous permettent de calculer les statistiques globales de PocketMine-MP et ses plugins. Vous pouvez les voir sur stats.pocketmine.net\nusage_disable = Voulez-vous désactiver l'utilisation anonyme?\nip_get = Obtention de votre IP externe et IP interne\nip_warning = Votre IP externe est {{EXTERNAL_IP}}. Vous pourriez avoir à transmettre au port votre IP interne {{INTERNAL_IP}}\nip_confirm = Vérifiez-le bien, si vous avancez et sautez cette étape, les joueurs extérieurs ne pourront pas rejoindre votre serveur. [Tapez Enter]\n\nyou_have_finished = Vous avez correctement terminé l'assistant d'installation\npocketmine_will_start = Elywing va maintenant démarrer. Tapez /help pour voir la liste des commandes disponibles.\npocketmine_plugins = Vérification du répertoire de plugin pour ajouter des nouvelles caractéristiques, mini-jeux, ou une protection avancée de votre serveur\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/ita.ini",
    "content": "language_has_been_selected = Hai selezionato correttamente l'italiano.\nskip_installer = Vuoi saltare la procedura guidata di installazione?\n\nwelcome_to_pocketmine = Benvenuto in Elywing!\\nPrima di iniziare la configurazione del nuovo server e' necessario accettare la licenza.\\nElywing e' rilasciato sotto la licenza LGPL,\\nche si puo' leggere aprendo il file di licenza su questa cartella.\naccept_license = Accettate la licenza?\nyou_have_to_accept_the_license = Bisogna accettare la licenza LGPL per continuare ad utilizzare Elywing\n\nsetting_up_server_now = Si sta per configurare il server ora.\ndefault_values_info = Se non si desidera modificare il valore di default, basta premere Invio.\nserver_properties = E' possibile modificarli in seguito aprendo il file server.properties.\n\nname_your_server = Nome del server\nport_warning = Non modificare il valore della porta di default se questo e' il vostro primo server.\nserver_port = Porta del server\ninvalid_port = Porta del server invalida\nonline_mode_info = In modalita' online, il server costringera' l'utente a effettuare il login tramite XBOX. \\nL'attivazione della modalita' online e' consigliato se il server e' aperto ai giocatori esterni.\nonline_mode = Vuoi abilitare la modalita' online?\nram_warning = La RAM e' la quantita' massima di memoria che Elywing utilizzera'. Si consiglia un valore di 128-256 MB\nserver_ram = Server RAM in MB\ngamemode_info = Scegliere tra Creativa (1) o sopravvivenza (0)\ndefault_gamemode = Modalita' di gioco predefinito\nmax_players = Max. giocatori online\nspawn_protection_info = La protezione di spawn non consente il piazzamento di blocchi e la loro rottura nella zona di spawn ad eccezione degli operatori\nspawn_protection = Attiva protezione spawn?\nlevel_name = Impostare il nome del livello\nlevel_type = Impostare il tipo di livello di server\ninvalid_level_type = Tipo di livello non valido\nannounce_player_achievements = Annuncia quando un giocatore ottiene un obbiettivo?\n\nop_info = Un operatore e' il giocatore di amministrazione del server. Gli operatori possono eseguire piu' comandi di giocatori normali\nop_who = Nome delgli operatori (esempio, il tuo nome)\nop_warning = Sarete in grado di aggiungere un operatore in seguito utilizzando / op <giocatore>\nwhitelist_info = Il white-list consente solo a certi giocatori di unirsi.\nwhitelist_enable = Desideri attivare la white-list?\nwhitelist_warning = Dovrai aggiungere i giocatori alla whitelist\n\nquery_warning1 = Query e' un protocollo utilizzato da diversi strumenti per ottenere informazioni del server e giocatori loggati.\nquery_warning2 = Se si disattiva, non sarai in grado di utilizzare gli elenchi di server.\nquery_disable = Vuoi disattivare Query?\nrcon_info = RCON e' un protocollo per la connessione remota con la console del server utilizzando una password.\nrcon_enable = Vuoi abilitare RCON?\nrcon_password = password RCON (si puo' cambiare in un secondo momento)\nusage_info = I dati di utilizzo anonimi ci permette di calcolare le statistiche globali per PocketMine-MP e dei suoi plug-in. e' possibile visualizzarle su stats.pocketmine.net\nusage_disable = Vuoi per disattivare l'uso di dati anonimo?\nip_get = Ottenendo il vostro IP esterno e IP interno\nip_warning = Il tuo IP esterno e' {{EXTERNAL_IP}}. Potrebbe essere necessario port-forward per il tuo IP interno {{INTERNAL_IP}}\nip_confirm = Assicuratevi di controllarlo, se devi fare il port-forward e non lo fai, nessun giocatore esterno sara' in grado di entrare. [Premere Invio]\n\nyou_have_finished = e' terminata correttamente la procedura guidata di installazione\npocketmine_will_start = Elywing ora si avviera'. Digita /help per visualizzare l'elenco dei comandi disponibili.\npocketmine_plugins = Controllare il Repository Plugin per aggiungere nuove funzionalita', minigiochi, o protezione avanzata per il vostro server\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/jpn.ini",
    "content": "language_has_been_selected = 日本語に設定されました\nskip_installer = セットアップウィザードをスキップしますか?\n\nwelcome_to_pocketmine = Elywingをインストールして頂きありがとうございます!サーバのセットアップを開始するにはライセンスに同意する必要があります。ElywingはLGPLライセンスに基づいて認可されており、これについてはこのフォルダ内のLICENSEファイルから確認することができます。\naccept_license = ライセンスに同意しますか?\nyou_have_to_accept_the_license = Elywingを使用するにはLGPLライセンスに同意する必要があります\n\nsetting_up_server_now = サーバのセットアップを開始します\ndefault_values_info = 設定を変更しない場合は、Enterキーを押してください。\nserver_properties = それらの設定は後からでもserver.propertiesファイルから変更できます\n\nname_your_server = あなたのサーバに名前を付けてください\nport_warning = これが初めてのサーバの場合は、ポート番号をデフォルトから変更しないでください\nserver_port = サーバポート\ninvalid_port = 無効なサーバポートです\nonline_mode_info = オンラインモードでは、ユーザーがXBOXを経由してログインすることを強制します。\\nサーバーが外部に開放されている場合はオンラインモードを有効にすることをおすすめします。\nonline_mode = オンラインモードを有効にしますか?\nram_warning = RAMはElywingが使用し得るメモリの最大値を示しています。128-256MBの範囲内で指定することを推奨します。\nserver_ram = RAMの単位はMBです\ngamemode_info = クリエイティブモード(1)、またはサバイバルモード(0)を選択してください\ndefault_gamemode = デフォルトのゲームモード\nmax_players = 最大プレイヤー数\nspawn_protection_info = スポーンプロテクションは、OPでないプレイヤーによるスポーン地点付近でのブロックの設置/破壊を制限します\nspawn_protection = スポーンプロテクションを有効にしますか?\nlevel_name = ワールド名を指定してください\nlevel_type = サーバーのワールドタイプを指定してください\ninvalid_level_type = 無効なレベルタイプです\nannounce_player_achievements = プレイヤーが実績を獲得したときにアナウンスしますか?\n\nop_info = OPとはそのサーバの管理権限を指します。OPを持ったプレイヤーは他のプレイヤーよりも多くのコマンドを使用できます。\nop_who = OPプレイヤー名(例: あなたのゲーム内での名前)\nop_warning = 後から/op <プレイヤー名>コマンドを実行してOPプレイヤーを追加することもできます\nwhitelist_info = ホワイトリストはこのサーバに入ることのできるプレイヤーを制限します。\nwhitelist_enable = ホワイトリストを有効にしますか?\nwhitelist_warning = プレイヤーをホワイトリストに追加してください\n\nquery_warning1 = クエリは他のツールによりあなたのサーバやプレイヤーの情報を取得するためのプロトコルです。\nquery_warning2 = それを無効にした場合、サーバリストを使用できなくなる可能性があります。\nquery_disable = クエリを無効にしますか?\nrcon_info = RCONはパスワードを用いてサーバコンソールからリモート接続するためのプロトコルです。\nrcon_enable = RCONを有効にしますか?\nrcon_password = RCONパスワード(後から変更できます)\nusage_info = 世界中で使われているPocketMine-MPやそのプラグインの統計を算出するために匿名の使用データが送信されます。統計はこちらから確認できます。stats.pocketmine.net\nusage_disable = 匿名の使用データの送信を拒否しますか?\nip_get = グローバルIPとプライベートIPの取得\nip_warning = あなたのグローバルIPは{{EXTERNAL_IP}}です。プライベートIP{{INTERNAL_IP}}をポート解放してください。\nip_confirm = 必ずポート解放ができているか確認してください。ポートが解放できていなかった場合、他のプレイヤーがサーバに入れなくなる恐れがあります。[Enterキーを押してください]\n\nyou_have_finished = セットアップは正しく終了しました\npocketmine_will_start = Elywingを起動します。/helpと入力すれば使用可能なコマンド一覧を表示できます。\npocketmine_plugins = 拡張機能や管理システム、ミニゲームなどを追加できるプラグインリポジトリも確認してみてください\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/kor.ini",
    "content": "language_has_been_selected = 한국어가 언어로 선택되었습니다.\nskip_installer = 설치 마법사를 건너뛰겠습니까?\n\nwelcome_to_pocketmine = Elywing에 오신 것을 환영합니다!\\n서버 설치를 시작하기 전, 약관에 동의해야 합니다. \\nElywing는 GNU 약소 일반 공중 사용 허가서(LGPL) 하에 배포되고 있습니다. \\n이 폴더에서 약관을 읽을 수 있습니다.\naccept_license = 약관에 동의하십니까?\nyou_have_to_accept_the_license = GNU 약소 일반 공중 사용 허가서(LGPL)에 동의하셔야 Elywing를 사용할 수 있습니다.\n\nsetting_up_server_now = 서버 설정을 시작합니다.\ndefault_values_info = 기본값을 수정하고 싶지 않으면, 엔터를 누르시기 바랍니다.\nserver_properties = 이 설정들은 server.properties 파일에서 세부적으로 변경이 가능합니다.\n\nname_your_server = 당신의 서버 이름을 입력하시기 바랍니다.\nport_warning = 만약 당신이 서버를 처음 설정한다면 포트 값을 변경하지 마세요.\nserver_port = 서버 포트\ninvalid_port = 서버 포트가 잘못 입력되었습니다.\nonline_mode_info = 온라인 모드에서는 서버가 사용자를 XBOX를 사용해서만 로그인하도록 합니다.\\n외부 서버를 여는 경우 온라인 모드를 활성화 하는 것이 좋습니다.\nonline_mode = 온라인 모드를 활성화 하시겠습니까?\nram_warning = RAM 값은 Elywing에 할당할 메모리의 크기입니다. 128~256MB를 권장합니다.\nserver_ram = 서버의 램(RAM) (MB)\ngamemode_info = 크리에이티브 (1) 또는 서바이벌 (0) 게임모드 중 하나를 고르세요.\ndefault_gamemode = 기본 게임 모드\nmax_players = 최대 동시접속 인원 수\nspawn_protection_info = 스폰 보호는 OP를 제외한 유저들이 스폰 지역 근처에서 블럭을 놓거나 부수는 것을 방지합니다.\nspawn_protection = 스폰 지역 보호를 사용하겠습니까?\nlevel_name = 레벨의 이름을 설정하시기 바랍니다.\nlevel_type = 레벨의 유형을 설정하시기 바랍니다.\ninvalid_level_type = 레벨 유형이 잘못 입력되었습니다.\nannounce_player_achievements = 플레이어가 도전 과제를 달성했을때 알리시겠습니까?\n\nop_info = OP는 서버 관리자를 뜻합니다. OP는 일반 플레이어보다 훨씬 많은 명령어들을 사용할 수 있습니다\nop_who = OP 권한을 줄 플레이어 이름(예: 당신의 닉네임)\nop_warning = 또는 이후에 /op <플레이어 이름> 을 입력해 그 유저에게 OP 권한을 줄 수도 있습니다\nwhitelist_info = 화이트리스트를 사용하면 허용된 플레이어들만 서버에 접속할 수 있습니다.\nwhitelist_enable = 화이트리스트를 사용하겠습니까?\nwhitelist_warning = 당신은 접속을 허용할 플레이어들의 이름을 적어야 합니다\n\nquery_warning1 = 쿼리 (Query)는 당신의 서버와 현재 접속한 플레이어들의 정보를 알 수 있게 해주는 여러가지 기능이 담긴 프로토콜입니다.\nquery_warning2 = 쿼리를 사용하지 않으면, 당신은 서버 리스트를 사용할 수 없게 됩니다.\nquery_disable = 쿼리를 사용하지 않겠습니까?\nrcon_info = RCON은 비밀 번호를 사용하여 서버 명령창에 원격으로 접속할 수 있는 프로토콜입니다.\nrcon_enable = RCON을 사용하시겠습니까?\nrcon_password = RCON 비밀번호 설정 (나중에 server.properties 에서 변경이 가능합니다.)\nusage_info = 익명 사용 통계 전송을 허용하면 PocketMine-MP가 세계의 서버 상황과 플러그인들을 통계화하는 데 사용할 수 있습니다. 당신은 stats.pocketmine.net에서 이를 확인할 수 있습니다\nusage_disable = 익명 사용 통계 전송을 사용하지 않으시겠습니까?\nip_get = 내/외부 IP 주소 얻기\nip_warning = 당신의 외부 IP는 {{EXTERNAL_IP}}입니다. 당신의 내부 IP {{INTERNAL_IP}}로 포트포워딩이 필요할 수 있습니다\nip_confirm = 신중하게 확인하세요. 만약 포트포워딩이 필요하지만 하지 않을 경우 외부에서 플레이어들이 접속할 수 없게 됩니다. [계속 하시려면 엔터를 누르세요]\n\nyou_have_finished = Elywing의 설치가 모두 완료되었습니다.\npocketmine_will_start = Elywing 서버를 구동합니다. /help로 사용 가능한 모든 명령어의 목록을 보시기 바랍니다.\npocketmine_plugins = 플러그인 저장소에서 새로운 기능을 추가하세요. 새로운 기능, 미니게임을 추가하거나 고급 기능으로 당신의 서버를 보호할 수 있습니다\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/rus.ini",
    "content": "language_has_been_selected = Был выбран русский язык.\nskip_installer = Вы хотите пропустить мастер настройки?\n\nwelcome_to_pocketmine = Добро пожаловать в Elywing!\\nПеред началом установки нового сервера, вы должны согласиться с лицензией. \\nElywing лицензировано на условиях LGPL лицензии, \\nс которой вы можете ознакомиться, открыв файл LICENSE в этой папке.\naccept_license = Принимаете ли вы лицензию?\nyou_have_to_accept_the_license = Вы должны принять LGPL лицензию, чтобы продолжить использование Elywing\n\nsetting_up_server_now = Теперь вы можете настроить сервер.\ndefault_values_info = Если вы не хотите изменять стандартное значение, просто нажмите Enter.\nserver_properties = Вы можете редактировать их позже в файле server.properties.\n\nname_your_server = Дайте имя вашему серверу\nport_warning = Не изменяйте значение порта по умолчанию, если это ваш первый сервер.\nserver_port = Порт сервера\ninvalid_port = Неверный порт сервера\nonline_mode_info=online-mode позволяет проверять игрока на аутентификацию в XBOX Live\nonline_mode=Включить online-mode?\nram_warning = RAM - максимальный объем памяти, котооый будет использовать Elywing, рекомендуемое значение 128-256 МБ\nserver_ram = Оперативная память сервера в МБ\ngamemode_info = Выберите между Креативом-(1), или Выживанием (0)\ndefault_gamemode = Режим игры по умолчанию\nmax_players = Максимум онлайн игроков\nspawn_protection_info = Защита спавна запрещает размещение/разрушение блоков на спавне, за исключением операторов\nspawn_protection = Включить защиту спавна?\nlevel_name = Дайте имя миру вашего сервера\nlevel_type = Выберите тип мира\ninvalid_level_type = Неверный тип мира\nannounce_player_achievements = Объявлять достижение игрока когда он его получил?\n\nop_info = Оператор - Администратор сервера, который может использовать больше команд, чем обычный игрок\nop_who = Имя оператора (К примеру ваш ник в игре)\nop_warning = Вы можете добавить оператора позже используя команду /op <player>\nwhitelist_info = White-list позволяет присоединиться только игрокам в этом списке.\nwhitelist_enable = Вы хотите включить white-list?\nwhitelist_warning = Вам придётся добавить игроков в white-list\n\nquery_warning1 = Query  это протокол, используемый разными инструментами, чтобы получить информацию о вашем сервере и о зашедших игроках.\nquery_warning2 = Если вы отключите его, вы не сможете использовать списки серверов.\nquery_disable = Вы хотите отключить Query?\nrcon_info = RCON - это протокол для удаленного управления сервером через консоль, с использованием пароля.\nrcon_enable = Вы хотите включить RCON?\nrcon_password = RCON пароль (вы сможете изменить его позже)\nusage_info = Сбор анонимных данных о использовании поможет нам проанализировать глобальную статистику для PocketMine-MP и  плагинов. Статистика доступна по адресу stats.pocketmine.net\nusage_disable = Вы хотите отключить сбор анонимных данных о использовании?\nip_get = Получение вашего внешнего и внутреннего IP адреса\nip_warning = Ваш внешний IP адрес: {{EXTERNAL_IP}}. Возможно вам необходимо открыть порты к вашему внутреннему IP адресу: {{INTERNAL_IP}}\nip_confirm = Убедитесь в том, что вы открыли порты, в противном случае игроки вне вашей локальной сети не смогут подключится. [Нажмите Enter]\n\nyou_have_finished = Вы закончили работу с мастером установки\npocketmine_will_start = Elywing сейчас запустится. Введите /help для просмотра доступных вам команд.\npocketmine_plugins = Посетите репозиторий плагинов для получения новых функций, мини-игр, или повышения защиты вашего сервера\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/ukr.ini",
    "content": "language_has_been_selected = Було вибрано українську мову.\nskip_installer = Бажаєте пропустити майстер налаштування?\n\nwelcome_to_pocketmine = Вітаємо в Elywing!\\nПеред початком встановлення нового серверу, ви маєте погодитися з умовами ліцензії. \\nElywing ліцензовано на умовах LGPL. \\nДетально ви можете ознайомитися з нею у файлі LICENSE в цій теці.\naccept_license = Ви приймаєте умови ліцензії?\nyou_have_to_accept_the_license = Ви маєте погодитися з умовами LGPL ліцензії для подальшого користування Elywing\n\nsetting_up_server_now = Тепер ви можете налаштувати сервер.\ndefault_values_info = Для вибору значень за замовчуванням просто натискайте Enter.\nserver_properties = Пізніше ви зможете їх відредагувати у файлі server.properties.\n\nname_your_server = Вкажіть назву вашого серверу\nport_warning = Не змінюйте номер порту за замовчуванням, якщо ви налаштовуєте сервер вперше.\nserver_port = Порт серверу\ninvalid_port = Неправильний порт серверу\nonline_mode_info=online-mode дозволяє перевіряти у гравця наявність аутентифікації в XBOX Live\nonline_mode=Ввімкнути online-mode?\nram_warning = RAM - максимальний об’єм пам’яті, який буде використовувати Elywing, рекомендоване значення - 128-256 МБ\nserver_ram = Оперативна пам’ять серверу в МБ\ngamemode_info = Вкажіть 1 для Творчого режиму на сервері або 0 для Виживання\ndefault_gamemode = Режим гри за замовчуванням\nmax_players = Максимальна кількість гравців\nspawn_protection_info = Захист місця появи гравців забороняє розміщення або руйнування блоків на місті появи гравця, за виключенням операторів\nspawn_protection = Ввімкнути захист спавну?\nlevel_name = Вкажіть назву світу\nlevel_type = Вкажіть тип світу\ninvalid_level_type = Неправильний тип світу\nannounce_player_achievements = Демонструвати досягнення гравців?\n\nop_info = Оператор - це адміністратор серверу, що може використовувати більше команд, ніж звичайний гравець\nop_who = Нік оператора (Наприклад, ваш нік в грі)\nop_warning = Ви зможете додати оператора пізніше за допомогою команди /op <гравець>\nwhitelist_info = Білий список дозволяє заходити тільки тим гравцям, що знаходяться в ньому.\nwhitelist_enable = Бажаєте ввімкнути білий список?\nwhitelist_warning = Необхідно додати гравців до білого списку\n\nquery_warning1 = QUERY - це протокол, що використовується різними інструментами для отримання інформації про сервер та про гравців серверу.\nquery_warning2 = Якщо ви його вимкнете, то не зможете користуватися моніторингами серверів.\nquery_disable = Ви хочете вимкнути QUERY?\nrcon_info = RCON - це протокол, який реалізує віддалене керування сервером. Захищене паролем.\nrcon_enable = Бажаєте ввімкнути RCON?\nrcon_password = RCON пароль (ви зможете змінити його пізніше)\nusage_info = Збір анонімних даних про користування допоможе нам проаналізувати глобальну статистику для PocketMine-MP и плагінів. Статистика доступна за адресою stats.pocketmine.net\nusage_disable = Бажаєте вимкнути збір анонімних даних про користування?\nip_get = Отримання вашого внутрішньої і зовнішньої IP адрес\nip_warning = Ваша зовнішня IP адреса: {{EXTERNAL_IP}}. Можливо, вам необхідно відкрити порти до вашої внутрішньої адреси: {{INTERNAL_IP}}\nip_confirm = Переконайтеся в тому, що ви відкрили порти, інакше гравці поза локальною мережею не зможуть приєднатися. [Натисніть Enter]\n\nyou_have_finished = Ви завершили роботу з майстром встановлення\npocketmine_will_start = Elywing зараз запуститься. Введіть /help для перегляду доступних команд.\npocketmine_plugins = Відвідайте сховище плагінів для отримання нових функцій, міні ігр або для підвищення захисту вашого серверу\n"
  },
  {
    "path": "src/pocketmine/lang/Installer/zho.ini",
    "content": "language_has_been_selected=您選擇了繁體中文\nskip_installer=您想跳過安裝精靈嗎？\n\nwelcome_to_pocketmine=歡迎來到Elywing！\\n在開始使用您的新伺服器前您需要接受以下協議\\nElywing使用了LGPL協議\\n你可以在這個資料夾中找到LICENCE文件\naccept_license=您接受協議內容嗎？\nyou_have_to_accept_the_license=您必須接受LGPL協議來繼續使用Elywing\n\nsetting_up_server_now=您現在要開始設定您的伺服器了\ndefault_values_info=如果您希望使用預設值請直接按下Enter鍵\nserver_properties=您以後可以在server.properties中修改設定\n\nname_your_server=命名您的伺服器：\nport_warning=如果這是您第一次設定服伺服器，請儘量不要更改接口\nserver_port=伺服器接口：\ninvalid_port=不正確的伺服器接口\nonline_mode_info = 多人連線模式下, 伺服器將強制玩家需要 Xbox 登入\\n當多人模式時, 建議讓伺服器開啟此功能\nonline_mode = 您想啟用多人模式?\nram_warning=RAM是Elywing可用的最大記憶體。推薦範圍：128～256 MB\nserver_ram=分配給服務器的記憶體(MB)：\ngamemode_info=選擇模式：(0) 生存模式 或 (1) 創造模式\ndefault_gamemode=預設遊戲模式\nmax_players=最大在線人數\nspawn_protection_info=出生點保護可以在出生點範圍內保護所有方塊不被放置與破壞\nspawn_protection=啟用出生點保護？\nlevel_name = 命名您的伺服器世界:\nlevel_type = 設置您的伺服器世界類型:\ninvalid_level_type = 無效的世界類型\nannounce_player_achievements = 當玩家獲得成就時是否公告？\n\nop_info=OP是一個伺服器的管理員, 可以執行比普通玩家更多的指令\nop_who=請輸入OP的玩家名稱\nop_warning=你可以執行\\\"/op <玩家名稱>\\\"來新增OP\nwhitelist_info=白名單可以只允許在其列表中的玩家加入\nwhitelist_enable=您想啟用白名單嗎？\nwhitelist_warning=你可以用\"/whitelist add <玩家名稱>\"把別人加入白名單\n\nquery_warning1=Query請求是一個用於不同程式的協議用來獲取您伺服器數據和登入的玩家\nquery_warning2=如果您停用了它，您將不能使用伺服器列表\nquery_disable=您希望停用Query請求嗎？\nrcon_info=RCON是一個用來遠程連接到伺服器控制台的協議(需要密碼)\nrcon_enable=您希望啟用RCON嗎？\nrcon_password=RCON密碼 (您以後能更改它)：\nusage_info=匿名數據讓我們可以獲得全球的PocketMine-MP和它的插件的統計訊息，您可以在 stats.pocketmine.net 查看統計訊息\nusage_disable=您希望停用匿名數據嗎？\nip_get=取得你的外網IP和內網IP\nip_warning=您的外網IP是 {{EXTERNAL_IP}}，您可能需要接口轉發到您的內網IP {{INTERNAL_IP}}\nip_confirm=請確認您檢查了它，如果您直接進入下一步並跳過這一步，沒有外部的玩家可以加入 [按\\\"Enter\\\"鍵]\n\nyou_have_finished=您已經成功完成了伺服器安裝精靈\npocketmine_will_start=Elywing現在開始運行，輸入 \\\"/help\\\" 來看所有可用的指令\npocketmine_plugins=請查看插件源來新增新的功能，迷你遊戲或者對伺服器的高級保護\n"
  },
  {
    "path": "src/pocketmine/lang/locale/ces.ini",
    "content": "\nlanguage.name=Čeština\nlanguage.selected=Vybráno {%0} ({%1}) jako základní jazyk\n\nmultiplayer.player.joined={%0} se připojil do hry\nmultiplayer.player.left={%0} se odpojil ze hry\n\nchat.type.text={%0} : {%1}\nchat.type.achievement={%0} právě získal ocenění {%1}\n\ndisconnectionScreen.outdatedClient=Zastaralá verze!\ndisconnectionScreen.outdatedServer=Zastaralý server!\ndisconnectionScreen.serverFull=Server je plný!\ndisconnectionScreen.noReason=Odpojen ze serveru\ndisconnectionScreen.invalidSkin=Neplatný skin!\ndisconnectionScreen.invalidName=Nevhodný herní nick!\n\ndeath.fell.accident.generic={%0} spadl z vysokého místa\ndeath.attack.inFire={%0} shořel v ohni\ndeath.attack.onFire={%0} uhořel k smrti\ndeath.attack.lava={%0} se pokusil plavat v lávě\ndeath.attack.inWall={%0} se udusil ve zdi\ndeath.attack.drown={%0} se utopil\ndeath.attack.cactus={%0} byl upíchán k smrti\ndeath.attack.generic={%0} zemřel\ndeath.attack.explosion={%0} vybouchnul\ndeath.attack.explosion.player={%0} byl odbouchnut hráčem {%1}\ndeath.attack.magic={%0}  byl zabit magickým efektem\ndeath.attack.wither={%0} zemřel na útok Withera\ndeath.attack.mob= {%0} byl zabit {%1}\ndeath.attack.player= {%0} byl zabit {%1}\ndeath.attack.player.item={%0} byl zabit hráčem {%1} používajícím {%2}\ndeath.attack.arrow={%0} byl zastřelen {%1}\ndeath.attack.arrow.item={%0} byl zastřelen hráčem {%1} používajícím {%2}\ndeath.attack.fall={%0} spadl z moc velké výšky\ndeath.attack.outOfWorld={%0} vypadl ze světa\n\ngameMode.survival=§l§f\"Mód Survival\"\ngameMode.creative=§l§f\"Mód Creative\"\ngameMode.adventure=§l§f\"Mód Adventure\"\ngameMode.spectator=§l§f\"Mód Spetractor\"\ngameMode.changed=Tvůj herní mód byl úspěšně změněn\n\npotion.moveSpeed=Rychlost\npotion.moveSlowdown=zpomalení\npotion.digSpeed=Rychle kopání\npotion.digSlowDown=Pomalé kopání\npotion.damageBoost=Síla\npotion.heal=Rychlé uzdravení\npotion.harm=Rychlé zranění\npotion.jump=vysoké skoky\npotion.confusion=nevolnost\npotion.regeneration=Regenerace\npotion.resistance=Odpor\npotion.fireResistance=Ohnivzdornost\npotion.waterBreathing=Dýchání pod vodou\npotion.invisibility=Neviditelnost\npotion.blindness=Hloupost\npotion.nightVision=Noční vidění\npotion.hunger=Hlad\npotion.weakness=Slabost\npotion.poison=Jed\npotion.wither=Wither\npotion.healthBoost=Zvýšení života\npotion.absorption=Absorbace\npotion.saturation=Saturace\n\ncommands.generic.exception=Při pokusu o provedení tohoto příkazu došlo k neznámé chybě\ncommands.generic.permission=§l§cNemas opravneni pouzit tento prikaz\ncommands.generic.notFound=§l§cNeznamy příkaz. Pouzijte /help pro ziskani seznamu prikazu\ncommands.generic.player.notFound=Tento hráč nemůže být nalezen\ncommands.generic.usage=Vyuziti:{%0}\n\ncommands.time.added=Pridáno {%0} do časů\ncommands.time.set=Čas nastaven na {%0}\ncommands.time.query=Čas je {%0}\n\ncommands.me.usage=/me  <action ...>\n\ncommands.give.item.notFound=Neexistuje žádný item s tímto ménem {%0}\ncommands.give.success=Given {%0} * {%1} to {%2}\ncommands.give.tagError=Rozbor data tagu neůspesný: {%0}\n\ncommands.effect.usage=/effect <player> <effect> [seconds] [amplifier] [hideParticles] NEBO /effect <player> clear\ncommands.effect.notFound=Efekt s ID {%0} neexistuje\ncommands.effect.success=Daný {%0} (ID {%1}) * {%2} na {%3} pro {%4} sekund\ncommands.effect.success.removed=Vzal {%0} z {%1}\ncommands.effect.success.removed.all=Vzal všechny efekty od {%0}\ncommands.effect.failure.notActive=Nemůžu vzít {%0} od {%1} protože efekt nemá\ncommands.effect.failure.notActive.all=Nemůžu získat efekt od {%0} protože žádný nemá\n\ncommands.enchant.noItem=Terc nedrzi item\ncommands.enchant.notFound=Tady není zadný enchant s ID {%0}\ncommands.enchant.success=Enchant byl uspesný\ncommands.enchant.usage=/enchant <player> <enchantment ID> [level]\n\ncommands.particle.success=Zapínám efekt {%0} {%1}\ncommands.particle.notFound=Neznámé méno efektu {%0}\n\ncommands.players.usage=/seznam\ncommands.players.list={%0}/{%1} Hráčů online:\n\ncommands.kill.successful=Zabit {%0}\n\ncommands.banlist.ips=Celkem zabanovaných IP adres: %d\ncommands.banlist.players=Je zabanováno {%0} Hráčů:\ncommands.banlist.usage=/banlist [ips|players]\n\ncommands.defaultgamemode.usage=/defaultgamemode <mode>\ncommands.defaultgamemode.success=Základní herní mód je teď {%0}\n\ncommands.op.success=Povýšen {%0}\ncommands.op.usage=/op <player>\n\ncommands.deop.success=§l§cDe-opnut {%0}\ncommands.deop.usage=/deop <player>\n\ncommands.say.usage=/say <zprava ...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Seed:{%0}\n\ncommands.ban.success=Zabanován hráč {%0}\ncommands.ban.usage=/ban <name> [Důvod ...]\n\ncommands.unban.success=Odbanován hráč {%0}\ncommands.unban.usage=/pardon <name>\n\ncommands.banip.invalid=Zadal jsi špatnou IP adresu nebo tento hráč není online\ncommands.banip.success=Zabanována IP adresa {%0}\ncommands.banip.success.players=Zabanovaná IP adresa {%0} byla přepsána na{%1}\ncommands.banip.usage=/ban-ip <address|name> [Důvod...]\n\ncommands.unbanip.invalid=Zadal jsi špatnou ip adresu\ncommands.unbanip.success=Odbanovali jste adresu ip {%0}\ncommands.unbanip.usage=/pardon-ip <address>\n\ncommands.save.usage=-ulozit-vse\ncommands.save-on.usage=/zapnout-ukladani\ncommands.save-off.usage=/vypnout-ulozeni\ncommands.save.enabled=Automatické ukládání světa zapnuto\ncommands.save.disabled=Automatické ukládání světa vypnuto\ncommands.save.start=Ukládám...\ncommands.save.success=Svět uložen\n\ncommands.stop.usage=/stop\ncommands.stop.start=Zastavuji server\n\ncommands.kick.success={%0} byl odpojen ze hry\ncommands.kick.success.reason={%0} byl kicknut ze serveru z duvodu: {%1}\ncommands.kick.usage=/odpojit <hráč > [důvod...]\n\ncommands.tp.success={%0} se portnul k {%1}\ncommands.tp.success.coordinates={%0} Se portnul na souřadnice {%1}, {%2}, {%3}\ncommands.tp.usage=/tp [cílový hráč] <destination player> OR /tp [cílový hráč] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=Nacházejí se zde {%0} (z {%1} viděných) whitelist hráčů:\ncommands.whitelist.enabled=Zapnut whitelist\ncommands.whitelist.disabled=Vypnut whitelist\ncommands.whitelist.reloaded=Whitelist znova načten\ncommands.whitelist.add.success={%0} byl přidán na whitelist\ncommands.whitelist.add.usage=/whitelist přidat <player>\ncommands.whitelist.remove.success={%0} byl odebrán z whitelistu\ncommands.whitelist.remove.usage=/whitelist odebrat <player>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=Změnit svůj herní mód na {%2}\ncommands.gamemode.success.other=Změněn herní mód hráče {%1} na {%2}\ncommands.gamemode.usage=/gamemode <mode> [player]\n\ncommands.help.header=--- Ukazuji pomoc - strana {%0} z {%1} (/help <page>) ---\ncommands.help.usage=§l/help [strana|jméno příkazu]\n\ncommands.message.usage=/tell <player> <private message ...>\ncommands.message.sameTarget=Nemůžeš poslat soukromou zprávu sám sobě!\n\ncommands.difficulty.usage=/difficulty <nova uroven>\ncommands.difficulty.success=Herní obtížnost nastavena na {%0}\n\ncommands.spawnpoint.usage=/spawnpoint [player] [<x> <y> <z>]\ncommands.spawnpoint.success={%0}ův spawnpoint byl nastaven na ({%1}, {%2}, {%3})\n\ncommands.setworldspawn.usage=/setworldspawn [<x><y><z>]\ncommands.setworldspawn.success=Spawn světa byl nastaven na souřadnice ({%0}, {%1}, {%2})\n\n\n\npocketmine.data.playerNotFound=Data hráče {%0} nenalezena, vytvářím nový profil\npocketmine.data.playerCorrupted=Špatná data hráče {%0}, vytvářím nový profil\npocketmine.data.playerOld=Pro hráče {%0} nalezena stará data, vylepšuji profil\npocketmine.data.saveError=Nemůžu nastavit hráče {%0}; {%1}\n\npocketmine.level.notFound=Svět {%0} nebyl nalezen\npocketmine.level.loadError=Nemůžu načíst svět {%0}; {%1}\npocketmine.level.generationError=Nemůžu vytvořit svět {%0}; {%1}\npocketmine.level.tickError=Nemůžu najít svět {%0}; {%1}\npocketmine.level.chunkUnloadError=Chyba při načítáni chunku {%0}\npocketmine.level.backgroundGeneration=Spawn pro svět {%0} bude vytvořen v pozadí\npocketmine.level.defaultError=Žádný základní level nebyl načten\npocketmine.level.preparing=Připravuji svět {%0}\npocketmine.level.unloading=Odnacitavam svět {%0}\n\npocketmine.server.start=Startuji Minecraft: PE server na verzi {%0}\npocketmine.server.networkError=[Network] Zastavil interface {%0} protože {%1}\npocketmine.server.networkStart=Startuji server na {%0}:{%1}\npocketmine.server.info=Tento server běží na {%0} verzi {%1}\"{%2}\" (API {%3})\npocketmine.server.info.extended=Tento server používá {%0} {%1}「{%2}」implantována API {%3} pro Minecraft:PE {%4}\n(protokol {%5})\npocketmine.server.license={%0} je distribuován pod LGPL Licencí\npocketmine.server.tickOverload=Pozor! Server je pretižen!\npocketmine.server.startFinished=Hotovo ({%0}s)! Pro pomoc napiš \"help\" nebo \"?\"\npocketmine.server.defaultGameMode=Základní herní mód je:{%0}\npocketmine.server.query.start=Zapínám GS4 status poslouchač\npocketmine.server.query.info=Nastavuji query port na {%0}\npocketmine.server.query.running=Query běží na {%0}:{%1}\n\npocketmine.command.alias.illegal=Nemůžu registrovat alias {%0} protože obsahuje nepoužitelné písmena\npocketmine.command.alias.notFound=Nemůžu registrovat alias {%0} protože obsahuje příkaz který neexistuje:{%1}\npocketmine.command.exception=Neošetřené použití příkazu '{%0}' in {%1}: {%2}\n\npocketmine.command.plugins.description=Dá list všech pluginů na serveru\npocketmine.command.plugins.success=Pluginy ({%0}):{%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=Přenačte kofiguraci serveru a jeho pluginy\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Znovu načítám data serveru....\npocketmine.command.reload.reloaded=Načtení serveru proběhlo úspěšně\n\npocketmine.command.status.description=Vrátí zpátky výkon serveru.\npocketmine.command.status.usage=/status\n\npocketmine.command.gc.description=Fires garbage collection tasks\npocketmine.command.gc.usage=/gc\n\npocketmine.command.timings.description=Nahrává načasování aby viděl stav serveru.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=Zapnuto časování & reset\npocketmine.command.timings.disable=Vypnuto časování\npocketmine.command.timings.timingsDisabled=Prosím zapněte nahrávání zadáním: /timings on\npocketmine.command.timings.reset=Nastaven restart\npocketmine.command.timings.pasteError=Při vkládání zprávy nastala chyba\npocketmine.command.timings.timingsUpload=Nahrávání nahrána na {%0}\npocketmine.command.timings.timingsRead=Můžete si přečíst výsledky na {%0}\npocketmine.command.timings.timingsWrite=Nahrávání napsána do {%0}\n\npocketmine.command.version.description=Dá vám informace o všech používaných pluginech\npocketmine.command.version.usage=/version [plugin name]\npocketmine.command.version.noSuchPlugin=Tento server nepoužívá žádný plugin s tímto jménem.  Použij  /plugins.\n\npocketmine.command.give.description=Daruje specifikovanému hráči určený počet vybraných itemů\npocketmine.command.give.usage=/give <player> <item[:damage]> [amount] [tags...]\n\npocketmine.command.kill.description=Zabití\npocketmine.command.kill.usage=/kill [player]\n\npocketmine.command.particle.description=Přidá prvek do světa\npocketmine.command.particle.usage=/particle <name> <x> <y> <z> <xd> <yd> <zd> [count] [data]\n\npocketmine.command.time.description=Nastaví čas sveta\npocketmine.command.time.usage=/time <set|add> <value> NEBO /time <start|stop|query>\n\npocketmine.command.ban.player.description=Zakáže hráči přístup na server\npocketmine.command.ban.ip.description=Zakáže specifické IP adrese používat tento server\npocketmine.command.banlist.description=Zobrazí všechny zabanované hráče\npocketmine.command.defaultgamemode.description=Nastaví základní herní mód\npocketmine.command.deop.description=Nastaví hráči op\npocketmine.command.difficulty.description=Nastaví obtížnost hry\npocketmine.command.enchant.description=Pridá enchant na itemy\npocketmine.command.effect.description=Přidá/Odebere hráči op\npocketmine.command.gamemode.description=Změní hráči herní mód\npocketmine.command.help.description=Ukáže nápovědu\npocketmine.command.kick.description=Odebere ban hráči\npocketmine.command.list.description=Seznam všech připojených hráčů\npocketmine.command.me.description=Udělá popsanou akci v chatu\npocketmine.command.op.description=Dá danému hráči status operátora\npocketmine.command.unban.player.description=Zruší ban danému hráči\npocketmine.command.unban.ip.description=Zruší ban dané IP adrese\npocketmine.command.save.description=Uloží data serveru na disk\npocketmine.command.saveoff.description=Vypne automatické ukládání serveru\npocketmine.command.saveon.description=Zapnuto automatické ukládání serveru\npocketmine.command.say.description=Napíše zprávu jako odesílatel\npocketmine.command.seed.description=Zobrazí seed světa\npocketmine.command.setworldspawn.description=Nastaví spawn světa. Pokud nejsou použity žádné souřadnice, budou použity souřadnice hráče.\npocketmine.command.spawnpoint.description=Nastaví spawn hráči\npocketmine.command.stop.description=zastaví server\npocketmine.command.tp.description=Teleportuje daného hráče (nebo vás) k jinému hráči nebo na jiné souřadnice\npocketmine.command.tell.description=Pošle soukromou zprávu vybranému hráči\npocketmine.command.whitelist.description=Spravuje list hráčů s povolením navštívit tento server\n\npocketmine.crash.create=Neopravitelná chyba shodila server. Vytvářím report o chybe\npocketmine.crash.error=Nemůžu vytvořit správu o chybě: {%0}\npocketmine.crash.submit=Prosím nahrajte \"{%0}\" do archivu chyb a pošli link na stránku ohlašování chyb. Dej co nejvíc informací co můžeš.\npocketmine.crash.archive=Zpráva o chybě byla nahrána do archivu chyb. Můžete se na ni podívat na {%0} nebo použít ID#{%1}.\n\npocketmine.debug.enable=LevelDB podpora zapnuta\n\npocketmine.player.invalidMove={%0} se hýbe špatně!\npocketmine.player.logIn={%0}[/{%1}:{%2}] se připojil do hry s entitou id {%3} v ({%4},{%5},{%6},{%7})\npocketmine.player.logOut={%0}[/{%1}:{%2}] se odpojil kůli {%3}\npocketmine.player.invalidEntity={%0} umřel na útok neznámého moba\n\npocketmine.plugin.load=Načítání {%0}\npocketmine.plugin.enable=Povolení {%0}\npocketmine.plugin.disable=Zakázání {%0}\npocketmine.plugin.restrictedName=Omezené méno\npocketmine.plugin.incompatibleAPI=Nekompatibilní API\npocketmine.plugin.unknownDependency=Neznámá závislost\npocketmine.plugin.circularDependency=oběžná závislost detekována\npocketmine.plugin.genericLoadError=Nemůžu načíst plugin '{%0}'\npocketmine.plugin.spacesDiscouraged=Plugin '{%0}' používá mezery ve svém jménu, to nejde\npocketmine.plugin.loadError=Nemůžu načíst plugin '{%0}':{%1}\npocketmine.plugin.duplicateError=Nemůžu načíst plugin '{%0}':plugin existuje\npocketmine.plugin.fileError=Nemůžu načíst '{%0}' ve složce  '{%1}':{%2}\npocketmine.plugin.commandError=Nemůžu načíst příkaz {%0} pro plugin {%1}\npocketmine.plugin.aliasError=Nemůžu načíst alias {%0} pro plugin {%1}\npocketmine.plugin.deprecatedEvent=Plugin '{%0}' registroval poslouchač pro '{%1}' na metodě '{%2}', ale event. není praktikován.\npocketmine.plugin.eventError=\"Nemůžu předělat event '{%0}' na'{%1}':{%2}na {%3}\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/chs.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers=\n#=\n# A message doesn't need to be there to be shown correctly on the client.=\n# Only messages shown in PocketMine itself need to be here=\n\nlanguage.name=中文(简体)\nlanguage.selected=设定 {%0} ({%1}) 为基本语言\n\nmultiplayer.player.joined={%0} 加入了游戏\nmultiplayer.player.left={%0} 离开了游戏\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0} 刚刚获得了成就 {%1}\n\ndisconnectionScreen.notAuthenticated=需要 Xbox 登录\ndisconnectionScreen.outdatedClient=客户端版本过旧！\ndisconnectionScreen.outdatedServer=服务器版本过旧！\ndisconnectionScreen.serverFull=服务器人数已满！\ndisconnectionScreen.noReason=与服务器联机中断\ndisconnectionScreen.invalidSkin=无效的皮肤！\ndisconnectionScreen.invalidName=用户名不符合规范！\n\ndeath.fell.accident.generic={%0} 发动了信仰之跃！\ndeath.attack.inFire={%0} 在火焰中升天\ndeath.attack.onFire={%0} 被烧死了\ndeath.attack.lava={%0} 试图在岩浆里游泳\ndeath.attack.inWall={%0} 在墙内窒息而死\ndeath.attack.drown={%0} 淹死了\ndeath.attack.cactus={%0} 被仙人掌刺死了\ndeath.attack.generic={%0} 无疾而终\ndeath.attack.explosion={%0} 被炸飞了\ndeath.attack.explosion.player={%0} 被 {%1} 炸死了\ndeath.attack.magic={%0} 被魔法杀死了\ndeath.attack.wither={%0} 凋零至死了\ndeath.attack.mob={%0} 被 {%1} 杀死了\ndeath.attack.player={%0} 被 {%1} 杀死了\ndeath.attack.player.item={%0} 被 {%1} 用 {%2} 杀死了\ndeath.attack.arrow={%0} 被 {%1} 射杀了\ndeath.attack.arrow.item={%0} 被 {%1} 用 {%2} 射杀了\ndeath.attack.fall={%0} 发动了信仰之跃！\ndeath.attack.outOfWorld={%0} 掉出了这个世界\n\ngameMode.survival=生存模式\ngameMode.creative=创造模式\ngameMode.adventure=冒险模式\ngameMode.spectator=旁观者模式\ngameMode.changed=您的游戏模式已更新\n\npotion.moveSpeed=速度\npotion.moveSlowdown=缓慢\npotion.digSpeed=急迫\npotion.digSlowDown=挖掘疲劳\npotion.damageBoost=力量\npotion.heal=瞬间治疗\npotion.harm=瞬间伤害\npotion.jump=跳跃提升\npotion.confusion=反胃\npotion.regeneration=生命恢复\npotion.resistance=抗性提升\npotion.fireResistance=防火\npotion.waterBreathing=水下呼吸\npotion.invisibility=隐身\npotion.blindness=失明\npotion.nightVision=夜视\npotion.hunger=饥饿\npotion.weakness=虚弱\npotion.poison=中毒\npotion.wither=凋零\npotion.healthBoost=生命提升\npotion.absorption=伤害吸收\npotion.saturation=饱和\n\ncommands.generic.exception=出现问题，请通知管理员修复。\ncommands.generic.permission=您没有权限使用此指令\ncommands.generic.notFound=未知的指令。请尝试用 /help 来显示指令列表。\ncommands.generic.player.notFound=找不到该玩家\ncommands.generic.usage=用法：{%0}\ncommands.generic.level=地图名\ncommands.generic.seed=种子\ncommands.generic.name=名称\ncommands.generic.generator=生成器名称\ncommands.generic.opt.missing=指令缺少参数，请确认后重新输入。\ncommands.generic.runingame=请在游戏中使用该命令。\n\ncommands.time.added=时间增加了 {%0}\ncommands.time.set=时间设定为 {%0}\ncommands.time.query=现在时间是 {%0}\n\ncommands.me.usage=/me <action ...>\n\ncommands.give.item.notFound=ID为 {%0} 的物品并不存在\ncommands.give.success=将 {%0} * {%1} 给 {%2}\ncommands.give.tagError=数据格式不正确: {%0}\n\ncommands.effect.usage=/effect <玩家名称> <效果> [秒数] [倍数] [隐藏粒子] 或 /effect <玩家名称> clear\ncommands.effect.notFound=然而ID为 {%0} 的特殊效果并不存在\ncommands.effect.success=对 {%3} 加上了 {%4} 秒的 {%0} (ID {%1}) * {%2}\ncommands.effect.success.removed=从 {%1} 身上移除了 {%0}\ncommands.effect.success.removed.all=已解除 {%0} 身上所有特殊状态\ncommands.effect.failure.notActive=无法从 {%1} 身上移除 {%0}，因为其身上无此效果\ncommands.effect.failure.notActive.all=无法移除效果，因为 {%0} 身上没有任何效果\n\ncommands.enchant.noItem=目标没有手持一样物品\ncommands.enchant.notFound=没有一个附魔ID为 {%0}\ncommands.enchant.success=附魔完成\ncommands.enchant.cantEnchant=这件物品不能被附魔！\ncommands.enchant.usage=/enchant <玩家名称> <附魔ID> [物品等级]\ncommands.particle.success=正在应用 {%0} 效果 {%1} 次\ncommands.particle.notFound=未知的效果名称 {%0}\ncommands.players.usage=/list\ncommands.players.list=There are {%0}/{%1} players online:\ncommands.kill.successful=已删除 {%0}\ncommands.banlist.ips=共有 {%0} 个被封锁的 IP 地址：\ncommands.banlist.players=共有 {%0} 个被封锁的玩家：\ncommands.banlist.cids=共有 {%0} 禁止的 CIDs:\ncommands.banlist.usage=/banlist [ips|players|cids]\ncommands.defaultgamemode.usage=/defaultgamemode <模式>\ncommands.defaultgamemode.success=服务器的默认游戏模式为 {%0}\n\ncommands.op.success={%0} 获得管理员\ncommands.op.usage=/op <玩家名称>\n\ncommands.deop.success={%0} 移除管理员\ncommands.deop.usage=/deop <玩家名称>\n\ncommands.say.usage=/say <讯息...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=种子码：{%0}\n\ncommands.bancidbyname.success=封锁玩家 {%0} 的CID\ncommands.bancidbyname.usage=/bancidbyname <player>\n\ncommands.bancid.success=封锁CID: {%0}\ncommands.bancid.usage=/bancid <ClientID>\n\ncommands.unbancid.usage=/pardoncid <ClientID>\n\ncommands.ban.success=封锁玩家 {%0}\ncommands.ban.usage=/ban <玩家名称> [原因...] [时间(天)]\n\ncommands.unban.success=解锁玩家 {%0}\ncommands.unban.usage=/pardon <玩家名称>\n\ncommands.banip.invalid=您输入了一个无效的 IP 地址、玩家名称或不在在线\ncommands.banip.success=封锁 IP 地址 {%0} 。\ncommands.banip.success.players=封锁 IP 地址 {%0} 来自 {%1}\ncommands.banip.usage=/ban-ip <IP 地址|玩家名称> [原因 ...]\n\ncommands.unbanip.invalid=您输入了一个无效的 IP 地址\ncommands.unbanip.success=解除封锁 IP 地址 {%0}\ncommands.unbanip.usage=/pardon-ip <IP 地址>\n\ncommands.banipbyname.success=封锁玩家 {%0} 的IP\ncommands.banipbyname.usage=/banipbyname <player>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=开启地图自动存储功能\ncommands.save.disabled=关闭地图自动存储功能\ncommands.save.start=正在储存...\ncommands.save.success=世界储存完毕。\n\ncommand.setblock.usage=/setblock <x> <y> <z> <方块名称> [方块损害值]\ncommand.setblock.invalidBlock=无效的方块名称/ID\n\ncommands.stop.usage=/stop\ncommands.stop.start=服务器停止中\n\ncommands.kick.success={%0} 从游戏中被踢出\ncommands.kick.success.reason={%0} 从游戏中被踢出：{%1}\ncommands.kick.usage=/kick <玩家名称> [原因...]\n\ncommands.tp.success=传送 {%0} 至 {%1}\ncommands.tp.success.coordinates=传送 {%0} 至 {%1}，{%2}，{%3}\ncommands.tp.usage=/tp [玩家名称] <目标玩家> 或是 /tp [玩家名称] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=有 {%0} 人(全部 {%1 人) 为白名单玩家:\ncommands.whitelist.enabled=开启白名单\ncommands.whitelist.disabled=关闭白名单\ncommands.whitelist.reloaded=重置白名单\ncommands.whitelist.add.success=新增 {%0} 至白名单\ncommands.whitelist.add.usage=/whitelist add <玩家名称>\ncommands.whitelist.remove.success=从白名单删除 {%0}\ncommands.whitelist.remove.usage=/whitelist remove <玩家名称>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=设定自己的游戏模式为 {%3}\ncommands.gamemode.success.other=设定 {%1} 的游戏模式为 {%2}\ncommands.gamemode.usage=/gamemode <模式> [玩家名称]\ncommands.help.header=--- 查看帮助列表第 {%0} 页共 {%1} 页 (/help <page>) ---\ncommands.help.usage=/help [页数|指令名称]\ncommands.message.usage=/tell <玩家名称> <讯息...>\ncommands.message.sameTarget=您不能传送讯息给自己！\ncommands.xp.usage=/xp <经验值或等级+L> <玩家名称>\n\ncommands.difficulty.usage=/difficulty <难度>\ncommands.difficulty.success=设定游戏难度为 {%0}\n\ncommands.spawnpoint.usage=/spawnpoint [玩家名称] [<x> <y> <z>]\ncommands.spawnpoint.success=设定 {%0} 的重生点为 ({%1}，{%2}，{%3})\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=设定世界重生点为 ({%0}，{%1}，{%2})\n\ncommands.summon.usage=/summon [实体名] [<x> <y> <z>] [数据标签]\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=无法找到玩家数据 \"{%0}\"，创建新的配置文件\npocketmine.data.playerCorrupted=发现损坏的数据 \"{%0}\"，创建新的配置文件\npocketmine.data.playerOld=发现旧的玩家数据 \"{%0}\"，更新配置文件\npocketmine.data.saveError=无法储存 \"{%0}\" 的玩家数据：{%1}\npocketmine.level.notFound=无法找到 \"{%0}\" 地图\npocketmine.level.loadError=无法读取地图 \"{%0}\"：{%1}\npocketmine.level.generationError=无法产生地图 \"{%0}\"：{%1}\npocketmine.level.tickError=计算地图“{%0}”时出现错误∶{%1}\npocketmine.level.chunkUnloadError=移除一个区块时发生错误：{%0}\npocketmine.level.backgroundGeneration=正在于背景生成世界 “{%0}“ 的地形\npocketmine.level.defaultError=没有读取预设的地图\npocketmine.level.preparing=准备地图中... \"{%0}\"\npocketmine.level.unloading=正在移除地图 \"{%0}\"\npocketmine.server.start=正在启动支持 Minecraft：PE {%0} 版本的服务器\npocketmine.server.networkError=[网络] 停止接口 {%0} 由于 {%1}\npocketmine.server.networkStart=正在启动服务器在 {%0}:{%1}\npocketmine.server.info=此服务器正在运作 {%0} {%1} 版本 \"{%2}\" （API {%3}）\n\npocketmine.server.info.extended=此服务器正在运作 {%0} {%1} “{%2}” 执行 API 版本 {%3} 支持 Minecraft：PE {%4} （协议版本 {%5}）\npocketmine.server.info.extended1=本服务器正运行 {%0}{%1} (代号 \"{%2}\")\npocketmine.server.info.extended2=PHP 版本: {%0}\npocketmine.server.info.extended3=API: {%0} (iTX API 版本 {%1})\npocketmine.server.info.extended4=客户端: Minecraft PE {%0} (protocol 版本\n\npocketmine.server.license={%0} 根据 LGPL 许可发布\npocketmine.server.tickOverload=注意！服务器有超载的可能\npocketmine.server.startFinished=Done ({%0}s)！如需帮助，请输入 \"help\" 或 \"?\"\npocketmine.server.defaultGameMode=预设的游戏类型：{%0}\npocketmine.server.query.start=启动 GS4 状态监听器\npocketmine.server.query.info=设定 query 接口到 {%0}\npocketmine.server.query.running=Query 运作在 {%0}:{%1}\n\npocketmine.command.alias.illegal=不能注册别名 {%0}，因为它包含非法字符\npocketmine.command.alias.notFound=未能登记别称 {%0} ，因为它包含不存在的指令： {%1}\npocketmine.command.exception=于 {%1} 执行指令 “{%0}“ 时，出现了未被处理的错误： {%2}\n\npocketmine.command.plugins.description=获取在服务器上运行的插件列表\npocketmine.command.plugins.success=插件 ({%0})：{%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=重新读取服务器设定和插件\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=重新读取服务器...\npocketmine.command.reload.reloaded=重新读取完成\n\npocketmine.command.status.description=重新读取服务器的性能。\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=服务器状态\npocketmine.command.status.player=服务器人数:\npocketmine.command.status.days=天\npocketmine.command.status.hours=小时\npocketmine.command.status.minutes=分\npocketmine.command.status.seconds=秒\npocketmine.command.status.uptime=运行时间:\npocketmine.command.status.AverageTPS=平均TPS:\npocketmine.command.status.CurrentTPS=瞬时TPS:\npocketmine.command.status.Networkupload=网络上传:\npocketmine.command.status.Networkdownload=网络下载:\npocketmine.command.status.Threadcount=线程总数:\npocketmine.command.status.Mainmemory=线程总数:\npocketmine.command.status.Totalmemory=总内存:\npocketmine.command.status.Totalvirtualmemory=总虚拟内存:\npocketmine.command.status.Heapmemory=堆栈内存:\npocketmine.command.status.Maxmemorysystem=系统最大内存:\npocketmine.command.status.Maxmemorymanager=核心全局最大内存:\npocketmine.command.status.World=世界\npocketmine.command.status.chunks=区块,\npocketmine.command.status.entities=实体,\npocketmine.command.status.tiles=tiles.\npocketmine.command.status.Time=时间\npocketmine.command.status.ms=毫秒\n\npocketmine.command.gc.description=回收垃圾\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=垃圾回收结果\npocketmine.command.gc.chunks=区块:\npocketmine.command.gc.entities=实体:\npocketmine.command.gc.tiles=方块:\npocketmine.command.gc.cycles=循环:\npocketmine.command.gc.memory=内存释放:\n\npocketmine.command.timings.description=纪录计时数据，以检视服务器的性能。\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=启用定时和重启\npocketmine.command.timings.disable=停用定时\npocketmine.command.timings.timingsDisabled=启用定时工具透过 /timings on\npocketmine.command.timings.reset=定时重启\npocketmine.command.timings.pasteError=已记录在事件记录文件中\npocketmine.command.timings.timingsUpload=计时数据已被上载至 {%0}\npocketmine.command.timings.timingsRead=你可以在 {%0} 阅读计时结果\npocketmine.command.timings.timingsWrite=计时数据已被储存至 {%0}\npocketmine.command.version.description=检视此服务器 (及其使用的插件) 的版本\npocketmine.command.version.usage=/version [插件名称]\npocketmine.command.version.noSuchPlugin=该服务器没有运行任何叫这个名称的插件。使用 /plugins 来获得插件列表。\npocketmine.command.give.description=给指定玩家一定数量的物品\npocketmine.command.give.usage=/give <玩家名称> <项目[:损毁程度]> [数量]\npocketmine.command.kill.description=自杀或杀死其他玩家\npocketmine.command.kill.usage=/kill [玩家名称]\npocketmine.command.particle.description=加入粒子效果至世界\npocketmine.command.particle.usage=/particle <玩家名称> <x> <y> <z> <xd> <yd> <zd> [数量] [数据值]\npocketmine.command.time.description=更改每个世界的时间\npocketmine.command.time.usage=/time <set|add> <数值> 或 /time <start|stop|query>\npocketmine.command.bancidbyname.description=禁止指定玩家的设备 ID\npocketmine.command.bancid.description=禁止指定的设备 ID\npocketmine.command.banipbyname.description=禁止指定玩家的 IP\npocketmine.command.ban.player.description=禁止指定的玩家使用此服务器\npocketmine.command.ban.ip.description=禁止指定的 IP 地址使用此服务器\npocketmine.command.banlist.description=查看来自该服务器禁止的所有玩家\npocketmine.command.defaultgamemode.description=设定默认的游戏模式\npocketmine.command.deop.description=移除指定玩家的管理员权限\npocketmine.command.difficulty.description=设定游戏的难易度\npocketmine.command.enchant.description=把物件附魔\npocketmine.command.effect.description=增加/减少玩家身上的效果\npocketmine.command.gamemode.description=改变玩家到一个特定的游戏模式\npocketmine.command.help.description=显示帮助列表\npocketmine.command.kick.description=从服务器中删除指定玩家\npocketmine.command.list.description=显示在线玩家列表\npocketmine.command.me.description=于聊天中作出指定的动作\npocketmine.command.op.description=赋予指定玩家管理员权限\npocketmine.command.unban.cid.description=允许指定 CID 使用此服务器\npocketmine.command.unban.player.description=允许指定玩家使用此服务器\npocketmine.command.unban.ip.description=允许指定 IP 地址使用此服务器\npocketmine.command.save.description=储存服务器到磁盘上\npocketmine.command.saveoff.description=停用自动储存服务器\npocketmine.command.saveon.description=启用自动储存服务器\npocketmine.command.say.description=以发送指令者身份广播指定的讯息\npocketmine.command.seed.description=显示世界种子码\npocketmine.command.setworldspawn.description=设定一个世界重生点。未指定坐标，将使用玩家的坐标。\npocketmine.command.spawnpoint.description=设定玩家重生点\npocketmine.command.stop.description=关闭服务器\npocketmine.command.tp.description=传送指定玩家（或是自己）到另一位玩家或坐标\npocketmine.command.tell.description=传送私讯给指定玩家\npocketmine.command.xp.description=给指定玩家增加经验值或等级\npocketmine.command.summon.description=召唤指定的实体于玩家位置或指定位置\nocketmine.command.fill.description=填充了指定方块\npocketmine.command.setblock.description=将一个方块更改为另一个方块\n\npocketmine.command.weather.description=设置指定地图的天气\npocketmine.command.weather.usage=/weather <世界名 天气值|天气值>\npocketmine.command.weather.changed=成功设置世界{%0}的天气！\npocketmine.command.weather.noregistered=世界{%0}没有注册到天气管理器！\npocketmine.command.weather.invalid=无效的天气！请输入天气类型 0,1,2,3\npocketmine.command.weather.wrong=缺少参数！\npocketmine.command.weather.invalid.level=错误的地图名\n\npocketmine.command.whitelist.description=管理员允许使用此服务器的玩家列表\npocketmine.crash.create=一个未知的错误发生了，使服务器崩溃。正在储存错误报告。\npocketmine.crash.error=未能储存错误报告∶{%0}\npocketmine.crash.submit=请上载档案“{%0}”至在线崩溃储存库。请尽量提供更多数据。\npocketmine.crash.archive=错误报告已经上传到在线崩溃储存库。你可以在{%0} 查看到它或使用ID #{%1}。\npocketmine.debug.enable=启用 LevelDB 支援\npocketmine.player.invalidMove={%0} 行动可疑！\npocketmine.player.logIn={%0}[/{%1}:{%2}] [ClientID: {%3}] logged in with entity id {%4} at ({%5}, {%6}, {%7}, {%8})\npocketmine.player.logOut={%0}[/{%1}:{%2}] logged out due to {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] 被传送到了 {%3}\npocketmine.player.invalidEntity={%0} 尝试攻击一个无效的实体\npocketmine.plugin.load=读取中... {%0}\npocketmine.plugin.enable=开启中... {%0}\npocketmine.plugin.disable=关闭中... {%0}\npocketmine.plugin.restrictedName=受限的名称\npocketmine.plugin.incompatibleAPI=不兼容的API版本\npocketmine.plugin.unknownDependency=本插件无法单独使用\npocketmine.plugin.circularDependency=检测出循环依赖\npocketmine.plugin.genericLoadError=无法读取插件 '{%0}'\npocketmine.plugin.spacesDiscouraged=插件 '{%0}' 在名称中使用了空格，不建议这样做\npocketmine.plugin.loadError=无法读取插件 '{%0}'：{%1}\npocketmine.plugin.duplicateError=无法读取插件 '{%0}'：已有相同插件\npocketmine.plugin.fileError=无法读取在 '{%1}' 文件夹中的 '{%0}'：{%2}\npocketmine.plugin.commandError=无法读取 {%1} 插件的 {%0} 指令\npocketmine.plugin.aliasError=无法读取 {%1} 插件的 {%0} 别名\npocketmine.plugin.deprecatedEvent=插件 '{%0}' 已经使用 '{%2}' 方法注册了一个在 '{%1}' 的监听器，但是该事件已过时。\npocketmine.plugin.eventError=\"无法处理事件 '{%0}' 至 '{%1}'：{%2} 在 {%3} 上\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/deu.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers\n#\n# A message doesn't need to be there to be shown correctly on the client.\n# Only messages shown in PocketMine itself need to be here\n\nlanguage.name=Deutsch\nlanguage.selected={%0} ({%1}) als Basissprache ausgewählt\n\nmultiplayer.player.joined={%0} hat das Spiel betreten\nmultiplayer.player.left={%0} hat das Spiel verlassen\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0} hat gerade den Erfolg {%1} erzielt\n\ndisconnectionScreen.notAuthenticated=Xbox Anmeldung notwendig\ndisconnectionScreen.outdatedClient=Veralteter Client!\ndisconnectionScreen.outdatedServer=Veralteter Server!\ndisconnectionScreen.serverFull=Server ist voll!\ndisconnectionScreen.noReason=Verbindung zum Server getrennt\ndisconnectionScreen.invalidSkin=Ungültiger Skin!\ndisconnectionScreen.invalidName=Ungültiger Name!\n\ndeath.fell.accident.generic={%0} fiel aus zu großer Höhe\ndeath.attack.inFire={%0} ging in Flammen auf\ndeath.attack.onFire={%0} verbrannte\ndeath.attack.lava={%0} versuchte in Lava zu schwimmen\ndeath.attack.inWall={%0} wurde lebendig begraben\ndeath.attack.drown={%0} ertrank\ndeath.attack.cactus={%0} wurde zu Tode gestochen\ndeath.attack.generic={%0} starb\ndeath.attack.explosion={%0} wurde in die Luft gesprengt\ndeath.attack.explosion.player={%0} wurde durch {%1} in die Luft gesprengt\ndeath.attack.magic={%0} wurde durch Magie getötet\ndeath.attack.wither={%0} verdorrte\ndeath.attack.mob={%0} wurde von {%1} erschlagen\ndeath.attack.player={%0} wurde von {%1} erschlagen\ndeath.attack.player.item={%0} wurde von {%1} mit {%2} erschlagen\ndeath.attack.arrow={%0} wurde von {%1} erschossen\ndeath.attack.arrow.item={%0} wurde von {%1} mit {%2} erschossen\ndeath.attack.fall={%0} fiel der Schwerkraft zum Opfer\ndeath.attack.outOfWorld={%0} fiel aus der Welt\n\ngameMode.survival=Überlebensmodus\ngameMode.creative=Kreativmodus\ngameMode.adventure=Abenteuermodus\ngameMode.spectator=Zuschauermodus\ngameMode.changed=Dein Spielmodus wurde aktualisiert\n\npotion.moveSpeed=Schnelligkeit\npotion.moveSlowdown=Langsamkeit\npotion.digSpeed=Eile\npotion.digSlowDown=Langsames Abbauen\npotion.damageBoost=Stärke\npotion.heal=Direktheilung\npotion.harm=Direktschaden\npotion.jump=Sprungkraft\npotion.confusion=Übelkeit\npotion.regeneration=Regeneration\npotion.resistance=Resistenz\npotion.fireResistance=Feuerresistenz\npotion.waterBreathing=Unterwasser-Atmung\npotion.invisibility=Unsichtbarkeit\npotion.blindness=Blindheit\npotion.nightVision=Nachtsicht\npotion.hunger=Hunger\npotion.weakness=Schwäche\npotion.poison=Gift\npotion.wither=Dürre\npotion.healthBoost=Lebenserweiterung\npotion.absorption=Absorption\npotion.saturation=Sättigung\n\ncommands.generic.exception=Ein unbekannter Fehler trat auf, während versucht wurde, diesen Befehl auszufüren\ncommands.generic.permission=Du hast keine Berechtigung, diesen Befehl auszuführen\ncommands.generic.notFound=Unbekannter Befehl. Versuche /help für eine Liste von Befehlen\ncommands.generic.player.notFound=Dieser Spieler kann nicht gefunden werden\ncommands.generic.usage=Aufruf: {%0}\ncommands.generic.level=Weltname\ncommands.generic.seed=Startwert\ncommands.generic.name=Name\ncommands.generic.generator=Generator\ncommands.generic.opt.missing=Notwendige Eigenschaft fehlt, bitte überprüfen und neu eingeben.\ncommands.generic.runingame=Dieser Befehl kann nur im Spiel ausgeführt werden.\n\ncommands.time.added={%0} zur Zeit hinzugefügt\ncommands.time.set=Setzte die Zeit auf {%0}\ncommands.time.query=Zeit: {%0}\n\ncommands.me.usage=/me <Aktion ...>\n\ncommands.give.item.notFound=Es gibt kein Item mit dem Namen {%0}\ncommands.give.success={%0} * {%1} an {%2} gegeben\ncommands.give.tagError=Parsen des Datatags fehlgeschlagen: {%0}\n\ncommands.effect.usage=/effect <Spieler> <Effekt> [Sekunden] [Verstärker] [versteckePartikel] ODER /effect <Spieler> clear\ncommands.effect.notFound=Es gibt keinen Mob-Effekt mit der ID {%0}\ncommands.effect.success={%0} (ID {%1}) * {%2} für {%4} Sekunden an {%3} gegeben\ncommands.effect.success.removed={%0} von {%1} genommen\ncommands.effect.success.removed.all=Alle Effekte von {%0} genommen\ncommands.effect.failure.notActive=Konnte {%0} nicht von {%1} nehmen, da der Effekt nicht vorhanden war\ncommands.effect.failure.notActive.all=Konnte keinen Effekt von {%0} nehmen, da kein Effekt vorhanden war\n\ncommands.enchant.noItem=Dieser Spieler hält keinen Gegenstand\ncommands.enchant.notFound=Es gibt keine Verzauberung mit der ID {%0}\ncommands.enchant.success=Verzauberung erfolgreich\ncommands.enchant.cantEnchant=Die gewählte Verzauberung kann diesem Gegenstand nicht hinzugefügt werden.\ncommands.enchant.usage=/enchant <Spieler> <Verzauberungs-ID> [Level]\ncommands.particle.success=Erzeuge {%1}-fach den Partikeleffekt {%0}\ncommands.particle.notFound=Unbekannter Partikeleffekt {%0}\ncommands.players.usage=/list\ncommands.players.list=Es sind {%0}/{%1} Spieler online:\ncommands.kill.successful={%0} wurde getötet\ncommands.banlist.ips=Es sind insgesamt {%0} IP-Adressen gebannt:\ncommands.banlist.players=Es sind insgesamt {%0} Spieler gebannt:\ncommands.banlist.cids=Es sind insgesamt {%0} CIDs gebannt:\ncommands.banlist.usage=/banlist [ips|players|cids]\ncommands.defaultgamemode.usage=/defaultgamemode <Spielmodus>\ncommands.defaultgamemode.success=Der Standart-Spielmodus der Welt ist jetzt {%0}\n\ncommands.op.success={%0} wurde zum Operator ernannt\ncommands.op.usage=/op <Spieler>\n\ncommands.deop.success={%0} ist jetzt kein Operator mehr\ncommands.deop.usage=/deop <Spieler>\n\ncommands.say.usage=/say <Nachricht ...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Startwert: {%0}\n\ncommands.bancidbyname.success=CID des Spielers {%0} wurde gebannt\ncommands.bancidbyname.usage=/bancidbyname <Spieler>\n\ncommands.bancid.success=CID {%0} wurde gebannt\ncommands.bancid.usage=/bancid <ClientID>\n\ncommands.unbancid.usage=/pardoncid <ClientID>\ncommands.unbancid.success=CID {%0} wurde entbannt\n\ncommands.ban.success=Spieler {%0} wurde gebannt\ncommands.ban.usage=/ban <Spieler> [Grund ...] [Zeit(Tag)]\n\ncommands.unban.success=Spieler {%0} wurde entbannt\ncommands.unban.usage=/pardon <Spieler>\n\ncommands.banip.invalid=Du hast eine ungültige IP-Adresse angegeben oder einen Spieler, der nicht online ist\ncommands.banip.success=IP-Adresse {%0} wurde gebannt\ncommands.banip.success.players=IP-Adresse {%0}, die zu {%1} gehört, wurde gebannt\ncommands.banip.usage=/ban-ip <IP-Adresse|Spieler> [Grund ...]\n\ncommands.unbanip.invalid=Du hast eine ungültige IP-Adresse angegeben\ncommands.unbanip.success=IP-Adresse {%0} wurde entbannt\ncommands.unbanip.usage=/pardon-ip <IP-Adresse>\n\ncommands.banipbyname.success=IP-Adresse des Spielers {%0} wurde gebannt\ncommands.banipbyname.usage=/banipbyname <Spieler>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=Automatische Welt-Speicherung aktiviert\ncommands.save.disabled=Automatische Welt-Speicherung deaktiviert\ncommands.save.start=Speichern...\ncommands.save.success=Welt wurde gespeichert\n\ncommands.setblock.usage=/setblock <x> <y> <z> <Blockname> [Schaden]\ncommand.setblock.invalidBlock=Blockname/ID ist ungültig\n\ncommands.stop.usage=/stop\ncommands.stop.start=Server wird beendet\n\ncommands.kick.success={%0} wurde aus dem Spiel geworfen\ncommands.kick.success.reason={%0} wurde aus dem Spielgeworfen: '{%1}'\ncommands.kick.usage=/kick <Spieler> [Grund ...]\n\ncommands.tp.success={%0} wurde zu {%1} teleportiert\ncommands.tp.success.coordinates={%0} wurde zu {%1}, {%2}, {%3} teleportiert\ncommands.tp.usage=/tp [Spieler] <anderer Spieler> ODER /tp [Spieler] <x> <y> <z> [<y-Rotation> <x-Rotation>]\n\ncommands.whitelist.list=Es sind insgesamt {%0} (von {%1} hier gewesenen) Spieler in der Whitelist:\ncommands.whitelist.enabled=Whitelist aktiviert\ncommands.whitelist.disabled=Whitelist deaktiviert\ncommands.whitelist.reloaded=Whitelist neu eingelesen\ncommands.whitelist.add.success={%0} zur Whitelist hinzugefügt\ncommands.whitelist.add.usage=/whitelist add <Spieler>\ncommands.whitelist.remove.success={%0} von der Whitelist entfernt\ncommands.whitelist.remove.usage=/whitelist remove <Spieler>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=Eigenen Spielmodus auf {%2} gesetzt\ncommands.gamemode.success.other={%1}'s Spielmodus auf {%2} gesetzt\ncommands.gamemode.usage=/gamemode <Spielmodus> [Spieler]\ncommands.help.header=--- Zeige Hilfe-Seite {%0} von {%1} (/help <Seite>) ---\ncommands.help.usage=/help [Seite|Befehl]\ncommands.message.usage=/tell <Spieler> <private Nachricht ...>\ncommands.message.sameTarget=Du kannst keine private Nachricht an dich selbst schicken!\n\ncommands.difficulty.usage=/difficulty <neuer Schwierigkeitsgrad>\ncommands.difficulty.success=Schwierigkeitsgrad auf {%0} gesetzt\n\ncommands.spawnpoint.usage=/spawnpoint [Spieler] [<x> <y> <z>]\ncommands.spawnpoint.success={%0}'s Spawnpunkt wurde auf ({%1}, {%2}, {%3}) gesetzt\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=Der Welt-Spawn wurde auf ({%0}, {%1}, {%2}) gesetzt\n\ncommands.summon.usage=/summon [Entity] [<x> <y> <z>] [NBTTag]\n\ncommands.xp.failure.withdrawXp=Einem Spieler können keine negativen Erfahrungspunkte gegeben werden\ncommands.xp.success={%0} Erfahrungspunkte an Spieler {%1} gegeben\ncommands.xp.success.levels={%0} Level Erfahrung an {%1} gegeben\ncommands.xp.success.negative.levels={%0} Level Erfahrung von {%1} genommen\ncommands.xp.usage=/xp <Anzahl> [Spieler] ODER /xp <Anzahl>L [Spieler]\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=Keine Spielerdaten für \"{%0}\" gefunden, erstelle neues Profil\npocketmine.data.playerCorrupted=Defekte Daten für Spieler \"{%0}\" gefunden, erstelle neues Profil\npocketmine.data.playerOld=Alte Spielerdaten für \"{%0}\" gefunden, aktualisiere Profil\npocketmine.data.saveError=Konnte Spieler \"{%0}\" nicht speichern: {%1}\npocketmine.level.notFound=Welt \"{%0}\" nicht gefunden\npocketmine.level.loadError=Welt \"{%0}\" konnte nicht geladen werden: {%1}\npocketmine.level.generationError=Welt \"{%0}\" konnte nicht generiert werden: {%1}\npocketmine.level.tickError=Welt \"{%0}\" konnte nicht getickt werden: {%1}\npocketmine.level.chunkUnloadError=Fehler beim Entladen eines Chunks: {%0}\npocketmine.level.backgroundGeneration=Spawn-Landschaft wird für die Welt \"{%0}\" im Hintergrund generiert\npocketmine.level.defaultError=Es wurde keine Standard-Welt geladen\npocketmine.level.preparing=Welt \"{%0}\" wird vorbereitet\npocketmine.level.unloading=Welt \"{%0}\" wird entladen\npocketmine.server.start=Starte Minecraft: PE server version {%0}\npocketmine.server.networkError=[Netzwerk] Schnittstelle {%0} wurde wegen {%1} beendet\npocketmine.server.networkStart=Öffne Server auf {%0}:{%1}\npocketmine.server.info=Dieser Server läuft mit Version {%0}{%1} \"{%2}\" (API {%3})\n\npocketmine.server.info.extended.title=-----Server Information-----\npocketmine.server.info.extended1=Dieser Server läuft mit Version {%0}{%1} (Codename \"{%2}\")\npocketmine.server.info.extended2=PHP Version: {%0}\npocketmine.server.info.extended3=API: {%0} (iTX API Version {%1})\npocketmine.server.info.extended4=Zielclient: Minecraft PE {%0} (Protokollversion {%1})\n\npocketmine.server.license={%0} wurde unter der GPL Lizenz Version 3 und neuer herausgegeben\npocketmine.server.tickOverload=Server kann nicht mehr am Laufen gehalten werden! Ist der Server überladen?\npocketmine.server.startFinished=Fertig ({%0}s)! Für Hilfe kannst du \"help\" oder \"?\" eingeben\npocketmine.server.defaultGameMode=Standard-Spielmodus: {%0}\npocketmine.server.query.start=Starte GS4 Status-Listener\npocketmine.server.query.info=Setze Query-Port auf {%0}\npocketmine.server.query.running=Query läuft auf {%0}:{%1}\n\npocketmine.command.alias.illegal=Alias {%0} konnte nicht registriert werden, da er unzulässige Zeichen enthält\npocketmine.command.alias.notFound=Alias {%0} konnte nicht registriert werden, da er Befehle enthält, die nicht existieren: {%1}\npocketmine.command.exception=Unbehandelte Ausnahme bei Ausführung des Befehls '{%0}' in {%1}: {%2}\n\npocketmine.command.plugins.description=Zeigt eine Liste aller auf dem Server laufenden Plugins\npocketmine.command.plugins.success=Plugins ({%0}): {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=Lädt die Serverkonfiguration und Plugins neu ein\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Server wird neu geladen...\npocketmine.command.reload.reloaded=Neuladen des Servers abgeschlossen\n\npocketmine.command.status.description=Zeigt die aktuelle Serverauslastung an.\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=Server-Status\npocketmine.command.status.player=Spieleranzahl:\npocketmine.command.status.days=Tage\npocketmine.command.status.hours=Stunden\npocketmine.command.status.minutes=Minuten\npocketmine.command.status.seconds=Sekunden\npocketmine.command.status.uptime=Laufzeit:\npocketmine.command.status.AverageTPS=Durchschnittliche TPS:\npocketmine.command.status.CurrentTPS=Aktuelle TPS:\npocketmine.command.status.Networkupload=Netzwerk Upload:\npocketmine.command.status.Networkdownload=Netzwerk Download:\npocketmine.command.status.Threadcount=Anzahl der Threads:\npocketmine.command.status.Mainmemory=Speicher des Main-Threads:\npocketmine.command.status.Totalmemory=Speicher gesamt:\npocketmine.command.status.Totalvirtualmemory=Virtueller Speicher gesamt:\npocketmine.command.status.Heapmemory=Heap-Speicher:\npocketmine.command.status.Maxmemorysystem=Maximaler Speicher (System):\npocketmine.command.status.Maxmemorymanager=Maximaler Speicher (Manager):\npocketmine.command.status.World=Welt\npocketmine.command.status.chunks=Chunks,\npocketmine.command.status.entities=Entities,\npocketmine.command.status.tiles=Tiles.\npocketmine.command.status.Time=Zeit\npocketmine.command.status.ms=ms\n\npocketmine.command.gc.description=Startet die Tasks zur automatischen Speicherbereinigung (garbage collection)\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=Sammelbericht\npocketmine.command.gc.chunks=Chunks:\npocketmine.command.gc.entities=Entities:\npocketmine.command.gc.tiles=Tiles:\npocketmine.command.gc.cycles=Zyklen:\npocketmine.command.gc.memory=Freigegebener Speicher:\n\npocketmine.command.timings.description=Nimmt Zeitmessungen auf, um die Severauslastung zu ermitteln.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=Timings & Reset aktiviert\npocketmine.command.timings.disable=Timings deaktiviert\npocketmine.command.timings.timingsDisabled=Bitte aktiviere die Timings, indem du '/timings on' eingibst\npocketmine.command.timings.reset=Timings zurückgesetzt\npocketmine.command.timings.pasteError=Während der Übernahme des Berichts trat ein Fehler auf\npocketmine.command.timings.timingsUpload=Timings wurden hochgeladen zu {%0}\npocketmine.command.timings.timingsRead=Du kannst dir die Ergebnisse hier anschauen {%0}\npocketmine.command.timings.timingsWrite=Timings wurden gespeichert in {%0}\npocketmine.command.version.description=Ermittelt die Version des Servers inklusive jedem verwendeten Plugin.\npocketmine.command.version.usage=/version [Plugin-Name]\npocketmine.command.version.noSuchPlugin=Auf diesem Server läuft kein Plugin mit diesem Namen. Mit /plugins kannst du dir eine Liste aller Plugins anzeigen lassen.\npocketmine.command.give.description=Gibt dem angegebenen Spieler eine bestimmte Anzahl an Gegenständen (Items)\npocketmine.command.give.usage=/give <Spieler> <Gegenstand[:Schaden]> [Anzahl] [NBT-Daten...]\npocketmine.command.kill.description=Tötet dich selbst oder andere Spieler\npocketmine.command.kill.usage=/kill [Spieler]\npocketmine.command.particle.description=Fügt einer Welt Partikel hinzu\npocketmine.command.particle.usage=/particle <Name> <x> <y> <z> <xd> <yd> <zd> [Anzahl] [Wert]\npocketmine.command.time.description=Ändert in allen Welten die Zeit\npocketmine.command.time.usage=/time <set|add> <Wert> ODER /time <start|stop|query>\npocketmine.command.bancidbyname.description=Verhindet, dass sich die durch den Spielernamen ermittelte CID mit dem Server verbinden kann\npocketmine.command.bancid.description=Verhindert, dass sich die angegebene CID mit dem Server verbinden kann\npocketmine.command.banipbyname.description=Verhindet, dass sich die durch den Spielernamen ermittelte IP-Adresse mit dem Server verbinden kann\npocketmine.command.ban.player.description=Verhindert, dass sich der angegebene Spieler mit dem Server verbinden kann\npocketmine.command.ban.ip.description=Verhindert, dass sich die angegebene IP-Adresse mit dem Server verbinden kann\npocketmine.command.banlist.description=Zeigt alle Spieler an, die von diesem Server gebannt wurden\npocketmine.command.defaultgamemode.description=Legt den Standard-Spielmodus fest\npocketmine.command.deop.description=Nimmt dem angegebenen Spieler den Operator-Status\npocketmine.command.difficulty.description=Legt den Schwierigkeitsgrad des Spiels fest\npocketmine.command.enchant.description=Fügt Gegenständen Verzauberungen hinzu\npocketmine.command.effect.description=Fügt Spielern Effekte hinzu oder entfernt sie\npocketmine.command.gamemode.description=Ändert den Spiemodus eines Spielers wie angegeben\npocketmine.command.help.description=Zeigt das Hilfe-Menü an\npocketmine.command.kick.description=Trennt den angegebenen Spieler vom Server\npocketmine.command.list.description=Zeigt alle Spieler an, die gerade online sind\npocketmine.command.me.description=Stellt die angegebene Aktion im Chat dar\npocketmine.command.op.description=Gibt dem angegebenen Spieler den Operator-Status\npocketmine.command.unban.cid.description=Erlaubt der angegebenen CID, sich wieder mit dem Server zu verbinden\npocketmine.command.unban.player.description=Erlaubt dem angegebenen Spieler, sich wieder mit dem Server zu verbinden\npocketmine.command.unban.ip.description=Erlaubt der angegebenen IP-Adresse, sich wieder mit dem Server zu verbinden\npocketmine.command.save.description=Speichert den Server im Dateisystem\npocketmine.command.saveoff.description=Deaktiviert das automatische Speichern des Servers\npocketmine.command.saveon.description=Aktiviert das automatische Speichern des Servers\npocketmine.command.say.description=Sendet die eingegebene Nachricht im Namen des Absenders an alle Spieler\npocketmine.command.seed.description=Zeigt den Startwert (seed) der Welt\npocketmine.command.setworldspawn.description=Legt den Spawnpunkt einer Welt fest. Werden keine Koordinaten angegeben, werden die des Spielers verwendet.\npocketmine.command.spawnpoint.description=Legt den Spawnpunkt eines Spielers fest.\npocketmine.command.stop.description=Beendet den Server\npocketmine.command.tp.description=Teleportiert den angegebenen Spieler (oder dich selbst) zu einem anderen Spieler oder Koordinaten\npocketmine.command.tell.description=Sendet dem angegebenen Spieler eine private Nachricht\npocketmine.command.xp.description=Fügt dem angegebenen Spieler Erfahrungspunkte oder -level hinzu\npocketmine.command.summon.description=Läßt ein Wesen am Ort des Spielers oder einem angegebenen Ort erscheinen\npocketmine.command.fill.description=Füllt einen bestimmten Auswahlbereich mit Blöcken\npocketmine.command.setblock.description=Ersetzt einen Block durch einen anderen Block\n\npocketmine.command.weather.description=Legt das Wetter für eine Welt fest\npocketmine.command.weather.usage=/weather <Weltname Wetter|Wetter (rain|sunny|clear)>\npocketmine.command.weather.changed=Das Wetter in der Welt {%0} wurde erfolgreich gewechselt!\npocketmine.command.weather.noregistered=Die Welt {%0} wurde nicht beim WetterManager registriert.\npocketmine.command.weather.invalid=Ungültiges Wetter.(0,1,2,3)\npocketmine.command.weather.wrong=Falsche Parameter.\npocketmine.command.weather.invalid.level=Ungültiger Weltname.\n\npocketmine.command.whitelist.description=Verwaltet die Liste der Spieler, denen es erlaubt ist, den Server zu benutzen\npocketmine.crash.create=Es ist ein nicht behebbarer Fehler aufgetreten und der Server ist abgestürzt. Erstelle einen Crash-Dump...\npocketmine.crash.error=Crash-Dump konnte nicht erstellt werden: {%0}\npocketmine.crash.submit=Bitte lade die Datei \"{%0}\" in das Crash-Archiv hoch und übermittel den Link auf der Bug-Reporting Seite. Gib so viele Informationen an wie du kannst.\npocketmine.crash.archive=Der Crash-Dump wurde automatisch in das Crash-Archiv übertragen. Du kannst in unter {%0} einsehen oder die ID #{%1} verwenden.\npocketmine.debug.enable=LevelDB Unterstützung aktiviert\npocketmine.player.invalidMove={%0} bewegte sich falsch!\npocketmine.player.logIn={%0}[/{%1}:{%2}] [ClientID: {%3}] loggte sich mit der Entity-ID {%4} bei ({%5}, {%6}, {%7}, {%8}) ein\npocketmine.player.logOut={%0}[/{%1}:{%2}] loggte sich wegen {%3} aus\npocketmine.player.transferred={%0}[/{%1}:{%2}] wurde transferiert zu {%3}\npocketmine.player.invalidEntity={%0} versuchte, eine ungültige Entity zu attackieren\npocketmine.plugin.load=Lade {%0}\npocketmine.plugin.enable=Aktiviere {%0}\npocketmine.plugin.disable=Deaktiviere {%0}\npocketmine.plugin.restrictedName=Verbotener Name\npocketmine.plugin.incompatibleAPI=Inkompatible API-Version\npocketmine.plugin.unknownDependency=Unbekannte Abhängigkeit\npocketmine.plugin.circularDependency=Zirkuläre Abhängigkeit erkannt\npocketmine.plugin.genericLoadError=Plugin '{%0}' konnte nicht geladen werden\npocketmine.plugin.spacesDiscouraged=Plugin '{%0}' verwendet Leerzeichen im Namen, was nicht erlaubt ist\npocketmine.plugin.loadError=Plugin '{%0}' konnte nicht geladen werden: {%1}\npocketmine.plugin.duplicateError=Plugin '{%0}' konnte nicht geladen werden: Plugin existiert bereits\npocketmine.plugin.fileError=Konnte '{%0}' im Ordner '{%1}' nicht laden: {%2}\npocketmine.plugin.commandError=Der Befehl {%0} konnte für das Plugin {%1} nicht geladen werden\npocketmine.plugin.aliasError=Alias {%0} konnte für Plugin {%1} nicht geladen werden\npocketmine.plugin.deprecatedEvent=Das Plugin '{%0}' hat einen Listener für '{%1}' auf die Methode '{%2}' registriert, aber das Event ist veraltet.\npocketmine.plugin.eventError=\"Das Event '{%0}' konnte nicht an '{%1}' weitergegeben werden: {%2} in {%3}\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/eng.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers\n#\n# A message doesn't need to be there to be shown correctly on the client.\n# Only messages shown in PocketMine itself need to be here\n\nlanguage.name=English\nlanguage.selected=Selected {%0} ({%1}) as the base language\n\nmultiplayer.player.joined={%0} joined the game\nmultiplayer.player.left={%0} left the game\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0} has just earned the achievement {%1}\n\ndisconnectionScreen.notAuthenticated=Xbox login required\ndisconnectionScreen.outdatedClient=Outdated client!\ndisconnectionScreen.outdatedServer=Outdated server!\ndisconnectionScreen.serverFull=Server is full!\ndisconnectionScreen.noReason=Disconnected from server\ndisconnectionScreen.invalidSkin=Invalid skin!\ndisconnectionScreen.invalidName=Invalid name!\n\ndeath.fell.accident.generic={%0} fell from a high place\ndeath.attack.inFire={%0} went up in flames\ndeath.attack.onFire={%0} burned to death\ndeath.attack.lava={%0} tried to swim in lava\ndeath.attack.inWall={%0} suffocated in a wall\ndeath.attack.drown={%0} drowned\ndeath.attack.cactus={%0} was pricked to death\ndeath.attack.generic={%0} died\ndeath.attack.explosion={%0} blew up\ndeath.attack.explosion.player={%0} was blown up by {%1}\ndeath.attack.magic={%0} was killed by magic\ndeath.attack.wither={%0} withered away\ndeath.attack.mob={%0} was slain by {%1}\ndeath.attack.player={%0} was slain by {%1}\ndeath.attack.player.item={%0} was slain by {%1} using {%2}\ndeath.attack.arrow={%0} was shot by {%1}\ndeath.attack.arrow.item={%0} was shot by {%1} using {%2}\ndeath.attack.fall={%0} hit the ground too hard\ndeath.attack.outOfWorld={%0} fell out of the world\n\ngameMode.survival=Survival Mode\ngameMode.creative=Creative Mode\ngameMode.adventure=Adventure Mode\ngameMode.spectator=Spectator Mode\ngameMode.changed=Your game mode has been updated\n\npotion.moveSpeed=Speed\npotion.moveSlowdown=Slowness\npotion.digSpeed=Haste\npotion.digSlowDown=Mining Fatigue\npotion.damageBoost=Strength\npotion.heal=Instant Health\npotion.harm=Instant Damage\npotion.jump=Jump Boost\npotion.confusion=Nausea\npotion.regeneration=Regeneration\npotion.resistance=Resistance\npotion.fireResistance=Fire Resistance\npotion.waterBreathing=Water Breathing\npotion.invisibility=Invisibility\npotion.blindness=Blindness\npotion.nightVision=Night Vision\npotion.hunger=Hunger\npotion.weakness=Weakness\npotion.poison=Poison\npotion.wither=Wither\npotion.healthBoost=Health Boost\npotion.absorption=Absorption\npotion.saturation=Saturation\n\ncommands.generic.exception=An unknown error occurred while attempting to perform this command\ncommands.generic.permission=You do not have permission to use this command\ncommands.generic.notFound=Unknown command. Try /help for a list of commands\ncommands.generic.player.notFound=That player cannot be found\ncommands.generic.usage=Usage: {%0}\ncommands.generic.level=level-name\ncommands.generic.seed=seed-name\ncommands.generic.name=name\ncommands.generic.generator=generator-name\ncommands.generic.opt.missing=Missing required properties, please confirm and re-enter.\ncommands.generic.runingame=Please run this command in-game.\n\ncommands.time.added=Added {%0} to the time\ncommands.time.set=Set the time to {%0}\ncommands.time.query=Time is {%0}\n\ncommands.give.item.notFound=There is no such item with name {%0}\ncommands.give.success=Given {%0} * {%1} to {%2}\ncommands.give.tagError=Data tag parsing failed: {%0}\n\ncommands.effect.notFound=There is no such mob effect with ID {%0}\ncommands.effect.success=Given {%0} (ID {%1}) * {%2} to {%3} for {%4} seconds\ncommands.effect.success.removed=Took {%0} from {%1}\ncommands.effect.success.removed.all=Took all effects from {%0}\ncommands.effect.failure.notActive=Couldn't take {%0} from {%1} as they do not have the effect\ncommands.effect.failure.notActive.all=Couldn't take any effects from {%0} as they do not have any\n\ncommands.enchant.maxLevel=Level Range of that enchantment is 1 - {%0}\ncommands.enchant.noItem=The target is not holding an item\ncommands.enchant.notFound=There is no such enchantment with ID {%0}\ncommands.enchant.success=Enchanting succeeded\ncommands.enchant.cantEnchant=The selected enchantment can't be added to the target item\ncommands.particle.success=Playing effect {%0} for {%1} times\ncommands.particle.notFound=Unknown effect name {%0}\ncommands.players.list=There are {%0}/{%1} players online:\ncommands.kill.successful=Killed {%0}\ncommands.banlist.ips=There are {%0} total banned IP addresses:\ncommands.banlist.players=There are {%0} total banned players:\ncommands.banlist.cids=There are {%0} total banned CIDs:\ncommands.defaultgamemode.success=The world's default game mode is now {%0}\n\ncommands.op.success=Opped {%0}\n\ncommands.deop.success=De-opped {%0}\n\ncommands.seed.success=Seed: {%0}\n\ncommands.bancidbyname.success=Banned player {%0}'s CID\n\ncommands.bancid.success=Banned CID {%0}\n\ncommands.unbancid.success=Unbanned CID {%0}\n\ncommands.ban.success=Banned player {%0}\n\ncommands.unban.success=Unbanned player {%0}\n\ncommands.banip.invalid=You have entered an invalid IP address or a player that is not online\ncommands.banip.success=Banned IP address {%0}\ncommands.banip.success.players=Banned IP address {%0} belonging to {%1}\n\ncommands.unbanip.invalid=You have entered an invalid IP address\ncommands.unbanip.success=Unbanned IP address {%0}\n\ncommands.banipbyname.success=Banned player {%0}'s IP\n\ncommands.save.enabled=Turned on world auto-saving\ncommands.save.disabled=Turned off world auto-saving\ncommands.save.start=Saving...\ncommands.save.success=Saved the world\n\ncommand.setblock.invalidBlock=Invalid block name/ID\n\ncommands.stop.start=Stopping the server\n\ncommands.kick.success=Kicked {%0} from the game\ncommands.kick.success.reason=Kicked {%0} from the game: '{%1}'\n\ncommands.tp.success=Teleported {%0} to {%1}\ncommands.tp.success.coordinates=Teleported {%0} to {%1}, {%2}, {%3}\n\ncommands.whitelist.list=There are {%0} (out of {%1} seen) whitelisted players:\ncommands.whitelist.enabled=Turned on the whitelist\ncommands.whitelist.disabled=Turned off the whitelist\ncommands.whitelist.reloaded=Reloaded the whitelist\ncommands.whitelist.add.success=Added {%0} to the whitelist\ncommands.whitelist.add.usage=/whitelist add <player>\ncommands.whitelist.remove.success=Removed {%0} from the whitelist\ncommands.whitelist.remove.usage=/whitelist remove <player>\n\ncommands.gamemode.success.self=Set own game mode to {%2}\ncommands.gamemode.success.other=Set {%1}'s game mode to {%2}\ncommands.gamemode.usage=/gamemode <mode> [player]\ncommands.help.header=--- Showing help page {%0} of {%1} (/help <page>) ---\ncommands.message.sameTarget=You can't send a private message to yourself!\n\ncommands.difficulty.success=Set game difficulty to {%0}\n\ncommands.spawnpoint.success=Set {%0}'s spawn point to ({%1}, {%2}, {%3})\ncommands.setworldspawn.success=Set the world spawn point to ({%0}, {%1}, {%2})\n\ncommands.xp.failure.withdrawXp=Cannot give player negative experience points\ncommands.xp.success=Given {%0} experience to {%1}\ncommands.xp.success.levels=Given {%0} levels to {%1}\ncommands.xp.success.negative.levels=Taken {%0} levels from {%1}\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=Player data not found for \"{%0}\", creating new profile\npocketmine.data.playerCorrupted=Corrupted data found for \"{%0}\", creating new profile\npocketmine.data.playerOld=Old Player data found for \"{%0}\", upgrading profile\npocketmine.data.saveError=Could not save player \"{%0}\": {%1}\npocketmine.level.notFound=Level \"{%0}\" not found\npocketmine.level.loadError=Could not load level \"{%0}\": {%1}\npocketmine.level.generationError=Could not generate level \"{%0}\": {%1}\npocketmine.level.tickError=Could not tick level \"{%0}\": {%1}\npocketmine.level.chunkUnloadError=Error while unloading a chunk: {%0}\npocketmine.level.backgroundGeneration=Spawn terrain for level \"{%0}\" is being generated in the background\npocketmine.level.defaultError=No default level has been loaded\npocketmine.level.preparing=Preparing level \"{%0}\"\npocketmine.level.unloading=Unloading level \"{%0}\"\npocketmine.server.start=Starting Minecraft: PE server version {%0}\npocketmine.server.networkError=[Network] Stopped interface {%0} due to {%1}\npocketmine.server.networkStart=Opening server on {%0}:{%1}\npocketmine.server.info=This server is running {%0}{%1} \"{%2}\" (API {%3})\n\npocketmine.server.info.extended.title=-----Server information-----\npocketmine.server.info.extended1=This server is running {%0}{%1} {%2}\npocketmine.server.info.extended2=PHP version: {%0}\npocketmine.server.info.extended3=API: {%0}\npocketmine.server.info.extended4=Target client: Minecraft PE {%0}\npocketmine.server.info.extended5=Protocol version: {%0}\n\npocketmine.server.license={%0} is distributed under the GPL License version 3 and later\npocketmine.server.tickOverload=Can't keep up! Is the server overloaded?\npocketmine.server.startFinished=Done ({%0}s)! For help, type \"help\" or \"?\"\npocketmine.server.defaultGameMode=Default game type: {%0}\npocketmine.server.query.start=Starting GS4 status listener\npocketmine.server.query.info=Setting query port to {%0}\npocketmine.server.query.running=Query running on {%0}:{%1}\n\npocketmine.command.alias.illegal=Could not register alias {%0} because it contains illegal characters\npocketmine.command.alias.notFound=Could not register alias {%0} because it contains commands that do not exist: {%1}\npocketmine.command.exception=Unhandled exception executing command '{%0}' in {%1}: {%2}\n\npocketmine.command.plugins.description=Gets a list of plugins running on the server\npocketmine.command.plugins.success=Plugins ({%0}): {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=Reloads the server configuration and plugins\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Reloading server...\npocketmine.command.reload.reloaded=Reload complete.\n\npocketmine.command.lvdat.description=Change properties of a map.\npocketmine.command.lvdat.changed=has changed {%1} of level \"{%0}\", some change need to reboot your server.\npocketmine.command.lvdat.fixname=fixname successfully for level \"{%0}\", some change need to reboot your server.\npocketmine.command.lvdat.nofound=level \"{%0}\" no found or load failed.\npocketmine.command.lvdat.preset=Generator setting (preset)\n\npocketmine.command.status.description=Reads back the server's performance.\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=Server status\npocketmine.command.status.player=Player count:\npocketmine.command.status.days=days\npocketmine.command.status.hours=hours\npocketmine.command.status.minutes=minutes\npocketmine.command.status.seconds=seconds\npocketmine.command.status.uptime=Uptime:\npocketmine.command.status.AverageTPS=Average TPS:\npocketmine.command.status.CurrentTPS=Current TPS:\npocketmine.command.status.Networkupload=Network upload:\npocketmine.command.status.Networkdownload=Network download:\npocketmine.command.status.Threadcount=Thread count:\npocketmine.command.status.Mainmemory=Main thread memory:\npocketmine.command.status.Totalmemory=Total memory:\npocketmine.command.status.Totalvirtualmemory=Total virtual memory:\npocketmine.command.status.Heapmemory=Heap memory:\npocketmine.command.status.Maxmemorysystem=Maximum memory (system):\npocketmine.command.status.Maxmemorymanager=Maximum memory (manager):\npocketmine.command.status.World=World\npocketmine.command.status.chunks=chunks,\npocketmine.command.status.entities=entities,\npocketmine.command.status.tiles=tiles.\npocketmine.command.status.Time=Time\npocketmine.command.status.ms=ms\n\npocketmine.command.gc.description=Fires garbage collection tasks\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=Collection Report\npocketmine.command.gc.chunks=Chunks:\npocketmine.command.gc.entities=Entities:\npocketmine.command.gc.tiles=Tiles:\npocketmine.command.gc.cycles=Cycles:\npocketmine.command.gc.memory=Release memory:\n\npocketmine.command.biome.description=Change the biome of the area.(To change snow or rain)\npocketmine.command.biome.posset=Set position {%3} at ({%1},{%2}) in level {%0}\npocketmine.command.biome.get=The ID of biome you are in is {%0}. Color: {%1},{%2},{%3}\npocketmine.command.biome.wrongLev=Cannot set position in different level.\npocketmine.command.biome.wrongBio=Wrong ID of biome. e.g. 1 (Plains), 2 (Desert)，13 (Ice Mountains)，6 (Swampland)\npocketmine.command.biome.wrongCol=Wrong Color. e.g. 146,188,89 .Use \"/biome get\" to get other color.\npocketmine.command.biome.noPos=Please use \"/biome pos1|pos2\" to select the area first.\npocketmine.command.biome.set=Set the selected area's biome to {%0}\npocketmine.command.biome.color=Set the grass colour to {%0},{%1},{%2}\n\npocketmine.command.timings.description=Records timings to see performance of the server.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=Enabled Timings & Reset\npocketmine.command.timings.disable=Disabled Timings\npocketmine.command.timings.timingsDisabled=Please enable timings by typing /timings on\npocketmine.command.timings.reset=Timings reset\npocketmine.command.timings.pasteError=An error happened while pasting the report\npocketmine.command.timings.timingsUpload=Timings uploaded to {%0}\npocketmine.command.timings.timingsRead=You can read the results at {%0}\npocketmine.command.timings.timingsWrite=Timings written to {%0}\npocketmine.command.version.description=Gets the version of this server including any plugins in use\npocketmine.command.version.usage=/version [plugin name]\npocketmine.command.version.noSuchPlugin=This server is not running any plugin by that name. Use /plugins to get a list of plugins.\npocketmine.command.give.description=Gives the specified player a certain amount of items\npocketmine.command.give.usage=/give <player> <item[:damage]> [amount] [tags...]\npocketmine.command.kill.description=Commit suicide or kill other players\npocketmine.command.kill.usage=/kill [player]\npocketmine.command.particle.description=Adds particles to a world\npocketmine.command.particle.usage=/particle <name> <x> <y> <z> <xd> <yd> <zd> [count] [data]\npocketmine.command.time.description=Changes the time on each world\npocketmine.command.time.usage=/time <set|add> <value> OR /time <start|stop|query>\npocketmine.command.bancidbyname.description=Prevents the specified CID by name from using this server\npocketmine.command.bancidbyname.usage=/bancidbyname <player>\npocketmine.command.bancid.description=Prevents the specified CID from using this server\npocketmine.command.bancid.usage=/bancid <ClientID>\npocketmine.command.banipbyname.description=Prevents the specified IP address by name from using this server\npocketmine.command.banipbyname.usage=/banipbyname <player>\npocketmine.command.ban.player.description=Prevents the specified player from using this server\npocketmine.command.ban.player.ban.usage=/ban <name> [reason ...] [time(day)]\npocketmine.command.banip.description=Prevents the specified IP address from using this server\npocketmine.command.banip.usage=/ban-ip <address|name> [reason ...]\npocketmine.command.banlist.description=View all players banned from this server\npocketmine.command.banlist.usage=/banlist [ips|players|cids]\npocketmine.command.defaultgamemode.description=Set the default gamemode\npocketmine.command.defaultgamemode.usage=/defaultgamemode <mode>\npocketmine.command.deop.description=Takes the specified player's operator status\npocketmine.command.op.usage=/op <player>\npocketmine.command.deop.usage=/deop <player>\npocketmine.command.difficulty.description=Sets the game difficulty\npocketmine.command.difficulty.usage=/difficulty <new difficulty>\npocketmine.command.enchant.description=Adds enchantments on items\npocketmine.command.enchant.usage=/enchant <player> <enchantment ID> [level]\npocketmine.command.effect.description=Adds/Removes effects on players\npocketmine.command.effect.usage=/effect <player> <effect> [seconds] [amplifier] [hideParticles] OR /effect <player> clear\npocketmine.command.gamemode.description=Changes the player to a specific game mode\npocketmine.command.gamemode.usage=/gamemode <mode> [player]\npocketmine.command.help.description=Shows the help menu\npocketmine.command.help.usage=/help [page|command name]\npocketmine.command.kick.description=Removes the specified player from the server\npocketmine.command.kick.usage=/kick <player> [reason ...]\npocketmine.command.list.description=Lists all online players\npocketmine.command.players.usage=/list\npocketmine.command.me.description=Performs the specified action in chat\npocketmine.command.me.usage=/me <action ...>\npocketmine.command.op.description=Gives the specified player operator status\npocketmine.command.unban.cid.description=Allows the specified CID to use this server\npocketmine.command.unban.cid.usage=/pardoncid <ClientID>\npocketmine.command.unban.player.description=Allows the specified player to use this server\npocketmine.command.unban.player.usage=/pardon <name>\npocketmine.command.unban.ip.description=Allows the specified IP address to use this server\npocketmine.command.unban.ip.usage=/pardon-ip <address>\npocketmine.command.save.description=Saves the server to disk\npocketmine.command.save.usage=/save-all\npocketmine.command.saveoff.description=Disables server autosaving\npocketmine.command.saveoff.usage=/save-off\npocketmine.command.saveon.description=Enables server autosaving\npocketmine.command.saveon.usage=/save-on\npocketmine.command.say.description=Broadcasts the given message as the sender\npocketmine.command.say.usage=/say <message ...>\npocketmine.command.seed.description=Shows the world seed\npocketmine.command.seed.usage=/seed\npocketmine.command.setworldspawn.description=Sets a worlds's spawn point. If no coordinates are specified, the player's coordinates will be used.\npocketmine.command.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\npocketmine.command.spawnpoint.description=Sets a player's spawn point\npocketmine.command.spawnpoint.usage=/spawnpoint [player] [<x> <y> <z>]\npocketmine.command.stop.description=Stops the server\npocketmine.command.stop.usage=/stop\npocketmine.command.tp.description=Teleports the given player (or yourself) to another player or coordinates\npocketmine.command.tp.usage=/tp [target player] <destination player> OR /tp [target player] <x> <y> <z> [<y-rot> <x-rot>]\npocketmine.command.tell.description=Sends a private message to the given player\npocketmine.command.tell.usage=/tell <player> <private message ...>\npocketmine.command.xp.description=Add experience or experience level to the given player\npocketmine.command.xp.usage=/xp <amount> [player] OR /xp <amount>L [player]\npocketmine.command.summon.description=Summons a entity at the player's location or a specific location\npocketmine.command.summon.usage=/summon [entity] [<x> <y> <z>] [NBTTag]\npocketmine.command.fill.description=fills a specific selection with blocks\npocketmine.command.setblock.description=Changes a block to another block\npocketmine.command.setblock.usage=/setblock <x> <y> <z> <BlockName> [damage]\n\npocketmine.command.weather.description=Set weather for level\npocketmine.command.weather.usage=/weather <level-name weather|weather (rain|sunny|clear)>\npocketmine.command.weather.changed=Weather changed successfully in level {%0}!\npocketmine.command.weather.noregistered=level {%0} hasn't registered to WeatherManager.\npocketmine.command.weather.invalid=Invalid weather.(0,1,2,3)\npocketmine.command.weather.wrong=Wrong parameters.\npocketmine.command.weather.invalid.level=Invalid level name.\n\npocketmine.command.whitelist.description=Manages the list of players allowed to use this server\npocketmine.command.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\npocketmine.crash.create=An unrecoverable error has occurred and the server has crashed. Creating a crash dump\npocketmine.crash.error=Could not create crash dump: {%0}\npocketmine.crash.submit=Please upload the \"{%0}\" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.\npocketmine.crash.archive=The crash dump has been automatically submitted to the Crash Archive. You can view it on {%0} or use the ID #{%1}.\npocketmine.debug.enable=LevelDB support enabled\npocketmine.player.invalidMove={%0} moved wrongly!\npocketmine.player.logIn={%0}[/{%1}:{%2}] [ClientID: {%3}] logged in with entity id {%4} at ({%5}, {%6}, {%7}, {%8}) with a(n) {%9}\npocketmine.player.logOut={%0}[/{%1}:{%2}] logged out due to {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] was transferred to {%3}\npocketmine.player.invalidEntity={%0} tried to attack an invalid entity\npocketmine.plugin.load=Loading {%0}\npocketmine.plugin.enable=Enabling {%0}\npocketmine.plugin.disable=Disabling {%0}\npocketmine.plugin.restrictedName=Restricted name\npocketmine.plugin.incompatibleAPI=Incompatible API version\npocketmine.plugin.unknownDependency=Unknown dependency\npocketmine.plugin.circularDependency=Circular dependency detected\npocketmine.plugin.genericLoadError=Could not load plugin '{%0}'\npocketmine.plugin.spacesDiscouraged=Plugin '{%0}' uses spaces in its name, this is discouraged\npocketmine.plugin.loadError=Could not load plugin '{%0}': {%1}\npocketmine.plugin.duplicateError=Could not load plugin '{%0}': plugin exists\npocketmine.plugin.fileError=Could not load '{%0}' in folder '{%1}': {%2}\npocketmine.plugin.commandError=Could not load command {%0} for plugin {%1}\npocketmine.plugin.aliasError=Could not load alias {%0} for plugin {%1}\npocketmine.plugin.deprecatedEvent=Plugin '{%0}' has registered a listener for '{%1}' on method '{%2}', but the event is Deprecated.\npocketmine.plugin.eventError=\"Could not pass event '{%0}' to '{%1}': {%2} on {%3}\n"
  },
  {
    "path": "src/pocketmine/lang/locale/fra.ini",
    "content": "﻿# Fichier de langue compatible avec Minecraft: Pocket Edition\n\n# Aidez moi a traduire (ou à vérifier) les lignes: 186, 212, 276, 277, 286, 290, 295.\n# Un message n'a pas besoin d'être là pour être montré correctement sur le client.\n# Seuls les messages affichés dans Genisys se doivent d'être ici\n\nlanguage.name=Français\nlanguage.selected=Sélection de {%0} ({%1}) comme langue de base\n\nmultiplayer.player.joined={%0} a rejoint la partie\nmultiplayer.player.left={%0} a quitté la partie\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0} vient d'obtenir le succès {%1}\n\ndisconnectionScreen.outdatedClient=Client expiré !\ndisconnectionScreen.outdatedServer=Serveur expiré !\ndisconnectionScreen.serverFull=Le serveur est complet !\ndisconnectionScreen.noReason=Déconnecté du serveur\ndisconnectionScreen.invalidSkin=Skin invalide !\ndisconnectionScreen.invalidName=Nom invalide !\n\ndeath.fell.accident.generic={%0} a fait une terrible chute\ndeath.attack.inFire={%0} a péri dans les flammes\ndeath.attack.onFire={%0} s'est fait carboniser à mort\ndeath.attack.lava={%0} a essayé de nager dans la lave\ndeath.attack.inWall={%0} a suffoqué dans un mur\ndeath.attack.drown={%0} s'est noyé\ndeath.attack.cactus={%0} s'est fait piquer à mort\ndeath.attack.generic={%0} est mort\ndeath.attack.explosion={%0} est mort dans une explosion\ndeath.attack.explosion.player={%0} est mort dans une explosion causé par {%1}\ndeath.attack.magic={%0} a été tué par la magie\ndeath.attack.wither={%0} sécha\ndeath.attack.mob={%0} a été tué par {%1}\ndeath.attack.player={%0} a été tué par {%1}\ndeath.attack.player.item={%0} a été tué par {%1} en utilisant {%2}\ndeath.attack.arrow={%0} s'est fait tiré dessus par {%1}\ndeath.attack.arrow.item={%0} s'est fait tiré dessus par {%1} en utilisant {%2}\ndeath.attack.fall={%0} a frappé le sol trop rapidement\ndeath.attack.outOfWorld={%0} a littéralement quitté notre monde\n\ngameMode.survival=Mode Survie\ngameMode.creative=Mode Créatif\ngameMode.adventure=Mode Aventure\ngameMode.spectator=Mode Spectateur\ngameMode.changed=Votre mode de jeu a été mis à jour\n\npotion.moveSpeed=Vitesse\npotion.moveSlowdown=Lenteur\npotion.digSpeed=Célérité\npotion.digSlowDown=Fatigue\npotion.damageBoost=Force\npotion.heal=Vie instantanée\npotion.harm=Dégats instantanés\npotion.jump=Saut\npotion.confusion=Nausée\npotion.regeneration=Régénération\npotion.resistance=Résistance\npotion.fireResistance=Résistance au feu\npotion.waterBreathing=Respiration aquatique\npotion.invisibility=Invisibilité\npotion.blindness=Cécité\npotion.nightVision=Vision nocturne\npotion.hunger=Faim\npotion.weakness=Faiblesse\npotion.poison=Poison\npotion.wither=Wither\npotion.healthBoost=Soin instantané\npotion.absorption=Absorption\npotion.saturation=Satiété\n\ncommands.generic.exception=Une erreur inconnue est survenue lors de la tentative d'exécution de cette commande\ncommands.generic.permission=Vous n'avez pas la permission d'utiliser cette commande\ncommands.generic.notFound=Cette commande n'est pas reconnue : faites /help pour obtenir la liste des commandes\ncommands.generic.player.notFound=Le joueur n'a pas été trouvé\ncommands.generic.usage=Utilisation : {%0}\ncommands.generic.level=Monde\ncommands.generic.seed=Semence\ncommands.generic.name=Nom\ncommands.generic.generator=Générateur\ncommands.generic.opt.missing=Propriétés manquantes, merci de confirmer et d'appuyer sur entrée.\ncommands.generic.runingame=Cette commande ne fonctionne qu'en jeu.\n\ncommands.time.added=Heure avancée de {%0}\ncommands.time.set=Heure fixée à {%0}\ncommands.time.query=Temps : {%0}\n\ncommands.me.usage=/me <action ...>\n\ncommands.give.item.notFound=Il n'y a pas d'objet connu ayant pour nom {%0}\ncommands.give.success=Don de {%0} * {%1} à {%2}\ncommands.give.tagError=L'analyse syntaxique du data tag a échoué : {%0}\n\ncommands.effect.usage=/effect <joueur> <effet> [temps] [amplificateur] [masquer les particules] OU /effect <joueur> clear\ncommands.effect.notFound=Il n'y a pas d'effet connu ayant pour ID {%0}\ncommands.effect.success=Don de l'effet {%0} (ID {%1}) * {%2} à {%3} pour une durée de {%4} secondes\ncommands.effect.success.removed=Retrait de l'effet {%0} de {%1}\ncommands.effect.success.removed.all=Retrait de tous les effets de {%0}\ncommands.effect.failure.notActive=Impossible de supprimer l'effet {%0} de {%1} car ce joueur ne possède pas cet effet\ncommands.effect.failure.notActive.all=Impossible de supprimer les effets du joueur {%0} car ce joueur ne possède aucun effets\n\ncommands.enchant.noItem=Le joueur n'a pas d'objet en main\ncommands.enchant.notFound=Il n'y a pas d'enchantement avec l'ID {%0}\ncommands.enchant.success=Enchantement réussi\ncommands.enchant.cantEnchant=L'enchantement sélectionné ne peut être ajouté à l'élément cible\ncommands.enchant.usage=/enchant <joueur> <ID enchantement> [niveau]\ncommands.particle.success=L'effet {%0} apparaît {%1} fois\ncommands.particle.notFound=Effet inconnu {%0}\ncommands.players.usage=/list\ncommands.players.list=Il y'a {%0}/{%1} joueurs en ligne:\ncommands.kill.successful={%0} a été anéanti(e)\ncommands.banlist.ips=Il y'a un total de {%0} IP banni(s) :\ncommands.banlist.players=Il y'a un total de {%0} joueur(s) banni(s) :\ncommands.banlist.cids=Il y'a un total de {%0} CID banni(s) :\ncommands.banlist.usage=/banlist [ip|players|cids]\ncommands.defaultgamemode.usage=/defaultgamemode <mode>\ncommands.defaultgamemode.success=Le mode de jeu par défaut est maintenant {%0}\n\ncommands.op.success={%0} a été promu opérateur\ncommands.op.usage=/op <joueur>\n\ncommands.deop.success={%0} a perdu ses privilèges d'opérateur\ncommands.deop.usage=/deop <joueur>\n\ncommands.say.usage=/say <message ...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Semence : {%0}\n\ncommands.bancidbyname.success=CID du joueur {%0} banni\ncommands.bancidbyname.usage=/bancidbyname <joueur>\n\ncommands.bancid.success=CID {%0} banni\ncommands.bancid.usage=/bancid <IDClient>\n\ncommands.unbancid.usage=/pardoncid <IDClient>\ncommands.unbancid.success=CID {%0} débanni\n\ncommands.ban.success=Joueur {%0} banni\ncommands.ban.usage=/ban <joueur> [raison ...] [temps(jour)]\n\ncommands.unban.success=Joueur {%0} débanni\ncommands.unban.usage=/pardon <joueur>\n\ncommands.banip.invalid=Vous avez entré une adresse IP invalide ou un joueur qui n'est pas connecté.\ncommands.banip.success=Adresse IP {%0} bannie\ncommands.banip.success.players=L'adresse IP {%0} appartenant à {%1} a était bannie\ncommands.banip.usage=/ban-ip <addresse|joueur> [raison ...]\n\ncommands.unbanip.invalid=Vous avez entré une adresse IP invalide\ncommands.unbanip.success=Adresse IP {%0} débannie\ncommands.unbanip.usage=/pardon-ip <addresse>\n\ncommands.banipbyname.success=L'adresse IP du joueur {%0} a été bannie\ncommands.banipbyname.usage=/banipbyname <joueur>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=Sauvegarde automatique du monde activée\ncommands.save.disabled=Sauvegarde automatique du monde désactivée\ncommands.save.start=Sauvegarde...\ncommands.save.success=Monde sauvegardé\n\ncommands.setblock.usage=/setblock <x> <y> <z> <nom/ID du bloc> [dégâts]\ncommand.setblock.invalidBlock=Vous avez entré un nom/ID de bloc invalide\n\ncommands.stop.usage=/stop\ncommands.stop.start=Arrêt du serveur\n\ncommands.kick.success={%0} s'est fait éjecter du serveur\ncommands.kick.success.reason={%0} s'est fait éjecter du serveur pour la raison suivante : {%1}'\ncommands.kick.usage=/kick <joueur> [raison ...]\n\ncommands.tp.success={%0} s'est fait téléporter vers {%1}\ncommands.tp.success.coordinates={%0} s'est fait téléporter en {%1}, {%2}, {%3}\ncommands.tp.usage=/tp [joueur cible] <joueur de destination> OU /tp [joueur cible] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=Il y a {%0} joueur(s) (sur {%1} détecté(s)) dans la liste blanche :\ncommands.whitelist.enabled=Liste blanche activée\ncommands.whitelist.disabled=Liste blanche désactivée\ncommands.whitelist.reloaded=Liste blanche réactualisée\ncommands.whitelist.add.success={%0} a été ajouté(e) à la liste blanche\ncommands.whitelist.add.usage=/whitelist add <joueur>\ncommands.whitelist.remove.success=Le joueur {%0} a été retiré(e) de la liste blanche\ncommands.whitelist.remove.usage=/whitelist remove <joueur>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=Votre mode de jeu a été changé en Mode {%2}\ncommands.gamemode.success.other=Le mode de jeu de {%1} a été changé en Mode {%2}\ncommands.gamemode.usage=/gamemode <mode> [joueur]\ncommands.help.header=--- Affichage de la page d'aide {%0} sur {%1} (/help <page>) ---\ncommands.help.usage=/help [page|nom de la commande]\ncommands.message.usage=/tell <joueur> <message privé ...>\ncommands.message.sameTarget=Vous ne pouvez pas vous envoyer de message privé !\ncommands.xp.usage=/xp <Experience ou ExprLevel+L> <joueur>\n\ncommands.difficulty.usage=/difficulty <difficulté>\ncommands.difficulty.success=La difficulté a été changée en {%0}\n\ncommands.spawnpoint.usage=/spawnpoint [joueur] [<x> <y> <z>]\ncommands.spawnpoint.success=Le nouveau point d'apparition de {%0} a été défini en ({%1}, {%2}, {%3})\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\n\ncommands.setworldspawn.success=Le point d'appartition du monde a été défini en ({%0}, {%1}, {%2})\n\ncommands.summon.usage=/summon [nom de l'entité] [<x> <y> <z>] [dataTag]\n\n# -------------------- Fichiers de langue PocketMine, uniquement pour la console --------------------\npocketmine.data.playerNotFound=Données du joueur \"{%0}\" invalides , création d'un nouveau profil\npocketmine.data.playerCorrupted=Données du joueur \"{%0}\" corrompus, création d'un nouveau profil\npocketmine.data.playerOld=Ancienne données du joueur \"{%0}\" trouvées, mise à jour du profil\npocketmine.data.saveError=Impossible de sauvegarder le joueur \"{%0}\": {%1}\npocketmine.level.notFound=Le monde \"{%0}\" est introuvable\npocketmine.level.loadError=Impossible de charger le monde \"{%0}\": {%1}\npocketmine.level.generationError=Impossible de générer le monde \"{%0}\": {%1}\npocketmine.level.tickError=Impossible de vérifier le monde \"{%0}\": {%1}\npocketmine.level.chunkUnloadError=Une erreur est survenue lors du déchargement d'un chunk: {%0}\npocketmine.level.backgroundGeneration=L'apparition du terrain pour le niveau \"{%0}\" est entrain de ce générer en arrière-plan\npocketmine.level.defaultError=Aucun niveau par défaut n'a été chargée\npocketmine.level.preparing=Préparation du terrain \"{%0}\"\npocketmine.level.unloading=Déchargement du terrain \"{%0}\"\npocketmine.server.start=Démarrage du serveur Minecraft PE version {%0}\npocketmine.server.networkError=[Réseau] Arrêt de l'interface {%0} à cause de {%1}\npocketmine.server.networkStart=Ouverture du serveur sur {%0}:{%1}\npocketmine.server.info=Ce serveur fonctionne sur {%0} version {%1} \"{%2}\" (API {%3})\npocketmine.server.info.extended=Ce serveur fonctionne sur {%0} {%1} \"{%2}\" API implantée {%3} pour Minecraft: Pocket Edition {%4} (version du protocol {%5})\npocketmine.server.license={%0} est distribué sous la licence GPL version 3 et plus\npocketmine.server.tickOverload=Désynchronisation ! Est-ce que le serveur surchargé ?\npocketmine.server.startFinished=Démarrer en  ({%0}s)! Pour afficher l'aide tapez \"/help\" ou \"/?\"\npocketmine.server.defaultGameMode=Mode de jeu par défaut : {%0}\npocketmine.server.query.start=Démarrage de GS4 statut listener\npocketmine.server.query.info=Réglage du port Query sur {%0}\npocketmine.server.query.running=Le Query fonctionne sur {%0}:{%1}\n\npocketmine.command.alias.illegal=Le pseudonyme {%0} ne peut pas être enregistré car il contient des caractères illégaux\npocketmine.command.alias.notFound=Le pseudonyme {%0} ne peut pas être enregistré car il contient des commandes qui n'existent pas: {%1}\npocketmine.command.exception=Commande d'exécution d'exception non gérée '{%0}' dans {%1}: {%2}\n\npocketmine.commands.cave.usage=/cave <angle de rotation> <longueur> <Branch Number> <Force> <X> <Y> <Z> <nom du niveau> | /cave getmypos\npocketmine.commands.cave.info=Angle de rotation:{%0} Longueur:{%1} Branch Number:{%2} Force:{%3}\npocketmine.commands.cave.start=Génération de la caverne, veuillez patientez...\npocketmine.commands.cave.success=Caverne généré\n\npocketmine.command.plugins.description=Obtention de la liste des plugins en cours d'exécution sur le serveur\npocketmine.command.plugins.success=Plugins ({%0}) : {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=Recharge la configuration du serveur et des plugins\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Rechargement du serveur...\npocketmine.command.reload.reloaded=Rechargement du serveur terminé.\n\npocketmine.command.lvdat.description=Modification des propriétés de la carte.\npocketmine.command.lvdat.changed=Changement {%1} du monde \"{%0}\", les changements nécessites un redémarrage de serveur.\npocketmine.command.lvdat.fixname=Changement du nom terminé \"{%0}\", les changements nécessites un redémarrage de serveur.\npocketmine.command.lvdat.nofound=le monde \"{%0}\" ne fonctionne pas ou le chargement a échoué\npocketmine.command.lvdat.preset=Réglage du générateur (prédéfini)\n\npocketmine.command.status.description=Relecture des performances du serveur.\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=Statut du serveur\npocketmine.command.status.player=Nombre de joueur(s):\npocketmine.command.status.days=jour(s)\npocketmine.command.status.hours=heure(s)\npocketmine.command.status.minutes=minute(s)\npocketmine.command.status.seconds=seconde(s)\npocketmine.command.status.uptime=Durée de fonctionnement:\npocketmine.command.status.AverageTPS=Moyenne de TPS:\npocketmine.command.status.CurrentTPS=TPS actuel:\npocketmine.command.status.Networkupload=Débit montant de réseau :\npocketmine.command.status.Networkdownload=Débit descendant de réseau :\npocketmine.command.status.Threadcount=Thread count:\npocketmine.command.status.Mainmemory=Main thread memory:\npocketmine.command.status.Totalmemory=Mémoire totale:\npocketmine.command.status.Totalvirtualmemory=Mémoire virtuelle totale:\npocketmine.command.status.Heapmemory=Mémoire utilisée:\npocketmine.command.status.Maxmemorysystem=Mémoire maximale (système):\npocketmine.command.status.Maxmemorymanager=Mémoire maximale (gestionnaire):\npocketmine.command.status.World=Monde\npocketmine.command.status.chunks=Chunks,\npocketmine.command.status.entities=Entités,\npocketmine.command.status.tiles=Tiles.\npocketmine.command.status.Time=Temps\npocketmine.command.status.ms=ms\n\npocketmine.command.gc.description=Ramassage des déchets\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=Collection du Rapport\npocketmine.command.gc.chunks=Chunks:\npocketmine.command.gc.entities=Entités:\npocketmine.command.gc.tiles=Tiles:\npocketmine.command.gc.cycles=Cycles:\npocketmine.command.gc.memory=Release memory:\n\npocketmine.command.biome.description=Changez le biome de la zone.(Pour changer la neige ou la pluie)\npocketmine.command.biome.posset=Réglage de la position {%3} à ({%1},{%2}) dans le niveau {%0}\npocketmine.command.biome.get=L'ID de biome où vous êtes est {%0}. Couleurr: {%1},{%2},{%3}\npocketmine.command.biome.wrongLev=Impossible de définir cette position dans un niveau différent.\npocketmine.command.biome.wrongBio=Mauvais ID de biome. e.g. 1 (Plaine), 2 (Désert)，13 (Montagnes de glace)，6 (Marécage)\npocketmine.command.biome.wrongCol=Mauvaise couleur. e.g. 146,188,89 .Use \"/biome get\" pour obtenir une autre couleur.\npocketmine.command.biome.noPos=Veuillez utiliser \"/biome pos1|pos2\" pour sélectionner la première zone.\npocketmine.command.biome.set=Réglage du biome dans la zone sélectionnée à {%0}\npocketmine.command.biome.color=Réglage de la couleur de l'herbe à {%0},{%1},{%2}\n\npocketmine.command.timings.description=Synchronisation des rapports pour voir les performances du serveur.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=Activer le minutage et réinitialiser\npocketmine.command.timings.disable=Désactiver le minutage\npocketmine.command.timings.timingsDisabled=Merci d'activer les rapports de performance en tapant la commande /timings on\npocketmine.command.timings.reset=Minutage réinitialisé\npocketmine.command.timings.pasteError=Une erreur s'est produite lors de la génération du rapport\npocketmine.command.timings.timingsUpload=Rapports de performance mis à jours sur {%0}\npocketmine.command.timings.timingsRead=Vous pouvez lire les résultats dans {%0}\npocketmine.command.timings.timingsWrite=Rapports de performance écrits sur {%0}\npocketmine.command.version.description=Obtenez la version de ce serveur, y compris tous les plugins utilisés\npocketmine.command.version.usage=/version [nom du plugin]\npocketmine.command.version.noSuchPlugin=Ce serveur n'utilise pas ce plugin. Utilisez / plugins pour obtenir la liste des plugins.\npocketmine.command.give.description=Donne au joueur spécifié une certaine quantité d'items\npocketmine.command.give.usage=/give <joueur> <item[:dommage]> [montant] [tags...]\npocketmine.command.kill.description=Se suicider ou tuer d'autres joueurs\npocketmine.command.kill.usage=/kill [joueur]\npocketmine.command.particle.description=Ajoute des particules à un monde\npocketmine.command.particle.usage=/particle <joueur> <x> <y> <z> <xd> <yd> <zd> [nombre] [data]\npocketmine.command.time.description=Change le temps sur chaque monde\npocketmine.command.time.usage=/time <set|add> <valeur> OU /time <start|stop|query>\npocketmine.command.bancidbyname.description=Empêche le CID du joueur spécifié d'accéder à ce serveur\npocketmine.command.bancid.description=Empêche le CID spécifié d'accéder à ce serveur\npocketmine.command.banipbyname.description=Empêche l'adresse IP du joueur spécifiée d'accéder a ce serveur\npocketmine.command.ban.player.description=Empêche le joueur spécifié d'accéder a ce serveur\npocketmine.command.ban.ip.description=Empêche l'adresse IP spécifiée d'accéder a ce serveur\npocketmine.command.banlist.description=Voir la liste de tous les joueurs bannis sur ce serveur\npocketmine.command.defaultgamemode.description=Réglez le mode de jeu par défaut\npocketmine.command.deop.description=Enléve les droits d'administration à un joueur spécifié.\npocketmine.command.difficulty.description=Définit la difficulté du jeu\npocketmine.command.enchant.description=Ajoute un enchantement sur un item\npocketmine.command.effect.description=Ajoute/Supprime des effets sur un joueur spécifié\npocketmine.command.gamemode.description=Change le mode de jeu d'un joueur spécifique\npocketmine.command.help.description=Affiche le menu d'aide\npocketmine.command.kick.description=Exclu le joueur spécifié du serveur\npocketmine.command.list.description=Liste de tous les joueurs en ligne\npocketmine.command.me.description=Exécute l'action spécifiée dans le chat\npocketmine.command.op.description=Donne le statut d'opérateur au joueur spécifié\npocketmine.command.unban.cid.description=Autorise le CID spécifié à accéder au serveur\npocketmine.command.unban.player.description=Autorise le joueur spécifié à accéder au serveur\npocketmine.command.unban.ip.description=Autorise l'adresse IP spécifiée à accéder au serveur\npocketmine.command.save.description=Sauvegarde le serveur sur le disque\npocketmine.command.saveoff.description=Désactive la sauvegarde automatique\npocketmine.command.saveon.description=Active la sauvegarde automatique\npocketmine.command.say.description=Diffuse un message dans le chat\npocketmine.command.seed.description=Affiche le seed du serveur\npocketmine.command.setworldspawn.description=Définit le point d'apparition du monde.Si aucunes coordonnées ne sont spécifiées, les coordonnées du joueur sont utilisés.\npocketmine.command.spawnpoint.description=Définit le point d'apparition d'un joueur\npocketmine.command.stop.description=Arrête le serveur\npocketmine.command.tp.description=Téléporte le joueur donné (ou vous-même) à un autre joueur ou vers des coordonnées\npocketmine.command.tell.description=Envoie un message privé au joueur donné\npocketmine.command.xp.description=Ajouter de l'expérience a un joueur donné\npocketmine.command.summon.description=Invoque une entité à l'emplacement d'un joueur ou à un emplacement spécifique\npocketmine.command.fill.description=remplit une sélection spécifique avec des blocs\npocketmine.command.setblock.description=Remplace un bloc par un autre\n\npocketmine.command.weather.description=Réglez la météo pour le niveau\npocketmine.command.weather.usage=/weather <nom-du-niveau weather|weather (rain|sunny|clear)>\npocketmine.command.weather.changed=Météo changé avec succès au niveau {%0}!\npocketmine.command.weather.noregistered=Le niveau {%0} n'est pas enregistré à WeatherManager.\npocketmine.command.weather.invalid=Météo Invalide.(0,1,2,3)\npocketmine.command.weather.wrong=Mauvais paramètres.\npocketmine.command.weather.invalid.level=Nom du niveau invalide.\n\npocketmine.command.whitelist.description=Gère la liste des joueurs autorisés à accéder à serveur\npocketmine.crash.create=Une erreur irréversible s'est produite causant un crash du serveur. Création d'un rapport de crash\npocketmine.crash.error=Impossible de créer un fichier de crash : {%0}\npocketmine.crash.submit=Soumettez le fichier \"{%0}\" à l'archive des crashs et soumettez le lien vers la page des rapports de bugs. Donnez le plus d'informations possible.\npocketmine.crash.archive=Le rapport de crash a été automatiquement soumis à l'archive des crashs. Vous pouvez le voir sur {%0} ou utilisez l'ID #{%1}.\npocketmine.debug.enable=Support LevelDB activé\npocketmine.player.invalidMove={%0} se déplace incorrectement !\npocketmine.player.logIn={%0}[/{%1}:{%2}] [IDClient: {%3}] s'est connecté avec l'ID d'entité {%4} à ({%5}, {%6}, {%7}, {%8})\npocketmine.player.logOut={%0}[/{%1}:{%2}] déconnecté en raison de {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] a été transféré à {%3}\npocketmine.player.invalidEntity={%0} essaye d'attaquer une entité invalide\npocketmine.plugin.load=Chargement {%0}\npocketmine.plugin.enable=Activation de {%0}\npocketmine.plugin.disable=Désactivation de {%0}\npocketmine.plugin.restrictedName=Nom restreint\npocketmine.plugin.incompatibleAPI=Version d'API Incompatible\npocketmine.plugin.unknownDependency=Dépendance inconnu \npocketmine.plugin.circularDependency=Dépendance circulaire détectée\npocketmine.plugin.genericLoadError=Impossible de charger le plugin '{%0}'\npocketmine.plugin.spacesDiscouraged=Le plugin '{%0} utilise des espaces dans son nom, ceci est déconseillé\npocketmine.plugin.loadError=Impossible de charger le plugin '{%0}': {%1}\npocketmine.plugin.duplicateError=Impossible de charger le plugin '{%0}': le plugin existe\npocketmine.plugin.fileError=Impossible de charger '{%0}' dans le dossier '{%1}': {%2}\npocketmine.plugin.commandError=Impossible de charger la commande {%0} pour le plugin {%1}\npocketmine.plugin.aliasError=L'alias {%0} ne peut pas être chargé pour le plugin {%1}\npocketmine.plugin.deprecatedEvent=Le plugin '{%0}' a enregistré un auditeur pour '{%1} \"sur la méthode'{%2}', mais l'événement est obsolète.\npocketmine.plugin.eventError=\"Impossible de passer l’événement '{%0}' de '{%1}': {%2} sur {%3}\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/jpn.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers\n#\n# A message doesn't need to be there to be shown correctly on the client.\n# Only messages shown in PocketMine itself need to be here\n\nlanguage.name=日本語\nlanguage.selected={%0} ({%1}) を言語に選択しました\n\nmultiplayer.player.joined={%0} がゲームに参加しました\nmultiplayer.player.left={%0} が退出しました\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0}は{%1}の実績を手に入れました\n\ndisconnectionScreen.notAuthenticated=Xboxでのログインが必要です\ndisconnectionScreen.outdatedClient=古いクライアントです！\ndisconnectionScreen.outdatedServer=古いサーバーです！\ndisconnectionScreen.serverFull=サーバーは満員です！\ndisconnectionScreen.noReason=サーバーから切断されました\ndisconnectionScreen.invalidSkin=無効なスキンです\ndisconnectionScreen.invalidName=無効な名前です！\n\ndeath.fell.accident.generic={%0} は高いところから落ちた\ndeath.attack.inFire={%0}は炎に巻かれてしまった\ndeath.attack.onFire={%0}はこんがりと焼けてしまった\ndeath.attack.lava=｛%0}は溶岩遊泳を試みた\ndeath.attack.inWall={%0}は壁の中で窒息してしまった\ndeath.attack.drown={%0}は溺れ死んだ\ndeath.attack.cactus={%0}はサボテンに刺されて死んだ\ndeath.attack.generic={%0}は死んでしまった\ndeath.attack.explosion={%0}は爆発に巻き込まれてしまった\ndeath.attack.explosion.player={%0}は{%1}に爆破されてしまった\ndeath.attack.magic={%0}は魔法で殺された\ndeath.attack.wither={%0}は干からびてしまった\ndeath.attack.mob={%0}は{%1}に殺害された\ndeath.attack.player={%0}は{%1}に殺害された\ndeath.attack.player.item={%0}は{%1}の{%2}で殺害された\ndeath.attack.arrow={%0}は{%1}に射抜かれた\ndeath.attack.arrow.item={%0}は{%1}の{%2}で射抜かれた\ndeath.attack.fall={%0}は地面と強く激突してしまった\ndeath.attack.outOfWorld={%0}は奈落の底へ落ちてしまった\n\ngameMode.survival=サバイバルモード\ngameMode.creative=クリエイティブモード\ngameMode.adventure=アドベンチャーモード\ngameMode.spectator=スペクテイターモード\ngameMode.changed=ゲームモードが変更されました\n\npotion.moveSpeed=移動速度上昇\npotion.moveSlowdown=移動速度低下\npotion.digSpeed=採掘速度上昇\npotion.digSlowDown=採掘速度低下\npotion.damageBoost=攻撃力上昇\npotion.heal=即時回復\npotion.harm=ダメージ\npotion.jump=跳躍力上昇\npotion.confusion=吐き気\npotion.regeneration=再生能力\npotion.resistance=耐性\npotion.fireResistance=火炎耐性\npotion.waterBreathing=水中呼吸\npotion.invisibility=透明化\npotion.blindness=盲目\npotion.nightVision=暗視\npotion.hunger=空腹\npotion.weakness=弱体化\npotion.poison=毒\npotion.wither=ウィザー\npotion.healthBoost=体力増強\npotion.absorption=衝撃吸収\npotion.saturation=満腹度回復\n\ncommands.generic.exception=コマンドの実行中に不明なエラーが発生しました\ncommands.generic.permission=このコマンドを使用する権限がありません\ncommands.generic.notFound=未知のコマンドです。/helpでコマンドの一覧を確認してください\ncommands.generic.player.notFound=プレイヤーが見つかりません\ncommands.generic.usage=使い方: {%0}\ncommands.generic.level=level-name\ncommands.generic.seed=seed-name\ncommands.generic.name=name\ncommands.generic.generator=generator-name\ncommands.generic.opt.missing=必要なオプションが入力されていません。確認して再入力してください。\ncommands.generic.runingame=コマンドはゲーム内で使用してください。\n\ncommands.time.added=時間を{%0}進めました\ncommands.time.set=現在時刻を{%0}に設定しました\ncommands.time.query=現在の時間は {%0} です\n\ncommands.me.usage=/me <アクション>\n\ncommands.give.item.notFound={%0}という名前のアイテムはありません\ncommands.give.success={%0} を {%1} 個 {%2} に与えました\ncommands.give.tagError=データタグの解析に失敗しました: {%0}\n\ncommands.effect.usage=/effect <プレイヤー名> <効果> [秒数] [倍数] [パーティクルの設定] か /effect <プレイヤー名> clear\ncommands.effect.notFound=ID{%0}のエフェクトは存在しません\ncommands.effect.success={%3}に{%0} (ID {%1})×{%2}を{%4}秒間与えました\ncommands.effect.success.removed={%0}を{%1}から除去しました\ncommands.effect.success.removed.all={%0}からすべての効果を除去しました\ncommands.effect.failure.notActive={%1} は {%0} という効果を受けていないので除去することができませんでした\ncommands.effect.failure.notActive.all={%0}はステータス効果を受けていないので除去することはできませんでした\n\ncommands.enchant.noItem=対象のプレイヤーはアイテムを持っていません\ncommands.enchant.notFound=ID {%0} に該当するエンチャントはありません\ncommands.enchant.success=エンチャントに成功しました\ncommands.enchant.cantEnchant=このアイテムはエンチャントをすることができません\ncommands.enchant.usage=/enchant <プレイヤー名> <エンチャントID> [レベル]\ncommands.particle.success=効果{%0}を{%1}回発生させます\ncommands.particle.notFound=存在しないエフェクト：{%0}\ncommands.players.usage=/list\ncommands.players.list=現在{%0}人（最大{%1}人）がオンライン：\ncommands.kill.successful={%0}を殺しました\ncommands.banlist.ips=%d 個のIPアドレスがBANされています:\ncommands.banlist.players={%0} 人のプレイヤーがBANされています:\ncommands.banlist.cids={%0} 個のCIDがBANされています:\ncommands.banlist.usage=/banlist [ips|players|cids]\ncommands.defaultgamemode.usage=/defaultgamemode <モード>\ncommands.defaultgamemode.success=ワールドのデフォルトのゲームモードを {%0} にしました。\n\ncommands.op.success={%0} にオペレーター権を付与しました\ncommands.op.usage=/op <プレイヤー名>\n\ncommands.deop.success={%0} からオペレーター権を剥奪しました\ncommands.deop.usage=/deop <プレイヤー名>\n\ncommands.say.usage=/say <メッセージ ...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Seed値：{%0}\n\ncommands.bancidbyname.success=プレイヤー {%0}のCIDはBANされました。\ncommands.bancidbyname.usage=/bancidbyname <player>\n\ncommands.bancid.success=CID: {%0}はBANされました\ncommands.bancid.usage=/bancid <ClientID>\n\ncommands.unbancid.usage=/pardoncid <ClientID>\ncommands.unbancid.success=CID {%0} のBANが解除されました\n\ncommands.ban.success={%0} をBANしました\ncommands.ban.usage=/ban <プレイヤー名> [理由 ...] [時間(日)]\n\ncommands.unban.success={%0} のbanを解除しました\ncommands.unban.usage=/pardon <プレイヤー名>\n\ncommands.banip.invalid=無効なIPアドレスが入力されたか、プレイヤーがオンラインになっていません\ncommands.banip.success=IPアドレス \"{%0}\" をBANしました。\ncommands.banip.success.players={%1} のIPアドレス {%0} をBANしました\ncommands.banip.usage=/ban-ip <IPアドレス|プレイヤー名> [理由]\n\ncommands.unbanip.invalid=無効なIPアドレスです\ncommands.unbanip.success=IPアドレス {%0} のBANが解除されました\ncommands.unbanip.usage=/pardon-ip <IPアドレス>\n\ncommands.banipbyname.success=プレイヤー {%0}の IPはBANされました。\ncommands.banipbyname.usage=/banipbyname <プレイヤー>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=ワールドの自動保存を有効にしました\ncommands.save.disabled=ワールドの自動保存を無効にしました\ncommands.save.start=保存中…\ncommands.save.success=ワールドを保存しました\n\ncommands.setblock.usage=/setblock <x> <y> <z> <ブロック名> [データ値]\ncommand.fill.invalidBlock=無効なブロック名/ID\n\ncommands.stop.usage=/stop\ncommands.stop.start=サーバーを停止しています\n\ncommands.kick.success={%0}さんはkickされてゲームから切断しました。\ncommands.kick.success.reason={%0} を {%1} サーバーからキックした\ncommands.kick.usage=/kick <プレイヤー名> [理由...]\n\ncommands.tp.success={%0} から {%1} へワープしました\ncommands.tp.success.coordinates={%0} は {%1}, {%2}, {%3} にテレポートしました\ncommands.tp.usage=/tp [対象のプレイヤー] <移動先のプレイヤー> または /tp [対象のプレイヤー] <x> <y> <z> [<y> <x>のみ]\n\ncommands.whitelist.list=ホワイトリストには {%0} 人 (サーバー全体では {%1} 人) のプレイヤーがいます\ncommands.whitelist.enabled=ホワイトリストを有効にしました\ncommands.whitelist.disabled=ホワイトリストを無効にしました\ncommands.whitelist.reloaded=ホワイトリストを再読み込みしました\ncommands.whitelist.add.success={%0} をホワイトリストに追加しました\ncommands.whitelist.add.usage=/whitelist add <プレイヤー名>\ncommands.whitelist.remove.success={%0} をホワイトリストから削除しました\ncommands.whitelist.remove.usage=/whitelist remove <プレイヤー名>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=ゲームモードを{%2}に変更しました\ncommands.gamemode.success.other={%2}のゲームモードを{%2}に変更しました\ncommands.gamemode.usage=/gamemode <モード> [プレイヤー名]\ncommands.help.header=--- ヘルプページの {%0} / {%1} ページを表示(/help <ページ番号>) ---\ncommands.help.usage=/help [ページ|コマンド名]\ncommands.message.usage=/tell <プレイヤー名> <プライベートメッセージ>\ncommands.message.sameTarget=自分自身にプライベートメッセージを送信することはできません！\ncommands.xp.usage=/xp <経験値またはレベル+L> <プレイヤー名>\n\ncommands.difficulty.usage=/difficulty <難易度>\ncommands.difficulty.success=ゲームの難易度を{%0}に設定しました\n\ncommands.spawnpoint.usage=/spawnpoint [プレイヤー名] [<x><y><z>]\ncommands.spawnpoint.success={%0} のスポーン地点を ({%1}, {%2}, {%3}) に変更しました\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=({%0},{%1},{%2}) にワールドのスポーンポイントを設定します\n\ncommands.summon.usage=/summon [エンティティ名] [<x> <y> <z>] [データタグ]\n\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound={%0} のプレイヤーデータが見つからないため、新たに作成します\npocketmine.data.playerCorrupted={%0} のデータの破損が見つかったため、新たに作成します\npocketmine.data.playerOld={%0} の古いプレイヤーデータが見つかったため、更新します\npocketmine.data.saveError={%0}のデータを保存できませんでした: {%1}\npocketmine.level.notFound=ワールド \"{%0}\" が見つかりません\npocketmine.level.loadError=ワールド \"{%0}\" を読み込むことができませんでした: {%1}\npocketmine.level.generationError=ワールド\"{%0}\"を生成することができませんでした: {%1}\npocketmine.level.tickError=ワールド \"{%0}\" をチェックすることができませんでした: {%1}\npocketmine.level.chunkUnloadError=チャンクの書き込み中にエラーが発生しました: {%0}\npocketmine.level.backgroundGeneration=ワールド\"{%0}\"の地形をバックグラウンドで生成しています\npocketmine.level.defaultError=デフォルトのワールドが読み込まれていません\npocketmine.level.preparing=ワールド \"{%0}\" を読み込んでいます\npocketmine.level.unloading=ワールド\"{%0}\"の書き込みをしています\npocketmine.server.start=Minecraft: PEサーバー({%0}に対応)を起動しています\npocketmine.server.networkError=[Network] {%1}によって{%0}のインターフェイスが停止しました\npocketmine.server.networkStart={%0}:{%1}上でサーバーを開始しています\npocketmine.server.info=このサーバーは{%0}のバージョン{%1}「{%2}」(API {%3})で動作しています\n\npocketmine.server.info.extended.title=-----サーバーの情報-----\npocketmine.server.info.extended1=このサーバーは {%0}{%1} を実行しています (コードネーム \"{%2}\")\npocketmine.server.info.extended2=PHPバージョン: {%0}\npocketmine.server.info.extended3=API: {%0} (iTX APIバージョン {%1})\npocketmine.server.info.extended4=目的のクライアント: Minecraft PE {%0} (プロトコルバージョン {%1})\n\npocketmine.server.license={%0}はLGPLライセンスに基づき配布されています\npocketmine.server.tickOverload=注意！ サーバーが高負荷になっている可能性があります\npocketmine.server.startFinished=起動完了({%0}秒)！ \"help\"または\"?\"でヘルプを表示\npocketmine.server.defaultGameMode=デフォルトゲームタイプ: {%0}\npocketmine.server.query.start=GS4ステータス リスナーを開始\npocketmine.server.query.info=クエリポートを設定: {%0}\npocketmine.server.query.running=クエリーは {%0}:{%1} で動作しています\n\npocketmine.command.alias.illegal=無効な文字が含まれているため、{%0}を登録できませんでした\npocketmine.command.alias.notFound=存在しないコマンドが含まれているため、{%0}を登録できませんでした: {%1}\npocketmine.command.exception=コマンド'{%0}'を{%1}で実行中に、処理できない例外が発生：{%2}\n\npocketmine.command.plugins.description=サーバー上で実行されているプラグインを一覧にして表示します\npocketmine.command.plugins.success=プラグイン ({%0}): {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=サーバーの設定やプラグインを再読み込みします\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=サーバーを再読み込みしています...\npocketmine.command.reload.reloaded=再読み込みが完了しました\n\npocketmine.command.status.description=サーバーのパフォーマンスを読み出します\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=サーバーステータス\npocketmine.command.status.player=プレイヤー人数:\npocketmine.command.status.days=日数\npocketmine.command.status.hours=時間\npocketmine.command.status.minutes=分\npocketmine.command.status.seconds=秒\npocketmine.command.status.uptime=起動時間:\npocketmine.command.status.AverageTPS=平均のTPS:\npocketmine.command.status.CurrentTPS=現在のTPS:\npocketmine.command.status.Networkupload=ネットワークアップロード:\npocketmine.command.status.Networkdownload=ネットワークダウンロード:\npocketmine.command.status.Threadcount=スレッド数:\npocketmine.command.status.Mainmemory=メインスレッド数:\npocketmine.command.status.Totalmemory=合計のメモリ使用量:\npocketmine.command.status.Totalvirtualmemory=合計の仮想メモリ使用量:\npocketmine.command.status.Heapmemory=ヒープ領域:\npocketmine.command.status.Maxmemorysystem=最大メモリ (システム):\npocketmine.command.status.Maxmemorymanager=最大メモリ (マネージャー):\npocketmine.command.status.World=ワールド\npocketmine.command.status.chunks=チャンク,\npocketmine.command.status.entities=エンティティ,\npocketmine.command.status.tiles=タイル.\npocketmine.command.status.Time=時間\npocketmine.command.status.ms=ms\n\npocketmine.command.gc.description=ガベージコレクションのタスクを起動\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=コレクションレポート\npocketmine.command.gc.chunks=チャンク:\npocketmine.command.gc.entities=エンティティ:\npocketmine.command.gc.tiles=タイル:\npocketmine.command.gc.cycles=サイクル:\npocketmine.command.gc.memory=解放されたメモリ:\n\npocketmine.command.timings.description=サーバーのパフォーマンスを確認する記録のタイミングを設定します\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=タイミングをリセット及び有効にしました\npocketmine.command.timings.disable=タイミングを無効にしました\npocketmine.command.timings.timingsDisabled=/timings と入力してタイミングを有効にしてください\npocketmine.command.timings.reset=タイミングをリセットしました\npocketmine.command.timings.pasteError=レポートのペースト中にエラーが発生しました\npocketmine.command.timings.timingsUpload=タイミングを{%0}にアップロードします\npocketmine.command.timings.timingsRead=結果は {%0} で見ることができます\npocketmine.command.timings.timingsWrite=タイミングを {%0} に書き込んでいます\npocketmine.command.version.description=使用しているプラグインを含めたこのサーバーのバージョンを取得します\npocketmine.command.version.usage=/version [プラグイン名]\npocketmine.command.version.noSuchPlugin=このサーバーではその名前のどのプラグインも実行しまいません プラグインリストを取得するには /plugins を使用してください\npocketmine.command.give.description=指定したプレイヤーに一定量のアイテムを付与します\npocketmine.command.give.usage=/give <プレイヤー名> <アイテム[:ダメージ値]> [量] [タグ]\npocketmine.command.kill.description=自殺または他のプレイヤーを殺すことができます\npocketmine.command.kill.usage=/kill [プレイヤー名]\npocketmine.command.particle.description=ワールドにパーティクルを追加します\npocketmine.command.particle.usage=/particle <パーティクル名> <x> <y> <z> <xd> <yd> <zd> [量] [データ値]\npocketmine.command.time.description=それぞれのワールドの時間を変更します\npocketmine.command.time.usage=/time <set|add> <値> または /time <start|stop|query>\npocketmine.command.bancidbyname.description=指定したCIDをプレイヤー名によってサーバーの使用を拒否します\npocketmine.command.bancid.description=指定したCIDからのサーバーの使用を拒否します\npocketmine.command.banipbyname.description=指定したIPアドレスをプレイヤー名によってサーバーの使用を拒否します\npocketmine.command.ban.player.description=指定したプレーヤーのサーバーの使用を拒否します\npocketmine.command.ban.ip.description=指定したIPアドレスからのサーバーの使用を拒否します\npocketmine.command.banlist.description=このサーバーでBANされたすべてのプレイヤーを表示します\npocketmine.command.defaultgamemode.description=デフォルトのゲームモードを設定します\npocketmine.command.deop.description=指定プレイヤーのOP権限を剥奪します\npocketmine.command.difficulty.description=ゲーム難易度を設定します\npocketmine.command.enchant.description=アイテムにエンチャントを付加します\npocketmine.command.effect.description=プレイヤーに効果を付与/削除します\npocketmine.command.gamemode.description=プレイヤーのゲームモードを変更します\npocketmine.command.help.description=ヘルプメニューを表示します\npocketmine.command.kick.description=指定したプレイヤーをサーバーから追い出します\npocketmine.command.list.description=サーバーに接続しているプレイヤーを一覧表示します\npocketmine.command.me.description=チャットで指定したアクションを実行します\npocketmine.command.op.description=指定したプレイヤーにOP権限を付与します\npocketmine.command.unban.cid.description=指定したCIDのBANを解除します\npocketmine.command.unban.player.description=指定したプレイヤーのBANを解除します\npocketmine.command.unban.ip.description=指定したIPアドレスのBANを解除します\npocketmine.command.save.description=サーバーを保存します\npocketmine.command.saveoff.description=サーバーの自動保存を無効にします\npocketmine.command.saveon.description=サーバーの自動保存を有効にします\npocketmine.command.say.description=送信者として指定したメッセージを送信します\npocketmine.command.seed.description=ワールドのシード値を表示します\npocketmine.command.setworldspawn.description=ワールドのスポーン地点を設定します 座標が指定されていない場合はプレイヤーの現在地の座標が使用されます\npocketmine.command.spawnpoint.description=プレイヤーのスポーン地点を設定します\npocketmine.command.stop.description=サーバーを停止します\npocketmine.command.tp.description=他のプレイヤーまたは指定した座標にプレイヤー(または自分自身)をテレポートさせます\npocketmine.command.tell.description=指定したプレイヤーにプライベートメッセージを送信します\npocketmine.command.xp.description=指定プレイヤーに経験値またはレベルを増加する\npocketmine.command.summon.description=プレーヤーの場所または特定の場所での実体を召喚\npocketmine.command.fill.description=指定した範囲を、指定するブロックIDで置換します。\npocketmine.command.setblock.description=指定した座標にブロックを配置します。\n\npocketmine.command.weather.description=ワールドの天気をセットします\npocketmine.command.weather.usage=/weather <level-name weather|weather>\npocketmine.command.weather.changed=ワールド {%0} で天気の変更に成功しました!\npocketmine.command.weather.noregistered=ワールド {%0} はWeatherManagerに登録されていません\npocketmine.command.weather.invalid=不正な天気。(0,1,2,3)\npocketmine.command.weather.wrong=間違ったパラメーター.\npocketmine.command.weather.invalid.level=不正なワールド名。\n\npocketmine.command.whitelist.description=このサーバーの利用を許可するプレイヤーリストを管理します\npocketmine.crash.create=リカバリー不可能なエラーが発生し、サーバーがクラッシュ（動作を停止）しました。クラッシュダンプを作成しました\npocketmine.crash.error=クラッシュダンプの作成に失敗: {%0}\npocketmine.crash.submit=「{%0}」のファイルをクラッシュアーカイブにアップロードし、そのリンクを送ってください 出来る限り多くの情報を記載してください\npocketmine.crash.archive=クラッシュダンプが自動的にクラッシュアーカイブに提出されました {%0}で閲覧またはID #{%1}を使用可能です\npocketmine.debug.enable=LevelDB形式の対応を有効にしました\npocketmine.player.invalidMove={%0} が正しく移動できませんでした！\npocketmine.player.logIn={%0}[/{%1}:{%2}] [クライアントID: {%3}] エンティティId {%4} として{%9}で ({%5}, {%6}, {%7}, {%8}) に入室しました。\npocketmine.player.logOut={%0}[/{%1}:{%2}] は {%3} で退出しました。\npocketmine.player.transferred={%0}[/{%1}:{%2}] は {%3}に転送されました。\npocketmine.player.invalidEntity={%0} は無効なエンティティに攻撃しました\npocketmine.plugin.load={%0} を読み込み中...\npocketmine.plugin.enable={%0}を有効にしています…\npocketmine.plugin.disable={%0}を無効にしています…\npocketmine.plugin.restrictedName=不審な名前\npocketmine.plugin.incompatibleAPI=互換性がないAPIバージョン\npocketmine.plugin.unknownDependency=不明な依存関係\npocketmine.plugin.circularDependency=循環依存が検出されました\npocketmine.plugin.genericLoadError=プラグイン'{%0}'の読み込みに失敗しました\npocketmine.plugin.spacesDiscouraged=プラグイン'{%0}'の名前に空白が使用されていますが、これはおすすめしません\npocketmine.plugin.loadError=プラグイン'{%0}'を読み込むことができませんでした: {%1}\npocketmine.plugin.duplicateError=プラグイン'{%0}'を読み込むことができませんでした: 同じプラグインが存在します\npocketmine.plugin.fileError=フォルダー'{%0}'内の'{%1}'を読み込むことができませんでした: {%2}\npocketmine.plugin.commandError=プラグイン{%1}のコマンド{%0}を読み込むことができませんでした\npocketmine.plugin.aliasError=プラグイン {%1} で、コマンド{%0} に対するエイリアスを登録できませんでした\npocketmine.plugin.deprecatedEvent=プラグイン'{%0}'がメソッド'{%2}'に'{%1}'のリスナーを登録しましたが、イベントが廃止されました\npocketmine.plugin.eventError=\"'{%1}'に'{%0}'Eventを渡すことができませんでした: {%3}での{%2}\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/kor.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers\n#\n# A message doesn't need to be there to be shown correctly on the client.\n# Only messages shown in PocketMine itself need to be here\n\nlanguage.name=\"한국어 | Johnmacrocraft가 번역, ParkChanSol이 도움\"\nlanguage.selected={%0} ({%1})(이)가 기본 언어로 설정되었습니다.\n\nmultiplayer.player.joined={%0} 님이 게임에 접속했습니다\nmultiplayer.player.left={%0}님이 게임에서 나갔습니다\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0}님이 업적 {%1}을(를) 달성했습니다\n\ndisconnectionScreen.notAuthenticated=Xbox 로그인이 필요합니다!\ndisconnectionScreen.outdatedClient=오래된 클라이언트입니다!\ndisconnectionScreen.outdatedServer=오래된 서버입니다!\ndisconnectionScreen.serverFull=서버 최대 인원 수를 초과하였습니다.\ndisconnectionScreen.noReason=서버와의 연결이 끊어졌습니다.\ndisconnectionScreen.invalidSkin=올바르지 않거나 지원되지 않는 스킨입니다.\ndisconnectionScreen.invalidName=올바르지 않거나 잘못된 형식의 이름입니다!\n\ndeath.fell.accident.generic={%0} 님이 높은 곳에서 떨어졌습니다\ndeath.attack.inFire={%0} 님이 불에 타 죽었습니다\ndeath.attack.onFire={%0} 님이 불에 타서 죽었습니다\ndeath.attack.lava={%0} 님이 용암에 빠져 죽었습니다\ndeath.attack.inWall={%0} 님이 벽에 끼어 질식사했습니다\ndeath.attack.drown={%0} 님이 익사했습니다\ndeath.attack.cactus={%0} 님이 가시에 찔려서 사망했습니다\ndeath.attack.generic={%0} 님이 사망했습니다\ndeath.attack.explosion={%0}님이 폭발로 인해 사망하셨습니다.\ndeath.attack.explosion.player={%0} 님이 {%1} 님에 의해 폭사했습니다\ndeath.attack.magic={%0}님이 마법에 의해 죽었습니다\ndeath.attack.wither={%0} 님이 말라서 죽었습니다\ndeath.attack.mob={%0} 님이 {%1} 에게 살해당했습니다\ndeath.attack.player={%0} 님이 {%1} 에게 살해당했습니다\ndeath.attack.player.item={%0} 님이 {%1} 님에게 {%2} (으)로 살해당했습니다\ndeath.attack.arrow={%0} 님이 {%1} 님에게 저격당했습니다\ndeath.attack.arrow.item={%0}님이 {%1}님에게 {%2}(으)로 저격당했습니다.\ndeath.attack.fall={%0} 님이 너무 높은 곳에서 떨어져 사망했습니다\ndeath.attack.outOfWorld={%0} 님이 세계 밖으로 떨어져서 사망했습니다\n\ngameMode.survival=서바이벌 모드\ngameMode.creative=크리에이티브 모드\ngameMode.adventure=모험 모드\ngameMode.spectator=관전 모드\ngameMode.changed=게임 모드가 변경되었습니다\n\npotion.moveSpeed=신속\npotion.moveSlowdown=구속\npotion.digSpeed=성급함\npotion.digSlowDown=피로\npotion.damageBoost=힘\npotion.heal=즉시 회복\npotion.harm=즉시 데미지\npotion.jump=점프 강화\npotion.confusion=멀미\npotion.regeneration=재생\npotion.resistance=저항\npotion.fireResistance=화염 저항\npotion.waterBreathing=수중 호흡\npotion.invisibility=투명화\npotion.blindness=실명\npotion.nightVision=야간 투시\npotion.hunger=허기\npotion.weakness=나약함\npotion.poison=독\npotion.wither=위더\npotion.healthBoost=체력 강화\npotion.absorption=흡수\npotion.saturation=포화\n\ncommands.generic.exception=이 명령을 수행하는 동안 알 수 없는 오류가 발생했습니다\ncommands.generic.permission=이 명령을 사용할 수 있는 권한이 없습니다\ncommands.generic.notFound=알 수 없는 명령입니다. /help 로 명령어 목록을 보세요\ncommands.generic.player.notFound=플레이어를 찾을 수 없습니다\ncommands.generic.usage=사용법: {%0}\ncommands.generic.level=레벨 이름\ncommands.generic.seed=시드 이름\ncommands.generic.name=이름\ncommands.generic.generator=생성기 이름\ncommands.generic.opt.missing=필요한 속성이 없습니다. 확인하고 다시 입력해 주세요.\ncommands.generic.runingame=게임 안에서 이 명령어를 사용해 주세요.\n\ncommands.time.added=시간을 {%0}만큼 추가하였습니다\ncommands.time.set={%0}으로 시간을 설정하였습니다\ncommands.time.query=현재 시간은 {%0}입니다\n\ncommands.me.usage=/me <행동>\n\ncommands.give.item.notFound={%0}의 이름을 가진 아이템이 없습니다\ncommands.give.success={%2}님에게 {%0}을(를) {%1}개 주었습니다\ncommands.give.tagError=데이터 태그 분석 실패: {%0}\n\ncommands.effect.usage=/effect <유저명> <효과명> [초] [증폭] [입자 숨김] 또는 /effect <유저명> clear (효과 없애기)\ncommands.effect.notFound=효과 ID {%0}는 존재하지 않습니다\ncommands.effect.success=효과 {%0} (ID {%1} * {%2})를 {%3}에게 {%4}초간 주었습니다\ncommands.effect.success.removed= {%1}님에게서 효과 {%0}을(를) 제거하였습니다.\ncommands.effect.success.removed.all={%0} 님의 모든 효과를 제거하였습니다.\ncommands.effect.failure.notActive={%1}님에게 {%0}효과를 뺏을 수 없습니다, 어떤 효과도 걸려있지 않습니다.\ncommands.effect.failure.notActive.all={%0}님에게 어떠한 효과도 걸려있지 않기 때문에 효과를 뺏을 수 없습니다\n\ncommands.enchant.noItem=대상이 아이템을 들고 있지 않아 마법을 부여 할 수 없습니다\ncommands.enchant.notFound=ID가 {%0} 인 마법 부여 효과는 없습니다\ncommands.enchant.success=마법 부여를 완료하였습니다\ncommands.enchant.cantEnchant=선택한 마법 부여는 대상 아이템에 추가될 수 없습니다\ncommands.enchant.usage=/enchant <플레이어> <마법 부여 ID> [레벨]\ncommands.particle.success={%0}효과를 {%1} 초간 지속합니다\ncommands.particle.notFound={%0}는 알 수 없는 효과명입니다\ncommands.players.usage=/list\ncommands.players.list=현재 {%0}/{%1} 명이 접속 중입니다:\ncommands.kill.successful={%0}님을 죽였습니다\ncommands.banlist.ips=총 %d개의 차단된 IP 주소들이 있습니다:\ncommands.banlist.players=총 {%0}명의 차단된 플레이어가 있습니다:\ncommands.banlist.cids=총 {%0}개의 차단된 CID들이 있습니다:\ncommands.banlist.usage=/banlist [아이피|플레이어 이름]\ncommands.defaultgamemode.usage=/defaultgamemode <게임 모드>\ncommands.defaultgamemode.success=기본 게임모드가 {%0}로 변경되었습니다.\n\ncommands.op.success={%0}을 OP로 설정하였습니다\ncommands.op.usage=/op <플레이어>\n\ncommands.deop.success={%0}님의 OP 권한을 박탈하였습니다\ncommands.deop.usage=/deop <플레이어>\n\ncommands.say.usage=/say <메시지 ...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=시드: {%0}\n\ncommands.bancidbyname.success=플레이어 {%0}님의 CID를 차단하였습니다\ncommands.bancidbyname.usage=/bancidbyname <플레이어 이름>\n\ncommands.bancid.success=CID 차단: {%0}\ncommands.bancid.usage=/bancid <클라이언트 ID>\n\ncommands.unbancid.usage=/pardoncid <클라이언트 ID>\ncommands.unbancid.success=CID {%0}의 차단을 해제하였습니다\n\ncommands.ban.success=플레이어 {%0}를 차단하였습니다\ncommands.ban.usage=/ban <이름> [사유 ...]\n\ncommands.unban.success=플레이어 {%0}님을 차단 해제하였습니다\ncommands.unban.usage=/pardon <차단 해제할 플레이어 이름>\n\ncommands.banip.invalid=잘못된 IP 주소이거나 현재 접속해있지 않은 플레이어입니다\ncommands.banip.success=IP 주소 {%0}을(를) 차단하였습니다\ncommands.banip.success.players={%1}님의 IP 주소 {%0}을(를) 차단하였습니다\ncommands.banip.usage=/ban-ip <IP 주소|이름> [사유 ...]\n\ncommands.unbanip.invalid=잘못된 IP 주소를 입력하였습니다\ncommands.unbanip.success=IP 주소 {%0}의 차단을 해제하였습니다\ncommands.unbanip.usage=/pardon-ip <IP 주소>\n\ncommands.banipbyname.success=플레이어 {%0}님의 IP를 차단하였습니다\ncommands.banipbyname.usage=/banipbyname <플레이어 이름>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=월드 자동 저장 기능을 활성화하였습니다\ncommands.save.disabled=월드 자동 저장 기능을 비활성화하였습니다\ncommands.save.start=월드를 저장 중...\ncommands.save.success=월드를 저장했습니다\n\ncommands.setblock.usage=/setblock <x> <y> <z> <블럭 이름> [손상 정도]\ncommand.setblock.invalidBlock=잘못된 블럭 이름/ID입니다\n\ncommands.stop.usage=/stop\ncommands.stop.start=서버를 끄는 중입니다\n\ncommands.kick.success={%0}을 게임에서 강제 추방시켰습니다\ncommands.kick.success.reason={%0}님이 강제 추방되셨습니다. (사유: {%1})\ncommands.kick.usage=/kick <플레이어> [사유 ...]\n\ncommands.tp.success={%0}을(를) {%1}(으)로 이동시켰습니다\ncommands.tp.success.coordinates={%0}님을 X:{%1}, Y:{%2}, Z:{%3}(으)로 이동시켰습니다\ncommands.tp.usage=/tp [이동시킬 플레이어] <도착 지점 플레이어> 또는 /tp [이동시킬 플레이어] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=(보여진 {%1} 중) {%0}명의 화이트리스트 된 플레이어가 있습니다:\ncommands.whitelist.enabled=화이트리스트 기능을 활성화하였습니다\ncommands.whitelist.disabled=화이트리스트 기능을 비활성화하였습니다\ncommands.whitelist.reloaded=화이트리스트를 새로고침하였습니다.\ncommands.whitelist.add.success={%0}님을 화이트리스트에 추가하였습니다\ncommands.whitelist.add.usage=/whitelist add <플레이어>\ncommands.whitelist.remove.success={%0}님을 화이트리스트에서 삭제하였습니다\ncommands.whitelist.remove.usage=/whitelist remove <플레이어명>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=자신의 게임 모드를 {%2}으로 설정하였습니다\ncommands.gamemode.success.other={%1}님의 게임 모드를 {%2}로 설정했습니다\ncommands.gamemode.usage=/gamemode <모드> [플레이어명]\ncommands.help.header=--- 전체 페이지 {%1} 중 {%0}번째 페이지 (/help <페이지>) ---\ncommands.help.usage=/help [페이지|명령어]\ncommands.message.usage=/tell <플레이어> <비밀 메시지 ...>\ncommands.message.sameTarget=자기 자신에게 비밀 메시지를 보낼 수 없습니다!\n\ncommands.difficulty.usage=/difficulty <난이도>\ncommands.difficulty.success=게임 난이도를 {%0}(으)로 설정하였습니다\n\ncommands.spawnpoint.usage=/spawnpoint [플레이어] [<x> <y> <z>]\ncommands.spawnpoint.success={%0}의 스폰 위치를 ({%1}, {%2}, {%3})로 설정하였습니다\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=월드의 스폰 지점을 ({%0}, {%1}, {%2})로 설정하였습니다\n\ncommands.summon.usage=/summon [엔티티] [<x> <y> <z>] [NBTTag]\n\ncommands.xp.failure.withdrawXp=0보다 작은 경험치는 줄 수 없습니다\ncommands.xp.success=%s에게 경험치 %s을(를) 주었습니다\ncommands.xp.success.levels=%s에게 %s 레벨이 지급되었습니다\ncommands.xp.success.negative.levels=%s의 레벨을 %s 낮추었습니다\ncommands.xp.usage=/xp <수량> [플레이어] 또는 /xp <수량>L [플레이어]\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=플레이어 \"{%0}\"님의 데이터를 찾지 못했습니다. 새 프로필을 생성합니다.\npocketmine.data.playerCorrupted=플레이어 \"{%0}\"님의 데이터가 손상되었습니다. 새로운 프로필을 생성합니다.\npocketmine.data.playerOld=플레이어 \"{%0}\"님의 데이터가 오래되었습니다. 프로필을 업데이트합니다.\npocketmine.data.saveError=플레이어 \"{%0}\"님의 데이터를 저장하지 못했습니다: {%1}\npocketmine.level.notFound=\"{%0}\" 월드를 찾지 못했습니다\npocketmine.level.loadError=월드 \"{%0}\"를(을) 불러오지 못했습니다: {%1}\npocketmine.level.generationError=월드 \"{%0}\"를(을) 생성하지 못했습니다: {%1}\npocketmine.level.tickError=\"{%0}\" 월드의 틱을 처리하지 못했습니다: {%1}\npocketmine.level.chunkUnloadError=청크 언로드 중 오류가 발생했습니다: {%0}\npocketmine.level.backgroundGeneration=월드 \"{%0}\"의 스폰 지형이 백그라운드에서 생성됩니다...\npocketmine.level.defaultError=기본 월드를 찾을 수 없습니다 \npocketmine.level.preparing=월드 \"{%0}\"를(을) 준비 중입니다...\npocketmine.level.unloading=월드 \"{%0}\"를(을) 언로드 중입니다...\npocketmine.server.start=마인크래프트: 포켓 에디션 (버전 {%0}용) 서버를 시작 중입니다...\npocketmine.server.networkError=[Network] 인터페이스 {%0}가 {%1}로 인해 작동 중단되었습니다.\npocketmine.server.networkStart=서버를 {%0}:{%1}에서 여는 중입니다\npocketmine.server.info=이 서버는 {%0} (버전 {%1} \"{%2}\" (API {%3}))을 구동 중입니다\n\npocketmine.server.info.extended.title=-----서버 정보-----\npocketmine.server.info.extended1=이 서버는 {%0}{%1} (코드네임 \"{%2}\")을 구동 중입니다\npocketmine.server.info.extended2=PHP 버전: {%0}\npocketmine.server.info.extended3=API: {%0} (iTX API 버전 {%1})\npocketmine.server.info.extended4=대상 클라이언트: Minecraft PE {%0} (프로토콜 버전 {%1})\n\npocketmine.server.license={%0}는(은) LGPL 라이센스 하에서 배포됩니다\npocketmine.server.tickOverload=서버 처리 속도가 느려졌습니다. 서버가 과부하되었는지 확인해주시기 바랍니다.\npocketmine.server.startFinished=서버 구동 준비 완료! :D ({%0}초) 명령어 목록을 확인하시려면 \"help\" 또는 \"?\"를 입력해 주세요.\npocketmine.server.defaultGameMode=기본 게임 모드: {%0}\npocketmine.server.query.start=GS4 쿼리 리스너를 시작 중입니다\npocketmine.server.query.info=쿼리 포트를 {%0}로 설정합니다\npocketmine.server.query.running=쿼리 서버가 {%0}:{%1}에서 실행 중입니다\n\npocketmine.command.alias.illegal=명령어 별칭 {%0}을 등록하지 못했습니다. 잘못된 문자를 포함하고 있습니다.\npocketmine.command.alias.notFound=명령어 별칭 {%0}을 등록하지 못했습니다. 존재하지 않는 명령어를 포함합니다: {%1}\npocketmine.command.exception=플러그인 {%1}에서 명령어 '{%0}'을 실행하는 중 예외가 발생했습니다: {%2}\n\npocketmine.commands.cave.usage=/cave <회전 각도> <길이> <지점 번호> <강도> <X> <Y> <Z> <레벨 이름> | /cave getmypos\npocketmine.commands.cave.info=회전 각도:{%0} 길이:{%1} 지점 번호:{%2} 강도:{%3}\npocketmine.commands.cave.start=동굴을 생성하는 중입니다. 잠시만 기다리세요\npocketmine.commands.cave.success=동굴이 생성되었습니다\n\npocketmine.command.plugins.description=서버에서 실행 중인 플러그인 목록을 불러옵니다.\npocketmine.command.plugins.success=플러그인 목록 (전체 {%0}개): {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=서버 설정과 플러그인을 다시 불러옵니다.\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=서버를 다시 불러오는 중입니다...\npocketmine.command.reload.reloaded=서버 설정을 다시 불러왔습니다.\n\npocketmine.command.lvdat.description=맵의 속성을 변경합니다.\npocketmine.command.lvdat.changed=레벨 \"{%0}\"의 {%1}(을)를 변경하였습니다. 일부 변경은 서버 재부팅이 필요합니다.\npocketmine.command.lvdat.fixname=성공적으로 레벨 \"{%0}\"의 이름을 변경하였습니다. 일부 변경은 서버 재부팅이 필요합니다.\npocketmine.command.lvdat.nofound=레벨 \"{%0}\"이 없거나 로드하지 못했습니다.\npocketmine.command.lvdat.preset=생성기 설정 (프리셋)\n\npocketmine.command.status.description=서버의 현재 상태를 확인합니다 (TPS 등)\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=서버 상태\npocketmine.command.status.player=플레이어 수:\npocketmine.command.status.days=일\npocketmine.command.status.hours=시간\npocketmine.command.status.minutes=분\npocketmine.command.status.seconds=초\npocketmine.command.status.uptime=작업 시간:\npocketmine.command.status.AverageTPS=평균 TPS:\npocketmine.command.status.CurrentTPS=현재 TPS:\npocketmine.command.status.Networkupload=네트워크 업로드:\npocketmine.command.status.Networkdownload=네트워크 다운로드:\npocketmine.command.status.Threadcount=스레드 수:\npocketmine.command.status.Mainmemory=메인 스레드 메모리:\npocketmine.command.status.Totalmemory=총 메모리:\npocketmine.command.status.Totalvirtualmemory=총 가상 메모리:\npocketmine.command.status.Heapmemory=힙 메모리:\npocketmine.command.status.Maxmemorysystem=최대 메모리 (시스템):\npocketmine.command.status.Maxmemorymanager=최대 메모리 (관리자):\npocketmine.command.status.World=월드\npocketmine.command.status.chunks=청크,\npocketmine.command.status.entities=엔티티,\npocketmine.command.status.tiles=타일.\npocketmine.command.status.Time=시간\npocketmine.command.status.ms=ms\n\npocketmine.command.gc.description=가비지 컬렉션 작업을 시작합니다\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=모음 보고서\npocketmine.command.gc.chunks=청크:\npocketmine.command.gc.entities=엔티티:\npocketmine.command.gc.tiles=타일:\npocketmine.command.gc.cycles=주기:\npocketmine.command.gc.memory=릴리스 메모리:\n\npocketmine.command.biome.description=영역의 바이옴을 변경합니다.(눈 또는 비 변경)\npocketmine.command.biome.posset=위치 {%3}(을)를 다음 위치로 설정하였습니다:({%1},{%2})[{%0}]\npocketmine.command.biome.get=현재 당신이 계신 바이옵의 ID는 {%0}입니다. 색상:{%1},{%2},{%3}\npocketmine.command.biome.wrongLev=포인트를 각자 다른 레벨에서 설정할 수 없습니다.\npocketmine.command.biome.wrongBio=잘못된 바이옴의 ID입니다. e.g. 1 (평야), 2 (사막)，13 (얼음 산)，6 (습지대)\npocketmine.command.biome.wrongCol=잘못된 색입니다. e.g. 146,188,89 .\"/biome get\"을 사용하여 다른 색을 가져오세요.\npocketmine.command.biome.noPos=영역을 선택하려면 먼저 \"/biome pos1|pos2\"를 사용해주세요.\npocketmine.command.biome.set=바이옴을 다음으로 설정하였습니다：{%0}\npocketmine.command.biome.color=색을 다음으로 설정하였습니다：{%0},{%1},{%2}\n\npocketmine.command.timings.description=서버 성능 확인을 위해 타이밍을 기록합니다.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=타이밍 & 초기화 기능을 활성화하였습니다\npocketmine.command.timings.disable=타이밍이 비활성화되었습니다.\npocketmine.command.timings.timingsDisabled=/timings on를 사용하여 타이밍 기능을 활성화해주세요.\npocketmine.command.timings.reset=타이밍을 초기화하였습니다\npocketmine.command.timings.pasteError=보고 목록에 붙이는 동안 에러가 발생 하였습니다.\npocketmine.command.timings.timingsUpload=타이밍이 {%0}로 업로드가 되었습니다.\npocketmine.command.timings.timingsRead=당신은 {%0} 에서 결과를 읽을수 있습니다.\npocketmine.command.timings.timingsWrite=타이밍이 {%0}에 써졌습니다.\npocketmine.command.version.description=현재 구동되고 있는 서버 버전과 플러그인 정보를 출력합니다.\npocketmine.command.version.usage=/version [플러그인 이름]\npocketmine.command.version.noSuchPlugin=입력하신 플러그인을 찾을 수 없습니다. /plugins를 입력해 플러그인 목록을 확인하세요.\npocketmine.command.give.description=해당 플레이어에게 아이템을 지정한 양만큼 줍니다\npocketmine.command.give.usage=/give <플레이어> <아이템[:손상 정도]> [양] [태그...]\npocketmine.command.kill.description=자신 또는 다른 플레이어를 죽입니다\npocketmine.command.kill.usage=/kill [죽일 플레이어]\npocketmine.command.particle.description=월드에 파티클을 추가합니다.\npocketmine.command.particle.usage=/particle <이름> <x> <y> <z> <xd> <yd> <zd> [양] [데이터]\npocketmine.command.time.description=월드 시간을 변경합니다.\npocketmine.command.time.usage=/time <set|add> <값> 또는 /time <start|stop|query>\npocketmine.command.bancidbyname.description=지정된 플레이어의 CID가 서버에 접속할 수 없게 차단합니다\npocketmine.command.bancid.description=지정된 CID가 서버에 들어오지 못하게 차단합니다\npocketmine.command.banipbyname.description=지정된 플레이어의 IP 주소가 서버에 접속할 수 없게 차단합니다\npocketmine.command.ban.player.description=지정된 플레이어가 서버에 들어오지 못하게 차단합니다\npocketmine.command.ban.ip.description=지정된 IP 주소가 서버에 접속할 수 없게 차단합니다\npocketmine.command.banlist.description=이 서버에서 차단한 모든 플레이어 목록을 보여줍니다.\npocketmine.command.defaultgamemode.description=기본 게임모드를 설정합니다\npocketmine.command.deop.description=지정된 플레이어의 OP 권한을 해제합니다\npocketmine.command.difficulty.description=게임의 난이도를 설정합니다.\npocketmine.command.enchant.description=아이템에 마법을 부여합니다\npocketmine.command.effect.description=플레이어에게 효과를 부여하거나 제거합니다.\npocketmine.command.gamemode.description=지정된 플레이어의 게임 모드를 변경합니다\npocketmine.command.help.description=모든 명령어 목록을 보여줍니다.\npocketmine.command.kick.description=해당 플레이어를 서버에서 퇴장시킵니다\npocketmine.command.list.description=현재 접속 중인 플레이어의 목록을 보여줍니다\npocketmine.command.me.description=채팅에서 지정된 동작을 합니다\npocketmine.command.op.description=지정된 플레이어에게 OP 권한을 부여합니다\npocketmine.command.unban.cid.description=지정된 CID가 서버를 이용할 수 있도록 차단 해제합니다\npocketmine.command.unban.player.description=해당 플레이어의 차단을 해제합니다.\npocketmine.command.unban.ip.description=지정된 IP 주소가 서버를 이용할 수 있도록 차단 해제합니다\npocketmine.command.save.description=서버를 디스크에 저장합니다\npocketmine.command.saveoff.description=서버 자동 저장을 비활성화합니다\npocketmine.command.saveon.description=서버 자동 저장을 활성화합니다\npocketmine.command.say.description=입력된 메시지를 서버 전체에 표시합니다\npocketmine.command.seed.description=월드의 시드를 보여줍니다.\npocketmine.command.setworldspawn.description=월드의 부활 지점을 지정합니다. 좌표를 입력하지 않으면 현재 플레이어의 좌표로 지정됩니다.\npocketmine.command.spawnpoint.description=플레이어의 부활 지점을 정합니다\npocketmine.command.stop.description=서버를 정지합니다\npocketmine.command.tp.description=해당 플레이어 (또는 자신을) 지정한 플레이어나 좌표로 이동시킵니다\npocketmine.command.tell.description=해당 플레이어에게 개인 메세지를 보냅니다\npocketmine.command.xp.description=지정한 플레이어에게 경험치 또는 경험치 레벨을 줍니다\npocketmine.command.summon.description=플레이어의 위치나 지정된 위치에 엔티티를 생성합니다\npocketmine.command.fill.description=지정한 영역을 블럭으로 채웁니다\npocketmine.command.setblock.description=블럭을 다른 블럭으로 변경합니다\n\npocketmine.command.weather.description=레벨의 날씨를 설정합니다\npocketmine.command.weather.usage=/weather <레벨 이름 또는 날씨|날씨 (rain|sunny|clear)>\npocketmine.command.weather.changed=성공적으로 레벨 {%0}의 날씨를 변경하였습니다!\npocketmine.command.weather.noregistered=레벨 {%0}(은)는 날씨 관리자에 등록되지 않았습니다.\npocketmine.command.weather.invalid=잘못된 날씨입니다.(0,1,2,3)\npocketmine.command.weather.wrong=잘못된 매개 변수 입니다.\npocketmine.command.weather.invalid.level=올바르지 않은 레벨 이름입니다.\n\npocketmine.command.whitelist.description=서버를 이용할 수 있는 플레이어 목록을 관리합니다\npocketmine.crash.create=복구가 불가능한 오류가 발생하여 서버가 강제로 종료되었습니다. 크래시 덤프를 생성합니다.\npocketmine.crash.error=크래시 덤프를 생성하지 못했습니다: {%0}\npocketmine.crash.submit=\"{%0}\"파일을 Crash Archive에 업로드하고 버그 리포팅 페이지에 링크를 보내 주세요. 가능한 한 많은 정보를 주시면 감사하겠습니다.\npocketmine.crash.archive=크래시 덤프가 자동으로 Crash Archive에 전송되었습니다. {%0}에서 확인하거나 ID #{%1}을 사용하세요.\npocketmine.debug.enable=LevelDB 지원이 활성화되었습니다\npocketmine.player.invalidMove={%0}님이 잘못된 움직임을 보였습니다!\npocketmine.player.logIn={%0}[/{%1}:{%2}] 이 엔티티 ID {%3} (으)로 ({%4}, {%5}, {%6}, {%7})에 접속했습니다\npocketmine.player.logOut={%0}[/{%1}:{%2}] 님의 연결이 끊어졌습니다. 이유: {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] 님이 {%3}로 옮겨졌습니다\npocketmine.player.invalidEntity={%0}이 유효하지 않은 엔티티를 공격하려 시도했습니다\npocketmine.plugin.load=플러그인 {%0}을(를) 로딩 중입니다.\npocketmine.plugin.enable=플러그인 {%0}을(를) 활성화 중입니다\npocketmine.plugin.disable=플러그인 {%0}을(를) 비활성화 중입니다\npocketmine.plugin.restrictedName=제한된 이름입니다!\npocketmine.plugin.incompatibleAPI=호환되지 않는 API 버전입니다!\npocketmine.plugin.unknownDependency=알 수 없는 의존 플러그인입니다!\npocketmine.plugin.circularDependency=의존성 플러그인입니다.\npocketmine.plugin.genericLoadError=플러그인 '{%0}'을(를) 로드하지 못했습니다\npocketmine.plugin.spacesDiscouraged=플러그인 '{%0}'의 이름에 공백 문자가 섞여 있습니다. 이는 권장되지 않습니다.\npocketmine.plugin.loadError=플러그인 '{%0}'을(를) 로드하지 못했습니다: {%1}\npocketmine.plugin.duplicateError=플러그인 '{%0}'을(를) 로드하지 못했습니다: 이미 존재하는 플러그인입니다\npocketmine.plugin.fileError=폴더 '{%1}'에서 플러그인 '{%0}'을(를) 로드하지 못했습니다: {%2}\npocketmine.plugin.commandError=명령어 {%0}을(를) 플러그인 {%1}에서 로드하지 못했습니다\npocketmine.plugin.aliasError=플러그인 {%1}의 명령어 별칭 {%0}을(를) 로드하지 못했습니다\npocketmine.plugin.deprecatedEvent=플러그인 '{%0}'이(가) 이벤트 '{%1}'을(를) 위한 리스너를 메서드 '{%2}'에 대해 추가했지만, 이 이벤트의 사용은 권장되지 않습니다.\npocketmine.plugin.eventError=\"이벤트 '{%0}'을(를) 플러그인 '{%1}'에 전달하지 못했습니다: {%2} ({%3})\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/rus.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers\n#\n# A message doesn't need to be there to be shown correctly on the client.\n# Only messages shown in PocketMine itself need to be here\n\nlanguage.name=Russian\nlanguage.selected=Выбран {%0} ({%1}) в качестве главного языка\n\nmultiplayer.player.joined={%0} присоединился к игре\nmultiplayer.player.left={%0} вышел из игры\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement=Игрок {%0} получил достижение {%1}!\n\ndisconnectionScreen.notAuthenticated=Требуется авторизация в Xbox!\ndisconnectionScreen.outdatedClient=Устаревший клиент!\ndisconnectionScreen.outdatedServer=Устаревший сервер!\ndisconnectionScreen.serverFull=Сервер переполнен!\ndisconnectionScreen.noReason=Отключен от сервера.\ndisconnectionScreen.invalidSkin=Неверный формат скина!\ndisconnectionScreen.invalidName=Недопустимое имя!\n\ndeath.fell.accident.generic={%0} упал с высокого места\ndeath.attack.inFire={%0} сгорел\ndeath.attack.onFire={%0} сгорел\ndeath.attack.lava={%0} решил поплавать в лаве\ndeath.attack.inWall={%0} задохнулся в стене\ndeath.attack.drown={%0} утонул\ndeath.attack.cactus={%0} закололся до смерти\ndeath.attack.generic={%0} умер\ndeath.attack.explosion={%0} взорвался\ndeath.attack.explosion.player={%0} был взорван {%1}\ndeath.attack.magic={%0} убит магией\ndeath.attack.wither={%0} иссушен\ndeath.attack.mob={%0} был убит {%1}\ndeath.attack.player={%0} был убит {%1}\ndeath.attack.player.item={%0} был убит {%1} используя {%2}\ndeath.attack.arrow={%0} был застрелен {%1}\ndeath.attack.arrow.item={%0} был застрелен {%1} используя {%2}\ndeath.attack.fall={%0} упал с высокого места\ndeath.attack.outOfWorld={%0} выпал из мира\n\ngameMode.survival=Режим выживания\ngameMode.creative=Творческий режим\ngameMode.adventure=Приключенческий режим\ngameMode.spectator=Режим наблюдателя\ngameMode.changed=Ваш игровой режим был обновлён\n\npotion.moveSpeed=Скорость\npotion.moveSlowdown=Замедление\npotion.digSpeed=Спешка\npotion.digSlowDown=Усталость\npotion.damageBoost=Сила\npotion.heal=Мгновенное лечение\npotion.harm=Мгновенный Урон\npotion.jump=Усиление прыжка\npotion.confusion=Тошнота\npotion.regeneration=Регенерация\npotion.resistance=Сопротивление урону\npotion.fireResistance=Огнестойкость\npotion.waterBreathing=Подводное дыхание\npotion.invisibility=Невидимость\npotion.blindness=Слепота\npotion.nightVision=Ночное зрение\npotion.hunger=Голод\npotion.weakness=Слабость\npotion.poison=Отравление\npotion.wither=Иссушение\npotion.healthBoost=Повышение здоровья\npotion.absorption=Поглощение\npotion.saturation=Насыщенность\n\ncommands.generic.exception=Произошла неизвестная ошибка при выполнении команды\ncommands.generic.permission=У Вас недостаточно прав для использования этой команды\ncommands.generic.notFound=Неизвестная команда. Используйте /help для списка команд\ncommands.generic.player.notFound=Игрок не найден\ncommands.generic.usage=Использование: {%0}\ncommands.generic.level=level-name\ncommands.generic.seed=seed-name\ncommands.generic.name=name\ncommands.generic.generator=generator-name\ncommands.generic.opt.missing=Требуемые настройки отсутствуют，пожалуйста повторите ввод.\ncommands.generic.runingame=Используйте эту команду в игре.\n\ncommands.time.added=Добавлено {%0} к времени\ncommands.time.set=Установлено время {%0}\ncommands.time.query=Время ‒ {%0}\n\ncommands.me.usage=/me <действие ...>\n\ncommands.give.item.notFound=Предмет с именем {%0} не найден\ncommands.give.success=Дано {%0} * {%1} игроку {%2}\ncommands.give.tagError=Разбор тега данных не удался: {%0}\n\ncommands.effect.usage=/effect <игрок> <эффект> [кол-во секунд] [уровень] [убратьЧастицы] ИЛИ /effect <игрок> clear\ncommands.effect.notFound=Не существует эффекта с ID {%0}\ncommands.effect.success=Дано {%0} (ID {%1}) * {%2} to {%3} на {%4} секунд\ncommands.effect.success.removed=Эффект {%0} убран у {%1}\ncommands.effect.success.removed.all=Все эффекты были сняты с {%0}\ncommands.effect.failure.notActive=Невозможно убрать {%0} у {%1}, поскольку игрок не имеет данного эффекта\ncommands.effect.failure.notActive.all=Невозможно убрать эффекты у {%0}, потому что игрок не имеет никаких эффектов\n\ncommands.enchant.noItem=У игрока нет такого предмета\ncommands.enchant.notFound=Нет такого зачарования с ID {%0}\ncommands.enchant.success=Зачарование прошло успешно\ncommands.enchant.cantEnchant=This item cannot be enchanted\ncommands.enchant.usage=/enchant <игрок> <ID зачарования> [уровень]\ncommands.particle.success=Проигрываются частицы эффекта {%0} {%1} раз\ncommands.particle.notFound=Неизвестный эффект {%0}\ncommands.players.usage=/list\ncommands.players.list=Сейчас {%0}/{%1} игроков на сервере:\ncommands.kill.successful=Убит {%0}\ncommands.banlist.ips=Всего заблокировано %d IP адресов :\ncommands.banlist.players=Всего заблокирован(о) {%0} игрок(ов):\ncommands.banlist.usage=/banlist [ips|players]\ncommands.defaultgamemode.usage=/defaultgamemode <режим игры>\ncommands.defaultgamemode.success=Игровой режим мира по умолчанию ‒ {%0}\n\ncommands.op.success={%0} теперь оператор сервера\ncommands.op.usage=/op <игрок>\n\ncommands.deop.success={%0} больше не оператор сервера\ncommands.deop.usage=/deop <игрок>\n\ncommands.say.usage=/say <сообщение ...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Сид: {%0}\n\ncommands.bancidbyname.success=Игрок {%0} заблокирован по номеру устройства\ncommands.bancidbyname.usage=/bancidbyname <ИмяИгрока>\ncommands.bancid.success=Заблокирован номер устройства: {%0}\ncommands.bancid.usage=/bancid <НомерУстройства>\ncommands.unbancid.usage=/pardoncid <НомерУстройства>\ncommands.ban.success=Заблокирован игрок {%0}\ncommands.ban.usage=/ban <ИмяИгрока> [причина ...] [время(день)]\ncommands.unban.success=Разблокирован игрок {%0}\ncommands.unban.usage=/pardon <имя>\ncommands.banip.invalid=Вы ввели неправильный IP-адрес или данный игрок не в сети\ncommands.banip.success=Заблокирован IP адрес {%0}\ncommands.banip.success.players=Заблокирован IP адрес {%0} принадлежащий {%1}\ncommands.banip.usage=/ban-ip <IPадрес|имяИгрока> [причина ...]\ncommands.unbanip.invalid=Вы ввели неправильный IP адрес\ncommands.unbanip.success=Разблокирован IP адрес {%0}\ncommands.unbanip.usage=/pardon-ip <адрес>\ncommands.banipbyname.success=Игрок с ником {%0} забанен по IP\ncommands.banipbyname.usage=/banipbyname <player>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=Включено авто-сохранение\ncommands.save.disabled=Автоматическое сохранение мира отключено\ncommands.save.start=Сохранение...\ncommands.save.success=Мир сохранён\n\ncommands.setblock.usage=/setblock <x> <y> <z> <ИмяБлока> [Урон]\ncommand.setblock.invalidBlock=Некорректное имя блока/айди\n\ncommands.stop.usage=/stop\ncommands.stop.start=Остановка сервера\n\ncommands.kick.success=Кикнут {%0} с сервера\ncommands.kick.success.reason=Кикнут {%0} с сервера: '{%1}'\ncommands.kick.usage=/kick <игрок> [причина ...]\n\ncommands.tp.success=Телепортирован {%0} к {%1}\ncommands.tp.success.coordinates=Телепортирован {%0} на {%1}, {%2}, {%3}\ncommands.tp.usage=/tp [целевой игрок] <назначенный игрок> или /tp [целевой игрок] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=В вайтлисте {%0} игроков (из {%1} отображаемых):\ncommands.whitelist.enabled=Вайтлист включен\ncommands.whitelist.disabled=Вайтлист выключен\ncommands.whitelist.reloaded=Список разрешенных игроков перезагружен\ncommands.whitelist.add.success={%0} добавлен в вайтлист\ncommands.whitelist.add.usage=/whitelist add <игрок>\ncommands.whitelist.remove.success={%0} убран из вайтлиста\ncommands.whitelist.remove.usage=/whitelist remove <игрок>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=Установлен режим игры {%2} для себя\ncommands.gamemode.success.other=Игровой режим игрока {%1} изменён на {%2}\ncommands.gamemode.usage=/gamemode <игровой режим> [игрок]\ncommands.help.header=--- Отображается страница {%0} из {%1} (/help <страница>) ---\ncommands.help.usage=/help [страница|имя команды]\ncommands.message.usage=/tell <игрок> <личное сообщение...>\ncommands.message.sameTarget=Вы не можете отправить сообщение самому себе!\ncommands.xp.usage=/xp <Опыт или Уровень опыта + Число> <Игрок>\n\ncommands.difficulty.usage=/difficulty <сложность игры>\ncommands.difficulty.success=Установлена сложность игры на {%0}\n\ncommands.spawnpoint.usage=/spawnpoint [игрок] [<x> <y> <z>]\ncommands.spawnpoint.success=Установлена точка респауна игрока {%0} ({%1}, {%2}, {%3})\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=Установлен респаун мира на ({%0}, {%1}, {%2})\ncommands.summon.usage=/summon [сущность] [<x> <y> <z>] [Имя]\n\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=Информация об игроке \"{%0}\" не найдена, создаётся новый профиль\npocketmine.data.playerCorrupted=Повреждённые данные у игрока \"{%0}\", создание нового профиля\npocketmine.data.playerOld=Обнаружен старый профиль игрока \"{%0}\",  обновляем на новый\npocketmine.data.saveError=Невозможно сохранить игрока \"{%0}\": {%1}\npocketmine.level.notFound=Мир \"{%0}\" не найден\npocketmine.level.loadError=Невозможно загрузить мир\"{%0}\": {%1}\npocketmine.level.generationError=Невозможно сгенерировать уровень \"{%0}\": {%1}\npocketmine.level.tickError=Ошибка прорисовки мира \"{%0}\": {%1}\npocketmine.level.chunkUnloadError=Ошибка при выгрузке чанка: {%0}\npocketmine.level.backgroundGeneration=Генерируется территория спауна для мира \"{%0}\"\npocketmine.level.defaultError=Мир по умолчанию не загружен\npocketmine.level.preparing=Подготовка мира \"{%0}\"\npocketmine.level.unloading=Выгрузка мира \"{%0}\"\npocketmine.server.start=Запускается сервер Minecraft: PE версии {%0}\npocketmine.server.networkError=[Сеть] Остановлен интерфейс {%0} из-за {%1}\npocketmine.server.networkStart=Открытие сервера на {%0}:{%1}\npocketmine.server.info.extended=Сервер использует {%0} {%1}「 {%2}」 , версия API {%3} для Minecraft: PE {%4} (версия протокола {%5})\npocketmine.server.info=Этот сервер использует {%0}, версию {%1} \"{%2}\" (API {%3})\npocketmine.server.license={%0} распространяется под лицензией LGPL\npocketmine.server.tickOverload=Сервер перегружен!\npocketmine.server.startFinished=Загружено ({%0} секунд)! Для справки введите \"help\" или \"?\"\npocketmine.server.defaultGameMode=Игровой режим по умолчанию: {%0}\npocketmine.server.query.start=Запуск прослушивателя статуса GS4\npocketmine.server.query.info=Установлен порт query на {%0}\npocketmine.server.query.running=Query запущен на {%0}:{%1}\n\npocketmine.command.alias.illegal=Невозможно зарегистрировать альтернативу команды {%0}, поскольку он содержит недопустимые знаки\npocketmine.command.alias.notFound=Невозможно зарегистрировать альтернативу команды {%0}, поскольку он содержит недопустимые команды: {%1}\npocketmine.command.exception=Необработанное исключение при выполнении команды '{%0}' в {%1}: {%2}\n\npocketmine.commands.cave.usage=/cave <угол_поворота> <длина> <Номер ветви> <прочность> <X> <Y> <Z> <название_мира> | /cave getmypos\npocketmine.commands.cave.info=Угол поворота:{%0} Длина:{%1} Номер ветви:{%2} Прочность:{%3}\npocketmine.commands.cave.start=Начало создания пещеры, пожалуйста, подождите!\n\npocketmine.command.plugins.description=Получить список установленых плагинов на этом сервере\npocketmine.command.plugins.success=Плагины ({%0}): {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=Перезагрузить настройки сервера и плагины\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Перезагрузка сервера...\npocketmine.command.reload.reloaded=Перезагрузка завершена.\n\npocketmine.command.lvdat.description=Изменить настройки карты.\npocketmine.command.lvdat.changed=Был сменена настройка {%1} для мира \"{%0}\", для применения некоторых изменений нужна перезагрузка.\npocketmine.command.lvdat.fixname=Имя для мира \"{%0}\" было успешно исправлено, для применения некоторых изменений нужна перезагрузка.\npocketmine.command.lvdat.nofound=Мир \"{%0}\" не найден или не загружен.\npocketmine.command.lvdat.preset=Настройки генератора (пресеты)\n\npocketmine.command.status.description=Отображает производительность сервера.\npocketmine.command.status.usage=/status\npocketmine.command.status.title=Статус сервера\npocketmine.command.status.player=Число игроков:\npocketmine.command.status.days=дн.\npocketmine.command.status.hours=ч\npocketmine.command.status.minutes=мин\npocketmine.command.status.seconds=сек\npocketmine.command.status.uptime=Аптайм:\npocketmine.command.status.AverageTPS=Средний TPS:\npocketmine.command.status.CurrentTPS=Текущий TPS:\npocketmine.command.status.Networkupload=Данных отправлено:\npocketmine.command.status.Networkdownload=Данных получено:\npocketmine.command.status.Threadcount=Количество потоков:\npocketmine.command.status.Mainmemory=Основная память потока:\npocketmine.command.status.Totalmemory=Общая память:\npocketmine.command.status.Totalvirtualmemory=Общая виртуальная память:\npocketmine.command.status.Heapmemory=Heap memory:\npocketmine.command.status.Maxmemorysystem=Максимальная память (системы):\npocketmine.command.status.Maxmemorymanager=Максимальная память (менеджер):\npocketmine.command.status.World=Мир\npocketmine.command.status.chunks=чанков,\npocketmine.command.status.entities=сущностей,\npocketmine.command.status.tiles=тайлов.\npocketmine.command.status.Time=Время\npocketmine.command.status.ms=мс\npocketmine.command.gc.description=Запускает процессы сборщика мусора\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=Отчёт очистки\npocketmine.command.gc.chunks=Чанков:\npocketmine.command.gc.entities=Сущностей:\npocketmine.command.gc.tiles=Тайлов:\npocketmine.command.gc.cycles=Циклов:\npocketmine.command.gc.memory=Освобождённая память:\n\npocketmine.command.biome.description=Изменяет биом выделенной области. (Для смены снега на дождь)\npocketmine.command.biome.posset=Установлена точка {%3} на позиции: ({%1},{%2})[{%0}]\npocketmine.command.biome.get=ID биома, где ты стоишь: {%0}. Цвет:{%1},{%2},{%3}\npocketmine.command.biome.wrongLev=Нельзя устанавливать точки в разнымх мирах.\npocketmine.command.biome.wrongBio=Неверный ID биома. Пример: 1 (Равнины), 2 (Пустыня)，13 (Ледяные горы)，6 (Болото)\npocketmine.command.biome.wrongCol=Неверный цвет! Пример: 146,188,89. Используй: \"/biome get\" чтобы получить остальные цвета.\npocketmine.command.biome.noPos=Используйте \"/biome pos1|pos2\" чтобы отметить точки.\npocketmine.command.biome.set=Был установлен цвет：{%0}\npocketmine.command.biome.color=Выбран цвет: {%0},{%1},{%2}\n\npocketmine.command.timings.description=Записывает тайминги, чтобы показать производительность сервера.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=Тайминги включены и сброшены.\npocketmine.command.timings.disable=Тайминги выключены\npocketmine.command.timings.timingsDisabled=Пожалуйста, включите тайминги, набрав в чате /timings on\npocketmine.command.timings.reset=Тайминги сброшены\npocketmine.command.timings.pasteError=Произошла ошибка при сохранении таймингов\npocketmine.command.timings.timingsUpload=Тайминги загружены в {%0}\npocketmine.command.timings.timingsRead=Вы можете прочесть результаты таймингов в {%0}\npocketmine.command.timings.timingsWrite=Тайминги записаны в {%0}\n\npocketmine.command.version.description=Получает версию сервера, включая все используемые плагины\npocketmine.command.version.usage=/version [имя плагина]\npocketmine.command.version.noSuchPlugin=Этот сервер не использует плагин с таким именем. Используйте /plugins, чтобы получить список используемых плагинов.\npocketmine.command.give.description=Даёт определённому игроку определённое количество предметов\npocketmine.command.give.usage=/give <игрок> <предмет[:урон]> [количество] [тэги...]\npocketmine.command.kill.description=Совершает суицид или убивает других игроков\npocketmine.command.kill.usage=/kill [игрок]\npocketmine.command.particle.description=Добавляет частицы в мир\npocketmine.command.particle.usage=/particle <имя> <x> <y> <z> <xd> <yd> <zd> [значение] [данные]\npocketmine.command.time.description=Изменяет время в каждом мире\npocketmine.command.time.usage=/time <set|add> <value> ИЛИ /time <start|stop|query>\npocketmine.command.bancidbyname.description=Бан игрока по уникальному номеру устройства\npocketmine.command.bancid.description=Бан уникального номера устройства\npocketmine.command.banipbyname.description=Бан игрока по IP\npocketmine.command.ban.player.description=Бан игрока\npocketmine.command.ban.ip.description=Бан IP-адреса\npocketmine.command.banlist.description=Список забаненных игроков\npocketmine.command.defaultgamemode.description=Устанавливает режим игры по умолчанию\npocketmine.command.deop.description=Убирает статус оператора с определённого игрока\npocketmine.command.difficulty.description=Устанавливает сложность игры\npocketmine.command.enchant.description=Добавляет зачарование предметам\npocketmine.command.effect.description=Добавляет/Убирает эффекты у игроков\npocketmine.command.gamemode.description=Изменяет режим игры у игрока\npocketmine.command.help.description=Показывает меню помощи\npocketmine.command.kick.description=Заставить выйти определённого игрока с сервера\npocketmine.command.list.description=Показывает всех игроков на сервере\npocketmine.command.me.description=Выполняет указанное действие в чате\npocketmine.command.op.description=Даёт определённому игроку статус оператора\npocketmine.command.unban.cid.description=Разбан уникального номера устройства игрока\npocketmine.command.unban.player.description=Разбан игрока по нику\npocketmine.command.unban.ip.description=Разбан IP-адреса игрока\npocketmine.command.save.description=Сохраняет все файлы сервера\npocketmine.command.saveoff.description=Отключает автосохранение сервера\npocketmine.command.saveon.description=Включает автосохранение сервера\npocketmine.command.say.description=Транслирует сообщение в чат\npocketmine.command.seed.description=Показывает сид мира\npocketmine.command.setworldspawn.description=Устанавливает точку респауна мира. Если координаты не введены, будут использованы координаты игрока.\npocketmine.command.spawnpoint.description=Устанавливает точку возрождения игрока\npocketmine.command.stop.description=Выключает сервер\npocketmine.command.tp.description=Телепортирует определённого игрока (или Вас) к другому игроку или на другие координаты\npocketmine.command.tell.description=Отправляет приватное сообщение указанному игроку\npocketmine.command.xp.description=Добавляет опыт или уровень опыта игроку\npocketmine.command.summon.description=Создаёт сущность по установленным координатам или координатом игрока\npocketmine.command.fill.description=Заполняет выделенную область блоками\npocketmine.command.setblock.description=Заменяет блок по координатам\n\npocketmine.command.weather.description=Установка погоды в мире\npocketmine.command.weather.usage=/weather <мир> (0,1,2,3)\npocketmine.command.weather.changed=Погода успешно изменена в мире {%0}!\npocketmine.command.weather.noregistered=Мир {%0} не был зарегистрирован в менеджере погоды.\npocketmine.command.weather.invalid=Некорректная погода.(0,1,2,3)\npocketmine.command.weather.wrong=Некорректные параметры.\npocketmine.command.weather.invalid.level=Некорректное имя мира.\npocketmine.command.whitelist.description=Управление вайтлистом сервера\npocketmine.crash.create=Произошла фатальная ошибка и сервер вышел из строя. Создание аварийного дампа\npocketmine.crash.error=Не удалось создать дамп: {%0}\npocketmine.crash.submit=Пожалуйста, загрузите файл\"{%0}\" в краш-архив и отправьте ссылку на страницу исправления ошибок. Дайте как можно больше информации.\npocketmine.crash.archive=Дамп выхода из строя сервера был автоматически отправлен в краш-архив. Вы можете его просмотреть тут: {%0}, или использовать ID #{%1}.\npocketmine.debug.enable=Поддержка LevelDB включена\npocketmine.player.invalidMove={%0} некорректно передвинулся!\npocketmine.player.logIn={%0}[/{%1}:{%2}] вошел с id сущности {%3} на ({%4}, {%5}, {%6}, {%7})\npocketmine.player.logOut={%0}[/{%1}:{%2}] отключился: {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] был перемещен в {%3}\npocketmine.player.invalidEntity={%0} попытался атаковать неправильную сущность\npocketmine.plugin.load=Загрузка {%0}\npocketmine.plugin.enable=Включение {%0}\npocketmine.plugin.disable=Выключение {%0}\npocketmine.plugin.restrictedName=Ограниченное имя\npocketmine.plugin.incompatibleAPI=Несовместимая версия API\npocketmine.plugin.unknownDependency=Неизвестная зависимость\npocketmine.plugin.circularDependency=Обнаружена круговая зависимость\npocketmine.plugin.genericLoadError=Невозможно загрузить плагин '{%0}'\npocketmine.plugin.spacesDiscouraged=Плагин '{%0}' использует пробелы в его имени, это недопустимо\npocketmine.plugin.loadError=Невозможно загрузить плагин '{%0}': {%1}\npocketmine.plugin.duplicateError=Невозможно загрузить '{%0}': плагин уже существует\npocketmine.plugin.fileError=Невозможно загрузить '{%0}' в папке '{%1}': {%2}\npocketmine.plugin.commandError=Невозможно загрузить команду {%0} для плагина {%1}\npocketmine.plugin.aliasError=Невозможно загрузить сокращение {%0} для плагина {%1}\npocketmine.plugin.deprecatedEvent=Плагин '{%0}' зарегистрировал прослушивателя для '{%1}', используя метод '{%2}', но событие было отменено.\npocketmine.plugin.eventError=\"Невозможно обработать событие '{%0}' в '{%1}': {%2} в {%3}\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/tur.ini",
    "content": "\n\nlanguage.name=Türkçe\nlanguage.selected={%0} ({%1}) konsol dili olarak seçildi\n\nmultiplayer.player.joined={%0} oyuna katıldı\nmultiplayer.player.left={%0} oyundan ayrıldı\n\nchat.type.text={%0} : {%1}\nchat.type.achievement={%0} adlı oyuncu {%1} başarımını kazandı\n\ndisconnectionScreen.outdatedClient=Eski sürüm!\ndisconnectionScreen.outdatedServer=Sunucu daha eski bir sürümde!\ndisconnectionScreen.serverFull=Sunucu dolu!\ndisconnectionScreen.noReason=Sunucu ile olan bağlantınız kesildi\ndisconnectionScreen.invalidSkin=Geçersiz skin!\ndisconnectionScreen.invalidName=Geçersiz isim!\n\ndeath.fell.accident.generic={%0} Yüksekten düşerek öldü\ndeath.attack.inFire={%0} yanarak öldü\ndeath.attack.onFire={%0} yanarak can verdi\ndeath.attack.lava={%0} lavda yüzmeye çalıştı\ndeath.attack.inWall={%0} duvarda sıkışarak öldü\ndeath.attack.drown={%0} boğuldu\ndeath.attack.cactus={%0} delinerek öldü\ndeath.attack.generic={%0} öldü\ndeath.attack.explosion={%0} patlayarak öldü\ndeath.attack.explosion.player={%0}, {%1} tarafından havaya uçuruldu\ndeath.attack.magic={%0} sihirlenerek öldürüldü\ndeath.attack.wither={%0} witherlanarak öldü\ndeath.attack.mob={%0}, {%1} tarafından öldürüldü\ndeath.attack.player={%0}, {%1} tarafından öldürüldü\ndeath.attack.player.item={%0}, {%1} tarafından {%2} kullanılarak öldürüldü\ndeath.attack.arrow={%0}, {%1} tarafından vuruldu\ndeath.attack.arrow.item={%0}, {%1} adlı oyuncuyu {%2} kullanarak vurdu\ndeath.attack.fall={%0} yüksekten düşerek öldü\ndeath.attack.outOfWorld={%0} dünyadan aşağı düşerek can verdi\n\ngameMode.survival=Hayatta Kalma Modu\ngameMode.creative=Yaratıcı Mod\ngameMode.adventure=Maceracı Mod\ngameMode.spectator=İzleyici Mod\ngameMode.changed=Oyun modunuz güncellendi\n\npotion.moveSpeed=Hız\npotion.moveSlowdown=Yavaşlık\npotion.digSpeed=Sürat\npotion.digSlowDown=Kazı Yorgunluğu\npotion.damageBoost=Güç\npotion.heal=Anında Can\npotion.harm=Anlık Zarar\npotion.jump=Zıplama Artışı\npotion.confusion=Bulantı\npotion.regeneration=Yenilenme\npotion.resistance=Dayanıklılık\npotion.fireResistance=Ateş Dayanıklılığı\npotion.waterBreathing=Suda Nefes Alma\npotion.invisibility=Görünmezlik\npotion.blindness=Körlük\npotion.nightVision=Gece Görüşü\npotion.hunger=Açlık\npotion.weakness=Zayıflık\npotion.poison=Zehir\npotion.wither=Wither\npotion.healthBoost=Can Artışı\npotion.absorption=Emme\npotion.saturation=Doyma\n\ncommands.generic.exception=Komut uygulanırken bilinmeyen bir hata oluştu\ncommands.generic.permission=Bu komutu kullanma yetkiniz yok!\ncommands.generic.notFound=Bilinmeyen komut. Tüm komutları görmek için /help yazınız\ncommands.generic.player.notFound=Belirtilen oyuncu bulunamadı\ncommands.generic.usage=Kullanış: {%0}\n\ncommands.time.added=Saate {%0} eklendi\ncommands.time.set=Dünya saati şu saate ayarlandı: {%0}\ncommands.time.query=Dünya saati: {%0}\n\ncommands.me.usage=/me <aksiyon...>\n\ncommands.give.item.notFound=Belirtilen eşya bulunamıyor: {%0}\ncommands.give.success={%0} * {%1}, {%2}'ye verildi\ncommands.give.tagError=Veri başlığı ayrıştırması başarısız oldu: {%0}\ncommands.effect.usage=/effect <oyuncu> <efekt> [saniye] [yükselme] [EfektleriGizle] yada /effect <oyuncu> clear\ncommands.effect.notFound=Bilinmeyen efekt: {%0}\ncommands.effect.success={%3} adlı oyuncuya {%4} saniyeliğine {%0} (ID {%1}) * {%2} verildi\ncommands.effect.success.removed={%0}, {%1}'den alındı\ncommands.effect.success.removed.all={%0} adlı oyuncunun bütün efektleri alındı\ncommands.effect.failure.notActive={%0} adlı oyuncudan {%1} efekti alınamadı. Çünkü bu efekte sahip değil\ncommands.effect.failure.notActive.all={%0} adlı oyuncunun efektleri alınamadı. Çünkü hiç bir efekte sahip değil\n\ncommands.enchant.noItem=Hedefin elinde eşya tutmuyor\ncommands.enchant.notFound={%0} kodunda bir büyü yok\ncommands.enchant.success=Büyü işlemi başarılı\ncommands.enchant.usage=/enchant <oyuncu adı> <büyü kodu> [seviye]\n\ncommands.particle.success={%0} efekti {%1} kere oynatılıyor\ncommands.particle.notFound={%0} - Bilinmeyen efekt ismi.\n\ncommands.players.usage=/list\ncommands.players.list=Çevrimiçi oyuncular: {%0}/{%1}\n\ncommands.kill.successful={%0} adlı oyuncu öldürüldü\n\ncommands.banlist.ips=Toplam %d adet engellenmiş IP adresi var:\ncommands.banlist.players=Toplam {%0} adet engellenmiş oyuncu var:\ncommands.banlist.usage=/banlist [ips|players]\n\ncommands.defaultgamemode.usage=/defaultgamemode <oyun modu>\ncommands.defaultgamemode.success=Dünyanın varsayılan oyun modu artık : {%0}\n\ncommands.op.success={%0} adlı kullanıcıya OP yetkisi verildi.\ncommands.op.usage=/op <oyuncu>\n\ncommands.deop.success={%0} adlı kullanıcının OP yetkisi alındı.\ncommands.deop.usage=/deop <oyuncu>\n\ncommands.say.usage=/say <mesaj>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Seed: {%0}\n\ncommands.ban.success={%0} adlı oyuncu banlandı\ncommands.ban.usage=/ban <oyuncu> [sebep...]\n\ncommands.unban.success={%0} adlı oyuncunun engeli kaldırıldı\ncommands.unban.usage=/pardon <oyuncu>\n\ncommands.banip.invalid=Bilinmeyen IP adresi veya çevrimiçi olmayan oyuncu adı girdiniz\ncommands.banip.success={%0} IP adresi engellendi\ncommands.banip.success.players=Engellenen IP adresi {%0}, {%1} kullanıcısına ait\ncommands.banip.usage=/ban-ip <adres|oyuncu> [sebep ...]\n\ncommands.unbanip.invalid=Geçersiz IP adresi girdiniz\ncommands.unbanip.success={%0} IP adresinin engeli kaldırıldı\ncommands.unbanip.usage=/pardon-ip <IP>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=Otomatik kaydetme özelliği etkinleştirildi\ncommands.save.disabled=Otomatik kaydetme özelliği devre dışı\ncommands.save.start=Kaydediliyor...\ncommands.save.success=Dünya kaydedildi\n\ncommands.stop.usage=/stop\ncommands.stop.start=Sunucu durduruluyor\n\ncommands.kick.success={%0} oyundan atıldı\ncommands.kick.success.reason={%0} oyundan atıldı: '{%1}'\ncommands.kick.usage=/kick <oyuncu> [sebep ...]\n\ncommands.tp.success={%0}, {%1} adlı oyuncuya ışınlandı\ncommands.tp.success.coordinates={%0} adlı oyuncu {%1}, {%2}, {%3} koordinatlarına ışınlandı\ncommands.tp.usage=/tp [oyuncu1] <oyuncu2> yada /tp [oyuncu] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=Toplam {%0} (görünen {%1}) whitelist oyuncusu var:\ncommands.whitelist.enabled=Whitelist aktif edildi\ncommands.whitelist.disabled=Whitelist deaktif edildi\ncommands.whitelist.reloaded=Whitelist yeniden yüklendi\ncommands.whitelist.add.success={%0} adlı oyuncu whitelist listesine eklendi\ncommands.whitelist.add.usage=/whitelist add <oyuncu>\ncommands.whitelist.remove.success={%0} adlı oyuncu whitelist listesinden kaldırıldı\ncommands.whitelist.remove.usage=/whitelist remove <oyuncu>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=Oyun modunuz {%2} moduna değiştirildi\ncommands.gamemode.success.other={%1} adlı oyuncunun oyun modu {%2} moduna değiştirildi\ncommands.gamemode.usage=/gamemode <mod> [oyuncu]\n\ncommands.help.header=--- Yardım sayfası {%0} / {%1} (/help <sayfa>) ---\ncommands.help.usage=/help [sayfa|komut adı]\n\ncommands.message.usage=/tell <oyuncu> <mesajınız...>\ncommands.message.sameTarget=Kendinize mesaj yollayamazsınız!\n\ncommands.difficulty.usage=/difficulty <zorluk değeri>\ncommands.difficulty.success=Oyun zorluk seviyesi başarıyla değiştirildi!\n\ncommands.spawnpoint.usage=/spawnpoint [oyuncu] [<x> <y> <z>]\ncommands.spawnpoint.success={%0} adlı oyuncunun başlangıç noktası ({%1}, {%2}, {%3}) koordinatlarına olarak değiştirildi\n\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=Dünya başlangıç noktası ({%0}, {%1}, {%2}) koordinatlarına değiştirildi\n\n\n\npocketmine.data.playerNotFound=Oyuncu verisi bulunamadı: \"{%0}\", yeni profil oluşturuluyor\npocketmine.data.playerCorrupted=Bozuk veri \"{%0}\" bulunamadı, yeni profil oluşturuluyor\npocketmine.data.playerOld=Eski veri \"{%0}\" bulundu, profil güncelleniyor\npocketmine.data.saveError=Oyuncu kaydedilemiyor \"{%0}\": {%1}\n\npocketmine.level.notFound=Dünya \"{%0}\" bulunamadı\npocketmine.level.loadError=Dünya yüklenmiyor \"{%0}\": {%1}\npocketmine.level.generationError=Dünya oluşturulamıyor \"{%0}\": {%1}\npocketmine.level.tickError=Dünya işaretlenemiyor \"{%0}\": {%1}\npocketmine.level.chunkUnloadError=Chunk yüklemesi kaldırılırken hata: {%0}\npocketmine.level.backgroundGeneration=Spawn bölgesi \"{%0}\" oluşturulmaya başlandı\npocketmine.level.defaultError=Varsayılan dünya yüklenemedi\npocketmine.level.preparing=Dünya hazırlanıyor: \"{%0}\"\npocketmine.level.unloading=Dünya yüklemesi kaldırılıyor \"{%0}\"\n\npocketmine.server.start=Minecraft: PE sunucu versiyonu {%0} başlatılıyor\npocketmine.server.networkError=[Şebeke] Arayüz {%1} için {%0} nedeniyle durduruldu\npocketmine.server.networkStart=Sunucu {%0}:{%1} adresinde açılıyor\npocketmine.server.info=Bu sunucu {%0} versiyonunda {%1} \"{%2}\" (API {%3}) çalışıyor\npocketmine.server.info.extended=This server is running {%0} {%1} 「{%2}」 implementing API version {%3} for Minecraft: PE {%4} (protocol version {%5})\npocketmine.server.license={%0} is distributed under the LGPL License\npocketmine.server.tickOverload=HATA! Sunucu aşırı mı yüklendi?\npocketmine.server.startFinished={%0} saniye içinde tamamlandı. Yardım için /help yazınız\npocketmine.server.defaultGameMode=Varsayılan oyun modu: {%0}\npocketmine.server.query.start=GS4 durum dinleyicisi başlatılıyor\npocketmine.server.query.info=Query port kuruluyor: {%0}\npocketmine.server.query.running=Şurada sorgulanıyor: {%0}:{%1}\n\npocketmine.command.alias.illegal={%0} kayıt edilemiyor. Çünkü yasaklı karakterler içeriyor\npocketmine.command.alias.notFound=Takma ad {%0} bulunamadı. Çünkü olmayan bu komutları içerir: {%1}\npocketmine.command.exception=İşlenmeyen işletme komutu: '{%0}' 'de {%1}: {%2}\npocketmine.command.plugins.description=Sunucuda çalışan eklentileri gösterir\npocketmine.command.plugins.success=Eklentiler ({%0}): {%1}\npocketmine.command.plugins.usage=/plugins\npocketmine.command.reload.description=Sunucu ayarlarını ve eklentilerini yeniden yükler\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Sunucu yeniden yükleniyor...\npocketmine.command.reload.reloaded=Yeniden yükleme tamamlandı.\npocketmine.command.status.description=Sunucunun performansını geri okur.\npocketmine.command.status.usage=/status\npocketmine.command.gc.description=Toplanmış atık dosyaları yakar\npocketmine.command.gc.usage=/gc\npocketmine.command.timings.description=Timings'i sunucunun performansını görmek için kaydeder.\npocketmine.command.timings.usage=/timings <reset|rapport|on|off|coller>\npocketmine.command.timings.enable=Timings & Reset aktif edildi\npocketmine.command.timings.disable=Timings devre dışı bırakıldı\npocketmine.command.timings.timingsDisabled=Timings'i aktif etmek için /timings on yazınız\npocketmine.command.timings.reset=Timigs yeniden başlatma\npocketmine.command.timings.pasteError=Raporu geçerken bir hata meydana geldi\npocketmine.command.timings.timingsUpload=Timings şuraya yüklendi: {%0}\npocketmine.command.timings.timingsRead=Sonuçları {%0}'da okuyabilirsin\npocketmine.command.timings.timingsWrite=Timings şuraya yazıldı: {%0}\n\npocketmine.command.version.description=Sunucunun ve kullanımda olan eklentilerin versiyonunu alırsınız\npocketmine.command.version.usage=/version [eklenti adı]\npocketmine.command.version.noSuchPlugin=Bu sunucu bu isimde olan bir eklenti çalıştıramaz. /plugins yazarak eklenti listesine bakabilirsiniz\n\npocketmine.command.give.description=Belirtilen oyuncuya belli miktarda eşya verir\npocketmine.command.give.usage=/give <oyuncu> <eşya kodu> [miktar] [başlıklar..]\n\npocketmine.command.kill.description=Kendini veya diğer oyuncuları öldür\npocketmine.command.kill.usage=/kill [oyuncu]\n\npocketmine.command.particle.description=Dünyaya parçacık efekti eklendi\npocketmine.command.particle.usage=/particle <isim> <x> <y> <z> <xd> <yd> <zd> [adet] [data]\n\npocketmine.command.time.description=Her bir dünyadaki saati değiştir\npocketmine.command.time.usage=/time <set|add> <değer> veya /time <start|stop|query>\n\npocketmine.command.ban.player.description=Oyuncuyu sunucudan engeller\npocketmine.command.ban.ip.description=Belirlenen IP adresini sunucudan engelller\npocketmine.command.banlist.description=Sunucudan engellenen oyuncuları gör\npocketmine.command.defaultgamemode.description=Varsayılan oyun modunu ayarla\npocketmine.command.deop.description=Belirlenen oyuncunun OP durumunu alır\npocketmine.command.difficulty.description=Varsayılan oyun zorluğunu ayarla\npocketmine.command.enchant.description=Eşyalara büyü ekler\npocketmine.command.effect.description=Oyuncuya efekt ekle veya kaldır\npocketmine.command.gamemode.description=Belirlenen oyuncunun oyun modunu değiştirir\npocketmine.command.help.description=Yardım menüsünü gösterir\npocketmine.command.kick.description=Belirlenen oyuncuyu sunucudan atar\npocketmine.command.list.description=Çevrimiçi oyuncular listesi\npocketmine.command.me.description=Yaptığınız aksiyonu sohbette anlatır\npocketmine.command.op.description=Belirlenen oyuncuya OP verir\npocketmine.command.unban.player.description=Belirlenen oyuncunun sunucuya girme engelini açar\npocketmine.command.unban.ip.description=Belirlenen IP adresinin sunucuya girme engelini açar\npocketmine.command.save.description=Sunucuyu diske kaydeder\npocketmine.command.saveoff.description=Sunucunun otomatik kaydetmesini deaktif eder\npocketmine.command.saveon.description=Sunucunun otomatik kaydetmesini aktif eder\npocketmine.command.say.description=Belirlenen mesajı gönderici olarak yayınlar\npocketmine.command.seed.description=Dünyanın seed'ini gösterir\npocketmine.command.setworldspawn.description=Dünya başlangıç noktasını ayarlar.\npocketmine.command.spawnpoint.description=Oyuncunun başlangıç noktasını ayarlar\npocketmine.command.stop.description=Sunucuyu durdurur\npocketmine.command.tp.description=Belirlenen oyuncuya ışınlar veya belirlenen oyuncuyu başka bir oyuncuya ışınlar\npocketmine.command.tell.description=Belirlenen oyuncuya özel mesaj yollar\npocketmine.command.whitelist.description=Sunucuya girme hakkı olan oyuncuları ayarlar\npocketmine.crash.create=Bilinmeyen bir hata oluştu ve sunucu çöktü. Çökme arşivi oluşturuluyor\npocketmine.crash.error=Çökme arşivi oluşturulamadı: {%0}\npocketmine.crash.submit=Lütfen \"{%0}\" dosyasını Çökme Arşivine yükleyin ve linki Bug Raporlama sayfasına gönderin. Size bir çok bilgi sunulacak.\npocketmine.crash.archive=Çökme bilgisi Çökme Arşivine otomatik olarak gönderildi. Onu {%0}'da görüntüleyebilirsin veya ID #{%1}'i kullanabilirsin.\n\npocketmine.debug.enable=LevelDB yardımı aktif edildi\n\npocketmine.player.invalidMove={%0} moved wrongly!\npocketmine.player.logIn={%0}[/{%1}:{%2}], {%3} Entity ID'si ile ({%4}, {%5}, {%6}, {%7})'da giriş yaptı\npocketmine.player.logOut={%0}[/{%1}:{%2}], {%3} sebebiyle çıkış yaptı\npocketmine.player.invalidEntity={%0} bilinmeyen bir varlığa saldırmayı denedi\n\npocketmine.plugin.load={%0} Yükleniyor\npocketmine.plugin.enable={%0} aktif ediliyor\npocketmine.plugin.disable={%0} deaktif ediliyor\npocketmine.plugin.restrictedName=Yasak ad\npocketmine.plugin.incompatibleAPI=Uyumsuz API versiyonu\npocketmine.plugin.unknownDependency=Bilinmeyen bağımlı\npocketmine.plugin.circularDependency=Dairesel bağımlı tespit edildi\npocketmine.plugin.genericLoadError=Eklenti yüklenemiyor '{%0}'\npocketmine.plugin.spacesDiscouraged='{%0}' eklentisi isminde boşluk barındırıyor, vazgeçildi\npocketmine.plugin.loadError=Eklenti yüklenemedi '{%0}': {%1}\npocketmine.plugin.duplicateError='{%0}' adlı eklenti zaten var olduğundan yüklenemedi\npocketmine.plugin.fileError='{%0}' eklentisi '{%1}': {%2} dosyasında yüklenemedi\npocketmine.plugin.commandError={%0} komutu {%1} eklentisi için yüklenemedi\npocketmine.plugin.aliasError={%0} takma adı {%1} eklentisi için yüklenemedi\npocketmine.plugin.deprecatedEvent='{%0}' eklentisi bir '{%1}' dinleyicisi için '{%2}' yönteminde kayıt oldu, ama durum önerilmiyor.\npocketmine.plugin.eventError=\"'{%0}' olayı '{%1}': {%2} 'ye {%3}'de geçilemiyor\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/ukr.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers\n#\n# A message doesn't need to be there to be shown correctly on the client.\n# Only messages shown in PocketMine itself need to be here\n\nlanguage.name=Ukrainian\nlanguage.selected=Обрано {%0} ({%1}) в якості основної мови\n\nmultiplayer.player.joined={%0} приєднався до гри\nmultiplayer.player.left={%0} покинув гру\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement=Гравець {%0} отримав досягнення {%1}!\n\ndisconnectionScreen.notAuthenticated=Необхідно авторизуватися в Xbox!\ndisconnectionScreen.outdatedClient=Застарілий клієнт!\ndisconnectionScreen.outdatedServer=Застарілий сервер!\ndisconnectionScreen.serverFull=Сервер переповнений!\ndisconnectionScreen.noReason=Від’єднано від серверу.\ndisconnectionScreen.invalidSkin=Помилковий формат скіну!\ndisconnectionScreen.invalidName=Неприпустиме нік!\n\ndeath.fell.accident.generic={%0} впав з високого місця\ndeath.attack.inFire={%0} згорів\ndeath.attack.onFire={%0} згорів\ndeath.attack.lava={%0} вирішив поплавати в лаві...\ndeath.attack.inWall={%0} задихнувся в стіні\ndeath.attack.drown={%0} потонув\ndeath.attack.cactus={%0} став жертвою кактуса ;-)\ndeath.attack.generic={%0} помер\ndeath.attack.explosion={%0} вибухнув\ndeath.attack.explosion.player={%0} був підірваний {%1}\ndeath.attack.magic={%0} вбитий магією\ndeath.attack.wither={%0} висушений\ndeath.attack.mob={%0} був вбитий {%1}\ndeath.attack.player={%0} був вбитий {%1}\ndeath.attack.player.item={%0} був вбитий {%1} з {%2}\ndeath.attack.arrow={%0} був застрелений {%1}\ndeath.attack.arrow.item={%0} був застрелений {%1} з {%2}\ndeath.attack.fall={%0} впав з високого місця\ndeath.attack.outOfWorld={%0} випав зі світу\n\ngameMode.survival=Режим виживання\ngameMode.creative=Творчий режим\ngameMode.adventure=Пригодницький режим\ngameMode.spectator=Режим спостерігача\ngameMode.changed=Ваш ігровий режим було оновлено\n\npotion.moveSpeed=Швидкість\npotion.moveSlowdown=Уповільнення\npotion.digSpeed=Поспіх\npotion.digSlowDown=Втома\npotion.damageBoost=Сила\npotion.heal=Миттєве Лікування\npotion.harm=Миттєва Втрата\npotion.jump=Посилення Стрибка\npotion.confusion=Нудота\npotion.regeneration=Регенерація\npotion.resistance=Супротив Втратам\npotion.fireResistance=Вогнестійкість\npotion.waterBreathing=Підводне Дихання\npotion.invisibility=Невидимість\npotion.blindness=Сліпота\npotion.nightVision=Нічний Зір\npotion.hunger=Голод\npotion.weakness=Слабкість\npotion.poison=Отруєння\npotion.wither=Висушення\npotion.healthBoost=Підвищення Здоров’я\npotion.absorption=Поглинання\npotion.saturation=Насичення\n\ncommands.generic.exception=Увага! Невідома помилка при виконанні команди\ncommands.generic.permission=У Вас недостатньо прав для використання цієї команди\ncommands.generic.notFound=Невідома команда. Використовуйте /help для перегляду списку команд\ncommands.generic.player.notFound=Гравця не знайдено\ncommands.generic.usage=Використання: {%0}\ncommands.generic.level=Назва світу\ncommands.generic.seed=Назва сіду\ncommands.generic.name=нік\ncommands.generic.generator=Назва генератору\ncommands.generic.opt.missing=Необхідні налаштування відсутні，будь ласка, повторіть введення.\ncommands.generic.runingame=Використовуйте цю команду тільки в грі.\n\ncommands.time.added=Додано {%0} до часу\ncommands.time.set=Встановлено час - {%0}\ncommands.time.query=Час ‒ {%0}\n\ncommands.me.usage=/me <дія>\n\ncommands.give.item.notFound=Предмет з іменем {%0} не знайдено\ncommands.give.success=Дано {%0} Х {%1} гравцю {%2}\ncommands.give.tagError=Розбір тегу данных завершився невдало: {%0}\n\ncommands.effect.usage=/effect <гравець> <ефект> [к-сть секунд] [рівень] [прибратиЧастинки] АБО /effect <гравець> clear\ncommands.effect.notFound=Не існує ефекту з ID {%0}\ncommands.effect.success=Дано {%0} (ID {%1}) Х {%2} гравцю {%3} на {%4} секунд\ncommands.effect.success.removed=Ефект {%0} забрано у {%1}\ncommands.effect.success.removed.all=Всі ефекти були зняті з {%0}\ncommands.effect.failure.notActive=Неможливо прибрати ефект {%0} у {%1}, поскільки гравець не має цього ефекту\ncommands.effect.failure.notActive.all=Неможливо прибрати ефекти у {%0}, поскільки гравець взагалі без ефектів\n\ncommands.enchant.maxLevel=Діапазон рівнів зачарування: 1 - {%0}\ncommands.enchant.noItem=У гравця немає такого предмету\ncommands.enchant.notFound=Немає такого зачарування з ID {%0}\ncommands.enchant.success=Зачарування завершилося вдало\ncommands.enchant.cantEnchant=Цей предмет неможливо зачарувати\ncommands.enchant.usage=/enchant <гравець> <ID зачарування> [рівень]\n\ncommands.particle.success=Відтворюються частинки ефекту {%0} {%1} разів\ncommands.particle.notFound=Невідомий ефект {%0}\n\ncommands.players.usage=/list\ncommands.players.list=Зараз {%0}/{%1} гравців на сервері:\n\ncommands.kill.successful=Вбито {%0}\n\ncommands.banlist.ips=Всього заблоковано %d IP адрес:\ncommands.banlist.players=Всього заблоковано {%0} гравців:\ncommands.banlist.cids=Всього заблоковано {%0} номерів пристроїв:\ncommands.banlist.usage=/banlist [ips|players]\n\ncommands.defaultgamemode.usage=/defaultgamemode <режим гри>\ncommands.defaultgamemode.success=Ігровой режим світу за замовчуванням ‒ {%0}\n\ncommands.op.success={%0} тепер оператор серверу\ncommands.op.usage=/op <гравець>\n\ncommands.deop.success={%0} вже не оператор серверу\ncommands.deop.usage=/deop <гравець>\n\ncommands.say.usage=/say <повідомлення>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Сід: {%0}\n\ncommands.bancidbyname.success=Гравця {%0} заблоковано по номеру пристрою\ncommands.bancidbyname.usage=/bancidbyname <нік гравця>\n\ncommands.bancid.success=Заблоковано номер пристрою: {%0}\ncommands.bancid.usage=/bancid <номер пристрою>\n\ncommands.unbancid.usage=/pardoncid <номер пристрою>\ncommands.unbancid.success=Розблоковано номер пристрою {%0}\n\ncommands.ban.success=Заблоковано гравця {%0}\ncommands.ban.usage=/ban <нік гравця> [причина] [час(в днях)]\n\ncommands.unban.success=Розблоковано гравця {%0}\ncommands.unban.usage=/pardon <нік>\n\ncommands.banip.invalid=Ви ввели неправильну IP-адресу чи даний гравець не в мережі\ncommands.banip.success=Заблоковано IP адресу {%0}\ncommands.banip.success.players=Заблоковано IP адресу {%0}, що належав {%1}\ncommands.banip.usage=/ban-ip <IP адреса|нік гравця> [причина]\n\ncommands.unbanip.invalid=Ви ввели неправильну IP адресу\ncommands.unbanip.success=Розблоковано IP адресу {%0}\ncommands.unbanip.usage=/pardon-ip <адреса>\n\ncommands.banipbyname.success=Гравця з ніком {%0} заблоковано по IP\ncommands.banipbyname.usage=/banipbyname <гравець>\n\ncommands.fill.usage=/fill <xМін> <yМін> <zМін> <xМакс> <yМакс> <zМакс> <ID>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=Ввімкнено автоматичне збереження світу\ncommands.save.disabled=Автоматичне збереження світу було вимкнено\ncommands.save.start=Збереження світу...\ncommands.save.success=Світ збережено\n\ncommands.setblock.usage=/setblock <x> <y> <z> <назва блоку> [втрата]\ncommand.setblock.invalidBlock=Недопустима назва блоку чи ID\n\ncommands.stop.usage=/stop\ncommands.stop.start=Зупинка серверу\n\ncommands.kick.success={%0} було від’єднано від серверу\ncommands.kick.success.reason=Гравця {%0} було від’єднано від серверу. Причина: '{%1}'\ncommands.kick.usage=/kick <гравець> [причина]\n\ncommands.tp.success=Переміщено {%0} до {%1}\ncommands.tp.success.coordinates=Переміщено {%0} на координати {%1}, {%2}, {%3}\ncommands.tp.usage=/tp [цільовий гравець] <назначений гравець> або /tp [цільовий гравець] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=Білий список має {%0} гравців (з {%1} відображених):\ncommands.whitelist.enabled=Білий список ввімкнено\ncommands.whitelist.disabled=Білий список вимкнено\ncommands.whitelist.reloaded=Білий список перезавантажено\ncommands.whitelist.add.success={%0} додано до білого списку\ncommands.whitelist.add.usage=/whitelist add <гравець>\ncommands.whitelist.remove.success={%0} видалено з білого списку\ncommands.whitelist.remove.usage=/whitelist remove <гравець>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=Встановлено власний режим гри - {%2}\ncommands.gamemode.success.other=Режим гри для гравця {%1} змінено на {%2}\ncommands.gamemode.usage=/gamemode <режим гри> [гравець]\n\ncommands.help.header=--- Строінка {%0} з {%1} (/help <сторінка>) ---\ncommands.help.usage=/help [сторінка|назва команди]\n\ncommands.message.usage=/tell <гравець> <приватне повідомлення>\ncommands.message.sameTarget=Нащо самому собі писати приватне повідомлення?!\n\ncommands.difficulty.usage=/difficulty <складність гри>\ncommands.difficulty.success=Складність гри змінено на {%0}\n\ncommands.spawnpoint.usage=/spawnpoint [гравець] [<x> <y> <z>]\ncommands.spawnpoint.success=Місце появи гравця {%0} - ({%1}, {%2}, {%3})\n\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=Місце появи у світі - ({%0}, {%1}, {%2})\n\ncommands.summon.usage=/summon [сутність] [<x> <y> <z>] [назва]\n\ncommands.xp.failure.withdrawXp=Неможливо дати гравцю від’ємне значення досвіду\ncommands.xp.success=Дано {%0} досвіду гравцю {%1}\ncommands.xp.success.levels=Дано {%0} рівнів досвіду гравцю {%1}\ncommands.xp.success.negative.levels=Забрано {%0} рівнів досвіду від гравця {%1}\ncommands.xp.usage=/xp <кількість> [гравець] або /xp <кількість рівнів> [гравець]\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=Інформацію про гравця \"{%0}\" не знайдено, створюємо новий профіль\npocketmine.data.playerCorrupted=Дані гравця \"{%0}\" пошкоджено, створюємо новий профіль\npocketmine.data.playerOld=Профіль гравця \"{%0}\" застарілий, оновлюємо на новий\npocketmine.data.saveError=Помилка збереження профіля гравця \"{%0}\": {%1}\n\npocketmine.level.notFound=Світ \"{%0}\" не знайдено\npocketmine.level.loadError=Помилка завантаження світу \"{%0}\": {%1}\npocketmine.level.generationError=Помилка генерації світу \"{%0}\": {%1}\npocketmine.level.tickError=Помилка промальовки світу \"{%0}\": {%1}\npocketmine.level.chunkUnloadError=Помилка під час вивантаження чанку: {%0}\npocketmine.level.backgroundGeneration=Генерується місце появи для світу \"{%0}\"\npocketmine.level.defaultError=Помилка завантаження світу за замовчуванням\npocketmine.level.preparing=Підготовка світу \"{%0}\"\npocketmine.level.unloading=Вивантаження світу \"{%0}\"\n\npocketmine.server.start=Запускається сервер Minecraft PE {%0}\npocketmine.server.networkError=[Мережа] Зупинено інтерфейс {%0}. Причина: {%1}\npocketmine.server.networkStart=Реєстрація серверу на {%0}:{%1}\npocketmine.server.info.extended=Сервер використовує {%0} {%1} 「{%2}」. Версія API: {%3}. Версія Minecraft PE: {%4}. Протокол версії {%5}\npocketmine.server.info=Цей сервер використовує {%0}, версію {%1} \"{%2}\" (API {%3})\npocketmine.server.license={%0} розповсюджується за ліцензією LGPL\npocketmine.server.tickOverload=Сервер перевантажено!\npocketmine.server.startFinished=Завантаження виконано. Час: {%0} секунд. Довідка по командам - \"help\" або \"?\"\npocketmine.server.defaultGameMode=Режим гри за замовчуванням: {%0}\npocketmine.server.query.start=Запуск прослуховувача GS4\npocketmine.server.query.info=QUERY порт - {%0}\npocketmine.server.query.running=Реєстрація QUERY на {%0}:{%1}\n\npocketmine.command.alias.illegal=Введено недопустимі знаки для альтернативи команди {%0}\npocketmine.command.alias.notFound=Помилка реєстрації альтернативи команди {%0}: знайдено недопустимі команди - {%1}\npocketmine.command.exception=Необроблене виключення при виконанні команди '{%0}' в {%1}: {%2}\n\npocketmine.commands.cave.usage=/cave <кут повороту> <довжина> <номер вітки> <міцність> <X> <Y> <Z> <назва світу> | /cave getmypos\npocketmine.commands.cave.info=Кут повороту: {%0}. Довжина: {%1}. Номер вітки: {%2}. Міцність: {%3}.\npocketmine.commands.cave.start=Створення печери розпочато! Будь ласка, зачекайте.\n\npocketmine.command.plugins.description=Список плагінів серверу\npocketmine.command.plugins.success=Плагіни ({%0}): {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=Перезавантажити налаштування серверу и плагіни\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Перезавантаження серверу...\npocketmine.command.reload.reloaded=Перезавантаження виконано.\n\npocketmine.command.lvdat.description=Змінити налаштування мапи.\npocketmine.command.lvdat.changed=Змінено параметр {%1} для світу \"{%0}\", необхідне перезавантаження для активації змін.\npocketmine.command.lvdat.fixname=Назву світу \"{%0}\" було успішно відредаговано, необхідне перезавантаження для активації змін.\npocketmine.command.lvdat.nofound=Світ \"{%0}\" не знайдено або не завантажено.\npocketmine.command.lvdat.preset=Налаштування генератору (пресети)\n\npocketmine.command.status.description=Інформація про продуктивність серверу.\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=Статус серверу\npocketmine.command.status.player=Всього гравців:\npocketmine.command.status.days=днів\npocketmine.command.status.hours=годин\npocketmine.command.status.minutes=хвилин\npocketmine.command.status.seconds=секунд\npocketmine.command.status.uptime=Час роботи серверу:\npocketmine.command.status.AverageTPS=Середній TPS:\npocketmine.command.status.CurrentTPS=Поточний TPS:\npocketmine.command.status.Networkupload=Даних відправлено:\npocketmine.command.status.Networkdownload=Даних отримано:\npocketmine.command.status.Threadcount=Кількість потоків:\npocketmine.command.status.Mainmemory=Основна пам’ять потоку:\npocketmine.command.status.Totalmemory=Загальна пам’ять:\npocketmine.command.status.Totalvirtualmemory=Загальна віртуальна пам’ять:\npocketmine.command.status.Heapmemory=Пам’ять кучі (Java Heap Memory):\npocketmine.command.status.Maxmemorysystem=Максимальна пам’ять системи:\npocketmine.command.status.Maxmemorymanager=Максимальна пам’ять менеджера:\npocketmine.command.status.World=Світ\npocketmine.command.status.chunks=чанків,\npocketmine.command.status.entities=сутностей,\npocketmine.command.status.tiles=тайлів.\npocketmine.command.status.Time=Час\npocketmine.command.status.ms=мс\n\npocketmine.command.gc.description=Запускає процес збирання сміття\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=Результат очистки\npocketmine.command.gc.chunks=Чанків:\npocketmine.command.gc.entities=Сутностей:\npocketmine.command.gc.tiles=Тайлів:\npocketmine.command.gc.cycles=Циклів:\npocketmine.command.gc.memory=Звільнена пам’ять:\n\npocketmine.command.biome.description=Змінює біом обраної області.\npocketmine.command.biome.posset=Встановлено точку {%3} на позиції: ({%1},{%2})[{%0}]\npocketmine.command.biome.get=ID біома, де Ви знаходитесь: {%0}. Колір: {%1},{%2},{%3}\npocketmine.command.biome.wrongLev=Точки знаходяться в різних світах.\npocketmine.command.biome.wrongBio=Помилковий ID біому. Приклад біомів: 1 (Рівнини), 2 (Пустеля)，13 (Льодяні гори)，6 (Болото)\npocketmine.command.biome.wrongCol=Неправильний колір! Приклад: 146,188,89. Використовуйте: \"/biome get\" для отримання решти кольорів.\npocketmine.command.biome.noPos=Використовуйте \"/biome pos1|pos2\", щоб встановити точки.\npocketmine.command.biome.set=Колір було змінено на {%0}\npocketmine.command.biome.color=Обрано колір {%0},{%1},{%2}\n\npocketmine.command.timings.description=Фіксує інформацію про середню продуктивність серверу.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=Розпочато фіксування даних про продуктивність серверу.\npocketmine.command.timings.disable=Фіксування даних про продуктивність серверу припинено.\npocketmine.command.timings.timingsDisabled=Для повторної активації фіксування даних про продуктивність серверу використовуйте /timings on\npocketmine.command.timings.reset=Дані про продуктивність серверу було скинуто\npocketmine.command.timings.pasteError=Помилка при фіксуванні даних про продуктивність серверу\npocketmine.command.timings.timingsUpload=Дані про продуктивність серверу завантажені з {%0}\npocketmine.command.timings.timingsRead=Дані про продуктивність серверу Ви можете отримати тут: {%0}\npocketmine.command.timings.timingsWrite=Дані про продуктивність серверу збережені до {%0}\n\npocketmine.command.version.description=Інформація про версію серверу і про встановлені плагіни \npocketmine.command.version.usage=/version [назва плагіну]\npocketmine.command.version.noSuchPlugin=Плагіна з такою назвою не знайдено. Використовуйте /plugins для отримання списку плагінів.\n\npocketmine.command.give.description=Дає гравцю зазначену к-сть предмету\npocketmine.command.give.usage=/give <гравець> <предмет[:втрата]> [кількість] [теги]\n\npocketmine.command.kill.description=Скоєння самогубства або вбивство іншого гравця\npocketmine.command.kill.usage=/kill [гравець]\n\npocketmine.command.particle.description=Додавання частинок у світ\npocketmine.command.particle.usage=/particle <назва> <x> <y> <z> <xd> <yd> <zd> [значення] [дані]\n\npocketmine.command.time.description=Перегляд або глобальна зміна часу\npocketmine.command.time.usage=/time <set|add> <значення> або /time <start|stop|query>\n\npocketmine.command.bancidbyname.description=Блокування гравця по номеру пристрою\npocketmine.command.bancid.description=Блокування номера пристрою\npocketmine.command.banipbyname.description=Блокування гравця по IP\npocketmine.command.ban.player.description=Блокування гравця\npocketmine.command.ban.ip.description=Блокування IP адреси\npocketmine.command.banlist.description=Список заблокованих гравців\npocketmine.command.defaultgamemode.description=Встановлює режим гри за замовчуванням\npocketmine.command.deop.description=Знімає статус оператора з гравця\npocketmine.command.difficulty.description=Встановлює складність гри\npocketmine.command.enchant.description=Додає зачарування предметам\npocketmine.command.effect.description=Зміна ефектів у гравців\npocketmine.command.gamemode.description=Зміна режиму гри у гравця\npocketmine.command.help.description=Довідка\npocketmine.command.kick.description=Примусове від’єднання гравця від серверу\npocketmine.command.list.description=Список гравців серверу, що зараз грають\npocketmine.command.me.description=Виконує вказану дію в чаті\npocketmine.command.op.description=Встановлює статус оператора для гравця\n\npocketmine.command.unban.cid.description=Розблокування номера пристрою\npocketmine.command.unban.player.description=Розблокування гравця по ніку\npocketmine.command.unban.ip.description=Розблокування IP адреси\n\npocketmine.command.save.description=Збереження файлів серверу\npocketmine.command.saveoff.description=Вимикання автоматичного збереження\npocketmine.command.saveon.description=Вмикання автоматичного збереження\npocketmine.command.say.description=Написати в чат від імені серверу\npocketmine.command.seed.description=Поточний сід світу\npocketmine.command.setworldspawn.description=Встановлення місце появи гравців у світі.\npocketmine.command.spawnpoint.description=Встановлення місце появи окремого гравця у світі\npocketmine.command.stop.description=Вимикання серверу\npocketmine.command.tp.description=Переміщення гравців\npocketmine.command.tell.description=Надсилання приватного повідомлення гравцю\npocketmine.command.xp.description=Зміна досвіду в гравця\npocketmine.command.summon.description=Створення сутності\npocketmine.command.fill.description=Заповнює вибрану область блоками\npocketmine.command.fill.missingParameter=Пропущені параметри\npocketmine.command.fill.usage=/fill <xМін> <yМін> <zМін> <xМакс> <yМакс> <zМакс> <ID>\npocketmine.command.setblock.description=Змінює блок по відповідних координатах\n\npocketmine.command.weather.description=Зміна погоди у світі\npocketmine.command.weather.usage=/weather <світ> (0,1,2,3)\npocketmine.command.weather.changed=Успішно змінено погоду в світі {%0}!\npocketmine.command.weather.noregistered=Світ {%0} не було зареєстровано в менеджері погоди.\npocketmine.command.weather.invalid=Помилкове значення погоди.\npocketmine.command.weather.wrong=Некорректні параметри.\npocketmine.command.weather.invalid.level=Неправильна назва світу.\n\npocketmine.command.whitelist.description=Керування білим списком серверу\n\npocketmine.crash.create=Увага! Роботу серверу припинено через фатальну помилку. Створення аварійного дампу.\npocketmine.crash.error=Помилка створення дампу: {%0}\npocketmine.crash.submit=Буль ласка, завантажте файл \"{%0}\" до Crash Archive і надішліть посилання на сторінку Bug Reporting. Вкажіть якомога більше інформації про цю помилку.\npocketmine.crash.archive=Аварійний дамп було автоматично відправлено до Crash Archive. Ви можете подивитися його тут: {%0}, або використати ID #{%1}.\n\npocketmine.debug.enable=Підтримку LevelDB ввімкнено\n\npocketmine.player.invalidMove={%0} некорректно пересунувся!\npocketmine.player.logIn={%0}[/{%1}:{%2}] приєднався з ID сутності {%3} на ({%4}, {%5}, {%6}, {%7})\npocketmine.player.logOut={%0}[/{%1}:{%2}] від’єднався: {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] було переміщено до {%3}\npocketmine.player.invalidEntity={%0} спробував атакувати некорректну сутність\n\npocketmine.plugin.load=Завантаження {%0}\npocketmine.plugin.enable=Ввімкнення {%0}\npocketmine.plugin.disable=Вимкнення {%0}\npocketmine.plugin.restrictedName=Обмежене ім’я\npocketmine.plugin.incompatibleAPI=Несумісна версія API\npocketmine.plugin.unknownDependency=Невідома залежність\npocketmine.plugin.circularDependency=Виявлена кругова залежність\npocketmine.plugin.genericLoadError=Помилка завантаження плагіну '{%0}'\npocketmine.plugin.spacesDiscouraged=Назва плагіну '{%0}' вказана з використанням пробілів, що є недопустимим\npocketmine.plugin.loadError=Помилка завантаження плагіну '{%0}': {%1}\npocketmine.plugin.duplicateError=Помилка завантаження '{%0}': плагін вже існує\npocketmine.plugin.fileError=Помилка завантаження '{%0}' в папці '{%1}': {%2}\npocketmine.plugin.commandError=Помилка завантаження команди {%0} для плагіну {%1}\npocketmine.plugin.aliasError=Помилка завантаження альтернативу {%0} для плагіну {%1}\npocketmine.plugin.deprecatedEvent=Плагін '{%0}' зареєстрував прослуховувача для '{%1}', використовуючи метод '{%2}'. Ця подія є застарілою.\npocketmine.plugin.eventError=\"Помилка обробки події '{%0}' в '{%1}': {%2} в {%3}\"\n"
  },
  {
    "path": "src/pocketmine/lang/locale/vie.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers\n#\n# A message doesn't need to be there to be shown correctly on the client.\n# Only messages shown in PocketMine itself need to be here\n\nlanguage.name=Vietnamese\nlanguage.selected=Chọn {%0} ({%1}) là ngôn ngữ chính\n\nmultiplayer.player.joined={%0} tham gia server\nmultiplayer.player.left={%0} rời khỏi server\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0} vừa nhận được danh hiệu {%1}\n\ndisconnectionScreen.outdatedClient=Phiên bản không hợp lệ!\ndisconnectionScreen.outdatedServer=Server có phiên bản không hợp lệ!\ndisconnectionScreen.serverFull=Server đã đầy!\ndisconnectionScreen.noReason=Mất kết nối tới server\ndisconnectionScreen.invalidSkin=Skin không hợp lệ!\ndisconnectionScreen.invalidName=Tên không được chứa kí tự hay dấu cách!\n\ndeath.fell.accident.generic={%0} ngã từ khu vực cao!\ndeath.attack.inFire={%0} đi vào đám cháy!\ndeath.attack.onFire={%0} bỏng tới chết!\ndeath.attack.lava={%0} thử bơi vào dung nham\ndeath.attack.inWall={%0} kẹt trong tường\ndeath.attack.drown={%0} chết chìm\ndeath.attack.cactus={%0} bị đâm tới chết\ndeath.attack.generic={%0} chết\ndeath.attack.explosion={%0} bị bùng nổ\ndeath.attack.explosion.player={%0} bị nổ bởi {%1}\ndeath.attack.magic={%0} bị giết bởi phép thuật\ndeath.attack.wither={%0} hóa xương\ndeath.attack.mob={%0} bị giết bởi {%1}\ndeath.attack.player={%0} bị giết bởi {%1}\ndeath.attack.player.item={%0} bị giết bởi {%1} sử dụng {%2}\ndeath.attack.arrow={%0} bị bắn bởi {%1}\ndeath.attack.arrow.item={%0} bị bắn bởi {%1} sử dụng {%2}\ndeath.attack.fall={%0} rơi xuống đất quá nặng\ndeath.attack.outOfWorld={%0} rơi khỏi thế giới\n\ngameMode.survival=Chế độ sống sốt\ngameMode.creative=Chế độ sáng tạo\ngameMode.adventure=Chế độ phiêu lưu\ngameMode.spectator=Chế độ theo dõi\ngameMode.changed=Chế độ chơi của bạn đã được cập nhật\n\npotion.moveSpeed=Nhanh nhẹn\npotion.moveSlowdown=Chậm chạp\npotion.digSpeed=Sức đào nhanh\npotion.digSlowDown=Sức đào chậm\npotion.damageBoost=Khỏe mạnh\npotion.heal=Hồi máu tức thì\npotion.harm=Sát thương tức thì\npotion.jump=Nhảy cao\npotion.confusion=Choáng váng\npotion.regeneration=Hồi máu mỗi giây\npotion.resistance=Kháng sát thương\npotion.fireResistance=Kháng lửa\npotion.waterBreathing=Thở dưới nước\npotion.invisibility=Tàng hình\npotion.blindness=Mù\npotion.nightVision=Mắt Cú\npotion.hunger=Đói\npotion.weakness=Yếu\npotion.poison=Độc\npotion.wither=Xương\npotion.healthBoost=Thêm máu\npotion.absorption=Khiên máu\npotion.saturation=Hút máu\n\ncommands.generic.exception=Lỗi khi thưc hiện câu lệnh này\ncommands.generic.permission=Bạn không có quyền sử dụng câu lệnh này\ncommands.generic.notFound=Sai cú pháp. Nhấn /help để xem các câu lệnh\ncommands.generic.player.notFound=Không tìm thấy người chơi này\ncommands.generic.usage=Cú pháp: {%0}\ncommands.generic.level=Tên-level\ncommands.generic.seed=Tên-seed\ncommands.generic.name=Tên\ncommands.generic.generator=Tên-tạo\ncommands.generic.opt.missing=Thiếu phần yêu cầu! Vui lòng xác nhận và đánh lại.\ncommands.generic.runingame=Chạy câu lệnh này trong game\n\ncommands.time.added=Thêm {%0} vào thời gian\ncommands.time.set=Đặt thời gian là {%0}\ncommands.time.query=Thời gian là {%0}\n\ncommands.me.usage=/me <hành động ...>\n\ncommands.give.item.notFound=Không có đồ nào có id {%0}\ncommands.give.success=Đưa {%0} * {%1} cho {%2}\ncommands.give.tagError=Data tag parsing failed: {%0}\n\ncommands.effect.usage=/effect <người chơi> <hiệu ứng> [giây] [cấp độ] [bổ sung lời nhắn] hoặc /effect <người chơi> clear\ncommands.effect.notFound=Không có dạng hiệu ứng với id {%0}\ncommands.effect.success=Tạo hiệu ứng {%0} (ID {%1}) * {%2} cho {%3} là {%4} seconds\ncommands.effect.success.removed=Lấy hết {%0} từ {%1}\ncommands.effect.success.removed.all=Lấy tất cả hiệu ứng từ {%0}\ncommands.effect.failure.notActive=Không thể lấy {%0} từ {%1} vì họ không có hiệu ứng\ncommands.effect.failure.notActive.all=Không thể lấy tất cả hiệu ứng từ {%0} vì họ không có\n\ncommands.enchant.noItem=Người chơi không cầm vũ khí\ncommands.enchant.notFound=Không có dạng cường hóa với id {%0}\ncommands.enchant.success=Cường hóa thành công\ncommands.enchant.cantEnchant=This item cannot be enchanted\ncommands.enchant.usage=/enchant <người chơi> <ID cường hóa> [cấp độ]\ncommands.particle.success=Chơi cường hóa {%0} trong thời gian là {%1}\ncommands.particle.notFound=Tên cường hóa không hợp lệ với {%0}\ncommands.players.usage=/list\ncommands.players.list=Có tất cả {%0}/{%1} đang online:\ncommands.kill.successful=Giết {%0}\ncommands.banlist.ips=Có tất cả %d IP bị cấm trong server:\ncommands.banlist.players=Có tất cả {%0} người chơi bị cấm:\ncommands.banlist.usage=/banlist [ips|players]\ncommands.defaultgamemode.usage=/defaultgamemode <chế độ>\ncommands.defaultgamemode.success=Chế độ mặc định của world được đặt là {%0}\n\ncommands.op.success=Bổ nhiệm {%0}\ncommands.op.usage=/op <người chơi>\n\ncommands.deop.success=Bãi nhiệm {%0}\ncommands.deop.usage=/deop <người chơi>\n\ncommands.say.usage=/say <tin nhắn ...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=Hạt giống: {%0}\n\ncommands.bancidbyname.success=Cấm hệ thống của người chơi {%0}\ncommands.bancidbyname.usage=/bancidbyname <người chơi>\ncommands.bancid.success=Cấm hệ thống: {%0}\ncommands.bancid.usage=/bancid <Mã hệ thống>\ncommands.unbancid.usage=/pardoncid <Mã hệ thống>\ncommands.ban.success=Cấm người chơi {%0}\ncommands.ban.usage=/ban <tên người chơi> [lý do ...] [time(day)]\ncommands.unban.success=Hủy cấm người chơi {%0}\ncommands.unban.usage=/pardon <người chơi>\ncommands.banip.invalid=IP không hợp lệ hoặc người chơi chưa online\ncommands.banip.success=Cấm địa chỉ {%0}\ncommands.banip.success.players=Cấm địa chỉ {%0} thuộc về {%1}\ncommands.banip.usage=/ban-ip <địa chỉ|tên người chơi> [lý do ...]\ncommands.unbanip.invalid=Địa chỉ không hợp lệ\ncommands.unbanip.success=Hủy cấm địa chỉ {%0}\ncommands.unbanip.usage=/pardon-ip <địa chỉ>\ncommands.banipbyname.success=Cấm địa chỉ của người chơi {%0}\ncommands.banipbyname.usage=/banipbyname <tên người chơi>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=Bật chế độ tự động lưu thế giới\ncommands.save.disabled=Tắt chế độ tự động lưu thế giới\ncommands.save.start=Đang lưu...\ncommands.save.success=Đã lưu toàn bộ!\n\ncommands.setblock.usage=/setblock <x> <y> <z> <tên block> [damage]\ncommand.setblock.invalidBlock=ID/tên block không hợp lệ\n\ncommands.stop.usage=/stop\ncommands.stop.start=Đang dừng server...\n\ncommands.kick.success=Đuổi người chơi {%0} khỏi server\ncommands.kick.success.reason=Đuổi {%0} khỏi server. Lý do: '{%1}'\ncommands.kick.usage=/kick <người chơi> [lý do ...]\n\ncommands.tp.success=Di chuyển người chơi {%0} đến {%1}\ncommands.tp.success.coordinates=Di chuyển người chơi {%0} đến {%1}, {%2}, {%3}\ncommands.tp.usage=/tp [người chơi 1] <người chơi 2> OR /tp [người chơi 1] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=Có tất cả {%0} (ngoại trừ {%1}) người chơi trong danh sách trắng:\ncommands.whitelist.enabled=Bật danh sách trắng\ncommands.whitelist.disabled=Tắt danh sách trắng\ncommands.whitelist.reloaded=Tải lại danh sách trắng\ncommands.whitelist.add.success=Thêm {%0} vào danh sách trắng\ncommands.whitelist.add.usage=/whitelist add <người chơi>\ncommands.whitelist.remove.success=Loại {%0} khỏi danh sách trắng\ncommands.whitelist.remove.usage=/whitelist remove <người chơi>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=Đặt chế độ chơi là {%2}\ncommands.gamemode.success.other=Đặt {%1} cho {%2}\ncommands.gamemode.usage=/gamemode <chế độ> [người chơi]\ncommands.help.header=---> Xem trang hướng dẫn {%0} trong {%1} (/help <số trang>) ---\ncommands.help.usage=/help [sô trang|câu lệnh]\ncommands.message.usage=/tell <người chơi> <tin nhắn riêng ...>\ncommands.message.sameTarget=Bạn không thể gửi cho chính mình!\ncommands.xp.usage=/xp <sô kinh nghiệm hoặc Số kinh nghiệm+L> <người chơi>\n\ncommands.difficulty.usage=/difficulty <mức độ mới>\ncommands.difficulty.success=Đặt mức độ chơi ở mức {%0}\n\ncommands.spawnpoint.usage=/spawnpoint [người chơi] [<x> <y> <z>]\ncommands.spawnpoint.success=Đặt điểm spawn {%0} ở ({%1}, {%2}, {%3})\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=Đặt điểm mặc định ở ({%0}, {%1}, {%2})\ncommands.summon.usage=/summon [tên mob] [<x> <y> <z>] [đặt tên cho mob]\n\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=Player data not found for \"{%0}\", creating new profile\npocketmine.data.playerCorrupted=Corrupted data found for \"{%0}\", creating new profile\npocketmine.data.playerOld=Old Player data found for \"{%0}\", upgrading profile\npocketmine.data.saveError=Could not save player \"{%0}\": {%1}\npocketmine.level.notFound=Level \"{%0}\" not found\npocketmine.level.loadError=Could not load level \"{%0}\": {%1}\npocketmine.level.generationError=Could not generate level \"{%0}\": {%1}\npocketmine.level.tickError=Could not tick level \"{%0}\": {%1}\npocketmine.level.chunkUnloadError=Error while unloading a chunk: {%0}\npocketmine.level.backgroundGeneration=Spawn terrain for level \"{%0}\" is being generated in the background\npocketmine.level.defaultError=No default level has been loaded\npocketmine.level.preparing=Preparing level \"{%0}\"\npocketmine.level.unloading=Unloading level \"{%0}\"\npocketmine.server.start=Starting Minecraft: PE server version {%0}\npocketmine.server.networkError=[Network] Stopped interface {%0} due to {%1}\npocketmine.server.networkStart=Opening server on {%0}:{%1}\npocketmine.server.info=This server is running {%0} version {%1} \"{%2}\" (API {%3})\npocketmine.server.info.extended=This server is running {%0} {%1} 「{%2}」 implementing API version {%3} for Minecraft: PE {%4} (protocol version {%5})\npocketmine.server.license={%0} is distributed under the LGPL License\npocketmine.server.tickOverload=Can't keep up! Is the server overloaded?\npocketmine.server.startFinished=Done ({%0}s)! For help, type \"help\" or \"?\"\npocketmine.server.defaultGameMode=Default game type: {%0}\npocketmine.server.query.start=Starting GS4 status listener\npocketmine.server.query.info=Setting query port to {%0}\npocketmine.server.query.running=Query running on {%0}:{%1}\n\npocketmine.command.alias.illegal=Could not register alias {%0} because it contains illegal characters\npocketmine.command.alias.notFound=Could not register alias {%0} because it contains commands that do not exist: {%1}\npocketmine.command.exception=Unhandled exception executing command '{%0}' in {%1}: {%2}\n\npocketmine.command.plugins.description=Gets a list of plugins running on the server\npocketmine.command.plugins.success=Plugins ({%0}): {%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=Reloads the server configuration and plugins\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=Reloading server...\npocketmine.command.reload.reloaded=Reload complete.\n\npocketmine.command.status.description=Reads back the server's performance.\npocketmine.command.status.usage=/status\npocketmine.command.status.title=Server status\npocketmine.command.status.player=Player count:\npocketmine.command.status.days=days\npocketmine.command.status.hours=hours\npocketmine.command.status.minutes=minutes\npocketmine.command.status.seconds=seconds\npocketmine.command.status.uptime=Uptime:\npocketmine.command.status.AverageTPS=Average TPS:\npocketmine.command.status.CurrentTPS=Current TPS:\npocketmine.command.status.Networkupload=Network upload:\npocketmine.command.status.Networkdownload=Network download:\npocketmine.command.status.Threadcount=Thread count:\npocketmine.command.status.Mainmemory=Main thread memory:\npocketmine.command.status.Totalmemory=Total memory:\npocketmine.command.status.Totalvirtualmemory=Total virtual memory:\npocketmine.command.status.Heapmemory=Heap memory:\npocketmine.command.status.Maxmemorysystem=Maximum memory (system):\npocketmine.command.status.Maxmemorymanager=Maximum memory (manager):\npocketmine.command.status.World=World\npocketmine.command.status.chunks=chunks,\npocketmine.command.status.entities=entities,\npocketmine.command.status.tiles=tiles.\npocketmine.command.status.Time=Time\npocketmine.command.status.ms=ms\npocketmine.command.gc.description=Fires garbage collection tasks\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=Danh sách dọn dẹp:\npocketmine.command.gc.chunks=Chunks:\npocketmine.command.gc.entities=Vật thể:\npocketmine.command.gc.tiles=Tiles:\npocketmine.command.gc.cycles=Cycles:\npocketmine.command.gc.memory=Bộ nhớ được thả:\n\npocketmine.command.timings.description=Records timings to see performance of the server.\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=Enabled Timings & Reset\npocketmine.command.timings.disable=Disabled Timings\npocketmine.command.timings.timingsDisabled=Please enable timings by typing /timings on\npocketmine.command.timings.reset=Timings reset\npocketmine.command.timings.pasteError=An error happened while pasting the report\npocketmine.command.timings.timingsUpload=Timings uploaded to {%0}\npocketmine.command.timings.timingsRead=You can read the results at {%0}\npocketmine.command.timings.timingsWrite=Timings written to {%0}\npocketmine.command.version.description=Gets the version of this server including any plugins in use\npocketmine.command.version.usage=/version [plugin name]\npocketmine.command.version.noSuchPlugin=This server is not running any plugin by that name. Use /plugins to get a list of plugins.\npocketmine.command.give.description=Gives the specified player a certain amount of items\npocketmine.command.give.usage=/give <player> <item[:damage]> [amount] [tags...]\npocketmine.command.kill.description=Commit suicide or kill other players\npocketmine.command.kill.usage=/kill [player]\npocketmine.command.particle.description=Adds particles to a world\npocketmine.command.particle.usage=/particle <name> <x> <y> <z> <xd> <yd> <zd> [count] [data]\npocketmine.command.time.description=Changes the time on each world\npocketmine.command.time.usage=/time <set|add> <value> OR /time <start|stop|query>\npocketmine.command.bancidbyname.description=Prevents the specified CID by name from using this server禁止指定玩家的設備 ID\npocketmine.command.bancid.description=Prevents the specified CID from using this server\npocketmine.command.banipbyname.description=Prevents the specified IP address by name from using this server\npocketmine.command.ban.player.description=Prevents the specified player from using this server\npocketmine.command.ban.ip.description=Prevents the specified IP address from using this server\npocketmine.command.banlist.description=View all players banned from this server\npocketmine.command.defaultgamemode.description=Set the default gamemode\npocketmine.command.deop.description=Takes the specified player's operator status\npocketmine.command.difficulty.description=Sets the game difficulty\npocketmine.command.enchant.description=Adds enchantments on items\npocketmine.command.effect.description=Adds/Removes effects on players\npocketmine.command.gamemode.description=Changes the player to a specific game mode\npocketmine.command.help.description=Shows the help menu\npocketmine.command.kick.description=Removes the specified player from the server\npocketmine.command.list.description=Lists all online players\npocketmine.command.me.description=Performs the specified action in chat\npocketmine.command.op.description=Gives the specified player operator status\npocketmine.command.unban.cid.description=Allows the specified CID to use this server\npocketmine.command.unban.player.description=Allows the specified player to use this server\npocketmine.command.unban.ip.description=Allows the specified IP address to use this server\npocketmine.command.save.description=Saves the server to disk\npocketmine.command.saveoff.description=Disables server autosaving\npocketmine.command.saveon.description=Enables server autosaving\npocketmine.command.say.description=Broadcasts the given message as the sender\npocketmine.command.seed.description=Shows the world seed\npocketmine.command.setworldspawn.description=Sets a worlds's spawn point. If no coordinates are specified, the player's coordinates will be used.\npocketmine.command.spawnpoint.description=Sets a player's spawn point\npocketmine.command.stop.description=Stops the server\npocketmine.command.tp.description=Teleports the given player (or yourself) to another player or coordinates\npocketmine.command.tell.description=Sends a private message to the given player\npocketmine.command.xp.description=Add experience or experience level to the given player\npocketmine.command.summon.description=Summons a entity at the player's location or a specific location\npocketmine.command.fill.description=fills a specific selection with blocks\npocketmine.command.setblock.description=Changes a block to another block\n\npocketmine.command.weather.description=Set weather for level\npocketmine.command.weather.usage=/weather <level-name weather|weather>\npocketmine.command.weather.changed=Weather changed successfully in level {%0}!\npocketmine.command.weather.noregistered=level {%0} hasn't registered to WeatherManager.\npocketmine.command.weather.invalid=Invalid weather.(0,1,2,3)\npocketmine.command.weather.wrong=Wrong parameters.\npocketmine.command.weather.invalid.level=Invalid level name.\npocketmine.command.whitelist.description=Manages the list of players allowed to use this server\npocketmine.crash.create=An unrecoverable error has occurred and the server has crashed. Creating a crash dump\npocketmine.crash.error=Could not create crash dump: {%0}\npocketmine.crash.submit=Please upload the \"{%0}\" file to the Crash Archive and submit the link to the Bug Reporting page. Give as much info as you can.\npocketmine.crash.archive=The crash dump has been automatically submitted to the Crash Archive. You can view it on {%0} or use the ID #{%1}.\npocketmine.debug.enable=LevelDB support enabled\npocketmine.player.invalidMove={%0} moved wrongly!\npocketmine.player.logIn={%0}[/{%1}:{%2}] [ClientID: {%3}] logged in with entity id {%4} at ({%5}, {%6}, {%7}, {%8})\npocketmine.player.logOut={%0}[/{%1}:{%2}] logged out due to {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] was transferred to {%3}\npocketmine.player.invalidEntity={%0} tried to attack an invalid entity\npocketmine.plugin.load=Loading {%0}\npocketmine.plugin.enable=Enabling {%0}\npocketmine.plugin.disable=Disabling {%0}\npocketmine.plugin.restrictedName=Restricted name\npocketmine.plugin.incompatibleAPI=Incompatible API version\npocketmine.plugin.unknownDependency=Unknown dependency\npocketmine.plugin.circularDependency=Circular dependency detected\npocketmine.plugin.genericLoadError=Could not load plugin '{%0}'\npocketmine.plugin.spacesDiscouraged=Plugin '{%0}' uses spaces in its name, this is discouraged\npocketmine.plugin.loadError=Could not load plugin '{%0}': {%1}\npocketmine.plugin.duplicateError=Could not load plugin '{%0}': plugin exists\npocketmine.plugin.fileError=Could not load '{%0}' in folder '{%1}': {%2}\npocketmine.plugin.commandError=Could not load command {%0} for plugin {%1}\npocketmine.plugin.aliasError=Could not load alias {%0} for plugin {%1}\npocketmine.plugin.deprecatedEvent=Plugin '{%0}' has registered a listener for '{%1}' on method '{%2}', but the event is Deprecated.\npocketmine.plugin.eventError=\"Could not pass event '{%0}' to '{%1}': {%2} on {%3}\n"
  },
  {
    "path": "src/pocketmine/lang/locale/zho.ini",
    "content": "# Language file compatible with Minecraft: Pocket Edition identifiers=\n#=\n# A message doesn't need to be there to be shown correctly on the client.=\n# Only messages shown in PocketMine itself need to be here=\n\nlanguage.name=中文(繁體)\nlanguage.selected=設定 {%0} ({%1}) 為基本語言\n\nmultiplayer.player.joined={%0} 加入了伺服器\nmultiplayer.player.left={%0} 離開了伺服器\n\nchat.type.text={%0} : {%1}\nchat.type.emote=* {%0} {%1}\nchat.type.announcement=[{%0}] {%1}\nchat.type.admin=[{%0}: {%1}]\nchat.type.achievement={%0} 剛剛獲得了成就 {%1}\n\ndisconnectionScreen.notAuthenticated=您需要 Xbox 登入\ndisconnectionScreen.outdatedClient=用戶端版本過舊！\ndisconnectionScreen.outdatedServer=伺服器版本過舊！\ndisconnectionScreen.serverFull=伺服器人數已滿！\ndisconnectionScreen.noReason=與伺服器連線中斷\ndisconnectionScreen.invalidSkin=無效的皮膚！\ndisconnectionScreen.invalidName=無效名稱!\n\ndeath.fell.accident.generic={%0} 從高處摔落\ndeath.attack.inFire={%0} 在火焰中升天\ndeath.attack.onFire={%0} 被燒死了\ndeath.attack.lava={%0} 嘗試在熔岩游泳\ndeath.attack.inWall={%0} 在牆壁裡窒息\ndeath.attack.drown={%0} 溺死了\ndeath.attack.cactus={%0} 被仙人掌刺死了\ndeath.attack.generic={%0} 已死亡\ndeath.attack.explosion={%0} 被炸飛了\ndeath.attack.explosion.player={%0} 被 {%1} 炸死了\ndeath.attack.magic={%0} 被魔法殺死了\ndeath.attack.wither={%0} 凋零至死了\ndeath.attack.mob={%0} 被 {%1} 殺死了\ndeath.attack.player={%0} 被 {%1} 殺死了\ndeath.attack.player.item={%0} 被 {%1} 用 {%2} 殺死了\ndeath.attack.arrow={%0} 被 {%1} 射殺了\ndeath.attack.arrow.item={%0} 被 {%1} 用 {%2} 射殺了\ndeath.attack.fall={%0} 以為能安然無恙的著地\ndeath.attack.outOfWorld={%0} 掉到世界外面了\n\ngameMode.survival=生存模式\ngameMode.creative=創造模式\ngameMode.adventure=冒險模式\ngameMode.spectator=觀眾模式\ngameMode.changed=您的遊戲模式已更新\n\npotion.moveSpeed=移動加速\npotion.moveSlowdown=移動減速\npotion.digSpeed=挖掘加速\npotion.digSlowDown=挖掘減速\npotion.damageBoost=增加攻擊力\npotion.heal=立即治療\npotion.harm=立即傷害\npotion.jump=跳躍提升\npotion.confusion=噁心\npotion.regeneration=恢復\npotion.resistance=抗性\npotion.fireResistance=抗火性\npotion.waterBreathing=水下呼吸\npotion.invisibility=隱身\npotion.blindness=失明\npotion.nightVision=夜視\npotion.hunger=飢餓\npotion.weakness=虛弱\npotion.poison=中毒\npotion.wither=凋零\npotion.healthBoost=生命值提升\npotion.absorption=吸收\npotion.saturation=飽食度\n\ncommands.generic.exception=嘗試執行此指令時發生未知錯誤\ncommands.generic.permission=您沒有權限使用此指令\ncommands.generic.notFound=未知的指令。請使用 /help 來顯示指令列表。\ncommands.generic.player.notFound=找不到該玩家\ncommands.generic.usage=用法：{%0}\ncommands.generic.level=地圖名\ncommands.generic.seed=種子碼\ncommands.generic.name=名稱\ncommands.generic.generator=生成器名稱\ncommands.generic.opt.missing=指令缺少參數，請確認後重新輸入。\ncommands.generic.runingame=請在遊戲中使用該指令\n\ncommands.time.added=時間增加了 {%0}\ncommands.time.set=時間設定為 {%0}\ncommands.time.query=現在時間是 {%0}\n\ncommands.me.usage=/me <action ...>\n\ncommands.give.item.notFound=ID為 {%0} 的物品並不存在\ncommands.give.success=將 {%0} * {%1} 給 {%2}\ncommands.give.tagError=數據格式不正確: {%0}\n\ncommands.effect.usage=/effect <玩家名稱> <效果> [秒數] [倍數] [隱藏粒子] 或 /effect <玩家名稱> clear\ncommands.effect.notFound=ID為 {%0} 的特殊效果並不存在\ncommands.effect.success=對 {%3} 加上了 {%4} 秒的 {%0} (ID {%1}) * {%2}\ncommands.effect.success.removed=從 {%1} 身上移除了 {%0}\ncommands.effect.success.removed.all=已解除 {%0} 身上所有特殊狀態\ncommands.effect.failure.notActive=無法從 {%1} 身上移除 {%0}，因為其身上無此效果\ncommands.effect.failure.notActive.all=無法移除效果因為 {%0} 身上沒有任何效果\n\ncommands.enchant.noItem=目標沒有手持一樣物品\ncommands.enchant.notFound=沒有一個附魔ID為 {%0}\ncommands.enchant.success=附魔完成\ncommands.enchant.cantEnchant=這件物品不能被附魔！\ncommands.enchant.usage=/enchant <玩家名稱> <附魔ID> [物品等級]\ncommands.particle.success=正在應用 {%0} 效果 {%1} 次\ncommands.particle.notFound=未知的效果名稱 {%0}\ncommands.players.usage=/list\ncommands.players.list=共有 {%0}/{%1} 玩家在線上：\ncommands.kill.successful=已刪除 {%0}\ncommands.banlist.ips=共有 %d 個被封鎖的 IP 位址：\ncommands.banlist.players=共有 {%0} 個被封鎖的玩家：\ncommands.banlist.cids=共有 {%0} 禁止的 CIDs:\ncommands.banlist.usage=/banlist [ips|players]\ncommands.defaultgamemode.usage=/defaultgamemode <模式>\ncommands.defaultgamemode.success=預設遊戲模式已設定為 {%0}\n\ncommands.op.success={%0} 獲得管理員權限\ncommands.op.usage=/op <玩家名稱>\n\ncommands.deop.success={%0} 移除管理員\ncommands.deop.usage=/deop <玩家名稱>\n\ncommands.say.usage=/say <訊息...>\n\ncommands.seed.usage=/seed\ncommands.seed.success=種子碼：{%0}\n\ncommands.bancidbyname.success=封鎖玩家 {%0} 的CID\ncommands.bancidbyname.usage=/bancidbyname <玩家名稱>\n\ncommands.bancid.success=封鎖CID: {%0}\ncommands.bancid.usage=/bancid <設備ID>\n\ncommands.unbancid.usage=/pardoncid <設備ID>\ncommands.unbancid.success=Unbanned CID {%0}\n\ncommands.ban.success=封鎖玩家 {%0}\ncommands.ban.usage=/ban <玩家名稱> [原因...] [時間(天)]\n\ncommands.unban.success=解封玩家 {%0}\ncommands.unban.usage=/pardon <玩家名稱>\n\ncommands.banip.invalid=您輸入了一個無效的 IP 位址、玩家名稱或不在線上\ncommands.banip.success=封鎖 IP 位址 {%0} 。\ncommands.banip.success.players=封鎖 IP 位址 {%0} 來自 {%1}\ncommands.banip.usage=/ban-ip <IP 位址|玩家名稱> [原因 ...]\n\ncommands.unbanip.invalid=您輸入了一個無效的 IP 位址\ncommands.unbanip.success=解除封鎖 IP 位址 {%0}\ncommands.unbanip.usage=/pardon-ip <IP 位址>\n\ncommands.banipbyname.success=封鎖玩家 {%0} 的IP\ncommands.banipbyname.usage=/banipbyname <玩家名稱>\n\ncommands.save.usage=/save-all\ncommands.save-on.usage=/save-on\ncommands.save-off.usage=/save-off\ncommands.save.enabled=開啟地圖自動存檔功能\ncommands.save.disabled=關閉地圖自動存檔功能\ncommands.save.start=正在儲存...\ncommands.save.success=儲存完畢\n\ncommands.setblock.usage=/setblock <x> <y> <z> <方塊名> [數據值]\ncommand.setblock.invalidBlock=無效的方塊名稱/ID\n\ncommands.stop.usage=/stop\ncommands.stop.start=停止伺服器中\n\ncommands.kick.success={%0} 從遊戲中被踢出\ncommands.kick.success.reason={%0} 從遊戲中被踢出：{%1}\ncommands.kick.usage=/kick <玩家名稱> [原因...]\n\ncommands.tp.success=已傳送 {%0} 至 {%1}\ncommands.tp.success.coordinates=已傳送 {%0} 至 {%1}, {%2}, {%3}\ncommands.tp.usage=/tp [玩家名稱] <目標玩家> 或是 /tp [玩家名稱] <x> <y> <z> [<y-rot> <x-rot>]\n\ncommands.whitelist.list=有 {%0} 人(全部 {%1} 人) 為白名單玩家:\ncommands.whitelist.enabled=已開啟白名單\ncommands.whitelist.disabled=已關閉白名單\ncommands.whitelist.reloaded=重置白名單\ncommands.whitelist.add.success=新增 {%0} 至白名單\ncommands.whitelist.add.usage=/whitelist add <玩家名稱>\ncommands.whitelist.remove.success=從白名單刪除 {%0}\ncommands.whitelist.remove.usage=/whitelist remove <玩家名稱>\ncommands.whitelist.usage=/whitelist <on|off|list|add|remove|reload>\n\ncommands.gamemode.success.self=設定自身的遊戲模式為 {%2}\ncommands.gamemode.success.other=設定 {%1} 的遊戲模式為 {%2}\ncommands.gamemode.usage=/gamemode <模式> [玩家名稱]\ncommands.help.header=--- 查看幫助列表第 {%0} 頁共 {%1} 頁 (/help <page>) ---\ncommands.help.usage=/help [頁數|指令名稱]\ncommands.message.usage=/tell <玩家名稱> <訊息...>\ncommands.message.sameTarget=您不能傳送訊息給自己！\ncommands.xp.usage=/xp <經驗值或等級+L> <玩家名稱>\n\ncommands.difficulty.usage=/difficulty <難度>\ncommands.difficulty.success=設定遊戲難度為 {%0}\n\ncommands.spawnpoint.usage=/spawnpoint [玩家名稱] [<x> <y> <z>]\ncommands.spawnpoint.success=設定 {%0} 的重生點為 ({%1}, {%2}, {%3})\ncommands.setworldspawn.usage=/setworldspawn [<x> <y> <z>]\ncommands.setworldspawn.success=設定世界重生點為 ({%0}, {%1}, {%2})\n\ncommands.summon.usage=/summon <實體名稱> [<x> <y> <z>] [數據標籤]\n\n\n# -------------------- PocketMine language files, only for console --------------------\npocketmine.data.playerNotFound=無法找到玩家數據 \"{%0}\"，正在創建新的數據檔\npocketmine.data.playerCorrupted=發現損壞的數據 \"{%0}\"，創建新的設定檔\npocketmine.data.playerOld=發現舊的玩家數據 \"{%0}\"，更新設定檔\npocketmine.data.saveError=無法儲存 \"{%0}\" 的玩家資料：{%1}\npocketmine.level.notFound=無法找到 \"{%0}\" 地圖\npocketmine.level.loadError=無法讀取地圖 \"{%0}\"：{%1}\npocketmine.level.generationError=無法產生地圖 \"{%0}\"：{%1}\npocketmine.level.tickError=計算地圖「{%0}」時出現錯誤︰{%1}\npocketmine.level.chunkUnloadError=移除一個區塊時發生錯誤：{%0}\npocketmine.level.backgroundGeneration=正在於背景生成世界 「{%0}「 的地形\npocketmine.level.defaultError=沒有讀取預設的地圖\npocketmine.level.preparing=準備地圖中... \"{%0}\"\npocketmine.level.unloading=正在移除地圖 \"{%0}\"\npocketmine.server.start=正在啟動支援 Minecraft：PE {%0} 版本的伺服器\npocketmine.server.networkError=[網路] 停止接口 {%0} 由於 {%1}\npocketmine.server.networkStart=正在啟動伺服器在 {%0}:{%1}\npocketmine.server.info=此伺服器正在運作 {%0} {%1} 版本 \"{%2}\" （API {%3}）\n\npocketmine.server.info.extended=此伺服器正在運作 {%0} {%1} 「{%2}」 執行 API 版本 {%3} 支援 Minecraft：PE {%4} （協定版本 {%5}）\npocketmine.server.info.extended1=本伺服器正運行 {%0}{%1} (代號 \"{%2}\")\npocketmine.server.info.extended2=PHP 版本: {%0}\npocketmine.server.info.extended3=API: {%0} (iTX API 版本 {%1})\npocketmine.server.info.extended4=Target client: Minecraft PE {%0} (protocol 版本 {%1})\n\npocketmine.server.license={%0} 根據 LGPL 許可發佈\npocketmine.server.tickOverload=注意！伺服器有超載的可能\npocketmine.server.startFinished=讀取完成 ({%0}s)！如需幫助，請輸入 \"help\" 或 \"?\"\npocketmine.server.defaultGameMode=預設的遊戲類型：{%0}\npocketmine.server.query.start=啟動 GS4 狀態監聽器\npocketmine.server.query.info=設定 query 接口到 {%0}\npocketmine.server.query.running=Query 運作在 {%0}:{%1}\n\npocketmine.command.alias.illegal=不能註冊別名 {%0}，因為它包含非法字符\npocketmine.command.alias.notFound=未能登記別稱 {%0} ，因為它包含不存在的指令： {%1}\npocketmine.command.exception=於 {%1} 執行指令 「{%0}「 時，出現了未被處理的錯誤： {%2}\n\npocketmine.command.plugins.description=獲取在伺服器上運行的插件列表\npocketmine.command.plugins.success=插件 ({%0})：{%1}\npocketmine.command.plugins.usage=/plugins\n\npocketmine.command.reload.description=重新讀取伺服器設定和插件\npocketmine.command.reload.usage=/reload\npocketmine.command.reload.reloading=重新讀取伺服器...\npocketmine.command.reload.reloaded=重新讀取完成\n\npocketmine.command.status.description=重新讀取伺服器的性能。\npocketmine.command.status.usage=/status\n\npocketmine.command.status.title=伺服器狀態\npocketmine.command.status.player=伺服器人數:\npocketmine.command.status.days=天\npocketmine.command.status.hours=小時\npocketmine.command.status.minutes=分\npocketmine.command.status.seconds=秒\npocketmine.command.status.uptime=運行時間:\npocketmine.command.status.AverageTPS=平均TPS:\npocketmine.command.status.CurrentTPS=瞬時TPS:\npocketmine.command.status.Networkupload=網路上傳:\npocketmine.command.status.Networkdownload=網路下載:\npocketmine.command.status.Threadcount=線程總數:\npocketmine.command.status.Mainmemory=線程總數:\npocketmine.command.status.Totalmemory=總記憶體:\npocketmine.command.status.Totalvirtualmemory=總虛擬記憶體:\npocketmine.command.status.Heapmemory=堆棧記憶體:\npocketmine.command.status.Maxmemorysystem=系統最大記憶體:\npocketmine.command.status.Maxmemorymanager=核心全域最大記憶體:\npocketmine.command.status.World=世界\npocketmine.command.status.chunks=區塊,\npocketmine.command.status.entities=實體,\npocketmine.command.status.tiles=tiles.\npocketmine.command.status.Time=時間\npocketmine.command.status.ms=毫秒\n\npocketmine.command.gc.description=啟動垃圾清除任務\npocketmine.command.gc.usage=/gc\npocketmine.command.gc.title=垃圾回收結果\npocketmine.command.gc.chunks=區塊:\npocketmine.command.gc.entities=實體:\npocketmine.command.gc.tiles=方塊:\npocketmine.command.gc.cycles=循環:\npocketmine.command.gc.memory=記憶體釋放:\n\npocketmine.command.timings.description=紀錄計時數據，以檢視伺服器的性能。\npocketmine.command.timings.usage=/timings <reset|report|on|off|paste>\npocketmine.command.timings.enable=啟用定時和重啟\npocketmine.command.timings.disable=停用定時\npocketmine.command.timings.timingsDisabled=啟用定時工具透過 /timings on\npocketmine.command.timings.reset=定時重啟\npocketmine.command.timings.pasteError=已記錄在事件記錄檔中\npocketmine.command.timings.timingsUpload=計時數據已被上載至 {%0}\npocketmine.command.timings.timingsRead=你可以在 {%0} 閱讀計時結果\npocketmine.command.timings.timingsWrite=計時數據已被儲存至 {%0}\npocketmine.command.version.description=檢視此伺服器 (及其使用的插件) 的版本\npocketmine.command.version.usage=/version [插件名稱]\npocketmine.command.version.noSuchPlugin=該伺服器沒有運行任何叫這個名稱的插件。使用 /plugins 來獲得插件列表。\npocketmine.command.give.description=給指定玩家一定數量的物品\npocketmine.command.give.usage=/give <玩家名稱> <物品[:耐久度]> [數量] [附加數據值]\npocketmine.command.kill.description=自殺或殺死其他玩家\npocketmine.command.kill.usage=/kill [玩家名稱]\npocketmine.command.particle.description=加入粒子效果至世界\npocketmine.command.particle.usage=/particle <玩家名稱> <x> <y> <z> <xd> <yd> <zd> [數量] [數據值]\npocketmine.command.time.description=更改每個世界的時間\npocketmine.command.time.usage=/time <set|add> <數值> 或 /time <start|stop|query>\npocketmine.command.bancidbyname.description=禁止指定玩家的設備 ID\npocketmine.command.bancid.description=禁止指定的設備 ID\npocketmine.command.banipbyname.description=禁止指定玩家的 IP\npocketmine.command.ban.player.description=禁止指定的玩家使用此伺服器\npocketmine.command.ban.ip.description=禁止指定的 IP 位址使用此伺服器\npocketmine.command.banlist.description=查看來自該伺服器禁止的所有玩家\npocketmine.command.defaultgamemode.description=設定預設的遊戲模式\npocketmine.command.deop.description=移除指定玩家的管理員權限\npocketmine.command.difficulty.description=設定遊戲的難易度\npocketmine.command.enchant.description=把物件附魔\npocketmine.command.effect.description=增加/減少玩家身上的效果\npocketmine.command.gamemode.description=改變玩家到一個特定的遊戲模式\npocketmine.command.help.description=顯示幫助列表\npocketmine.command.kick.description=從伺服器中刪除指定玩家\npocketmine.command.list.description=顯示在線玩家列表\npocketmine.command.me.description=於聊天中作出指定的動作\npocketmine.command.op.description=賦予指定玩家管理員權限\npocketmine.command.unban.cid.description=允許指定 CID 使用此伺服器\npocketmine.command.unban.player.description=允許指定玩家使用此伺服器\npocketmine.command.unban.ip.description=允許指定 IP 位址使用此伺服器\npocketmine.command.save.description=儲存伺服器到磁碟上\npocketmine.command.saveoff.description=停用自動儲存伺服器\npocketmine.command.saveon.description=啟用自動儲存伺服器\npocketmine.command.say.description=以發送指令者身份廣播指定的訊息\npocketmine.command.seed.description=顯示世界種子碼\npocketmine.command.setworldspawn.description=設定一個世界重生點。未指定坐標，將使用玩家的坐標。\npocketmine.command.spawnpoint.description=設定玩家重生點\npocketmine.command.stop.description=關閉伺服器\npocketmine.command.tp.description=傳送指定玩家（或是自己）到另一位玩家或座標\npocketmine.command.tell.description=傳送私訊給指定玩家\npocketmine.command.xp.description=給指定玩家新增經驗值或等級\npocketmine.command.summon.description=召喚指定的實體於玩家位置或指定位置\nocketmine.command.fill.description=填充了指定方塊\npocketmine.command.setblock.description=將一個方塊更改為另一個方塊\n\npocketmine.command.weather.description=設定指定地圖的天氣\npocketmine.command.weather.usage=/weather <地圖名稱 天氣|天氣>\npocketmine.command.weather.changed=成功設定地圖{%0}的天氣\npocketmine.command.weather.noregistered=地圖{%0}未註冊到天氣管理器\npocketmine.command.weather.invalid=無效的天氣！請輸入天氣 0,1,2,3。\npocketmine.command.weather.wrong=錯誤的參數\npocketmine.command.weather.invalid.level=錯誤的地圖名稱\n\npocketmine.command.whitelist.description=管理員允許使用此伺服器的玩家列表\npocketmine.crash.create=一個不能回復的錯誤發生了，使伺服器崩潰。正在儲存錯誤報告。\npocketmine.crash.error=未能儲存錯誤報告︰{%0}\npocketmine.crash.submit=請上載檔案「{%0}」至線上崩潰儲存庫，並把所獲之連結提交至漏洞報告網頁。請盡量提供更多資料。\npocketmine.crash.archive=毀損傾印報告已經自動地被提交到毀損傾印存檔。你可以在{%0} 查看到它或使用ID #{%1}。\npocketmine.debug.enable=啟用 LevelDB 支援\npocketmine.player.invalidMove={%0} 行動可疑！\npocketmine.player.logIn={%0}[/{%1}:{%2}] [ClientID: {%3}] 登入遊戲，實體ID為 {%4} 座標位在 ({%5}, {%6}, {%7}, {%8})\npocketmine.player.logOut={%0}[/{%1}:{%2}] 登出遊戲，原因： {%3}\npocketmine.player.transferred={%0}[/{%1}:{%2}] 被傳送到 {%3}\npocketmine.player.invalidEntity={%0} 嘗試攻擊一個無效的實體\npocketmine.plugin.load=讀取中... {%0}\npocketmine.plugin.enable=開啟中... {%0}\npocketmine.plugin.disable=關閉中... {%0}\npocketmine.plugin.restrictedName=受限的名稱\npocketmine.plugin.incompatibleAPI=不相容的API版本\npocketmine.plugin.unknownDependency=本插件無法單獨使用\npocketmine.plugin.circularDependency=檢測出循環依賴\npocketmine.plugin.genericLoadError=無法讀取插件 '{%0}'\npocketmine.plugin.spacesDiscouraged=插件 '{%0}' 在名稱中使用了空格，不建議這樣做\npocketmine.plugin.loadError=無法讀取插件 '{%0}'：{%1}\npocketmine.plugin.duplicateError=無法讀取插件 '{%0}'：已有相同插件\npocketmine.plugin.fileError=無法讀取在 '{%1}' 資料夾中的 '{%0}'：{%2}\npocketmine.plugin.commandError=無法讀取 {%1} 插件的 {%0} 指令\npocketmine.plugin.aliasError=無法讀取 {%1} 插件的 {%0} 別名\npocketmine.plugin.deprecatedEvent=插件 '{%0}' 已經使用 '{%2}' 方法註冊了一個在 '{%1}' 的監聽器，但是該事件已過時。\npocketmine.plugin.eventError=\"無法處理事件 '{%0}' 至 '{%1}'：{%2} 在 {%3} 上\"\n"
  },
  {
    "path": "src/pocketmine/level/ChunkLoader.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\math\\Vector3;\n\n/**\n * If you want to keep chunks loaded and receive notifications on a specific area,\n * extend this class and register it into Level. This will also tick chunks.\n *\n * Register Level->registerChunkLoader($this, $chunkX, $chunkZ)\n * Unregister Level->unregisterChunkLoader($this, $chunkX, $chunkZ)\n *\n * WARNING: When moving this object around in the world or destroying it,\n * be sure to free the existing references from Level, otherwise you'll leak memory.\n */\ninterface ChunkLoader{\n\n\t/**\n\t * Returns the ChunkLoader id.\n\t * Call Level::generateChunkLoaderId($this) to generate and save it\n\t *\n\t * @return int\n\t */\n\tpublic function getLoaderId();\n\n\t/**\n\t * Returns if the chunk loader is currently active\n\t *\n\t * @return bool\n\t */\n\tpublic function isLoaderActive();\n\n\t/**\n\t * @return Position\n\t */\n\tpublic function getPosition();\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getX();\n\n\t/**\n\t * @return float\n\t */\n\tpublic function getZ();\n\n\t/**\n\t * @return Level\n\t */\n\tpublic function getLevel();\n\n\t/**\n\t * This method will be called when a Chunk is replaced by a new one\n\t *\n\t * @param Chunk $chunk\n\t */\n\tpublic function onChunkChanged(Chunk $chunk);\n\n\t/**\n\t * This method will be called when a registered chunk is loaded\n\t *\n\t * @param Chunk $chunk\n\t */\n\tpublic function onChunkLoaded(Chunk $chunk);\n\n\n\t/**\n\t * This method will be called when a registered chunk is unloaded\n\t *\n\t * @param Chunk $chunk\n\t */\n\tpublic function onChunkUnloaded(Chunk $chunk);\n\n\t/**\n\t * This method will be called when a registered chunk is populated\n\t * Usually it'll be sent with another call to onChunkChanged()\n\t *\n\t * @param Chunk $chunk\n\t */\n\tpublic function onChunkPopulated(Chunk $chunk);\n\n\t/**\n\t * This method will be called when a block changes in a registered chunk\n\t *\n\t * @param Block|Vector3 $block\n\t */\n\tpublic function onBlockChanged(Vector3 $block);\n\n}"
  },
  {
    "path": "src/pocketmine/level/ChunkManager.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types=1);\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\level\\format\\Chunk;\n\ninterface ChunkManager{\n\t/**\n\t * Gets the raw block id.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-255\n\t */\n\tpublic function getBlockIdAt(int $x, int $y, int $z): int;\n\n\t/**\n\t * Sets the raw block id.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $id 0-255\n\t */\n\tpublic function setBlockIdAt(int $x, int $y, int $z, int $id);\n\n\t/**\n\t * Gets the raw block metadata\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockDataAt(int $x, int $y, int $z) : int;\n\n\t/**\n\t * Sets the raw block metadata.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $data 0-15\n\t */\n\tpublic function setBlockDataAt(int $x, int $y, int $z, int $data);\n\n\t/**\n\t * Gets the raw block light level\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockLightAt(int $x, int $y, int $z) : int;\n\n\t/**\n\t * Updates the light around the block\n\t *\n\t * @param $x\n\t * @param $y\n\t * @param $z\n\t */\n\tpublic function updateBlockLight(int $x, int $y, int $z);\n\n\t/**\n\t * Sets the raw block light level.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $level 0-15\n\t */\n\tpublic function setBlockLightAt(int $x, int $y, int $z, int $level);\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return Chunk|null\n\t */\n\tpublic function getChunk(int $chunkX, int $chunkZ);\n\n\t/**\n\t * @param int   $chunkX\n\t * @param int   $chunkZ\n\t * @param Chunk $chunk\n\t */\n\tpublic function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null);\n\n\t/**\n\t * Gets the level seed\n\t *\n\t * @return int|string\n\t */\n\tpublic function getSeed();\n}"
  },
  {
    "path": "src/pocketmine/level/Explosion.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\entity\\EntityDamageByBlockEvent;\nuse pocketmine\\event\\entity\\EntityDamageByEntityEvent;\nuse pocketmine\\event\\entity\\EntityDamageEvent;\nuse pocketmine\\event\\entity\\EntityExplodeEvent;\nuse pocketmine\\event\\block\\BlockUpdateEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\particle\\HugeExplodeSeedParticle;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Math;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\network\\protocol\\ExplodePacket;\n\nuse pocketmine\\utils\\Random;\n\nclass Explosion{\n\n\tprivate $rays = 16; //Rays\n\tpublic $level;\n\tpublic $source;\n\tpublic $size;\n\t/**\n\t * @var Block[]\n\t */\n\tpublic $affectedBlocks = [];\n\tpublic $stepLen = 0.3;\n\t/** @var Entity|Block */\n\tprivate $what;\n\tprivate $dropItem;\n\n\tpublic function __construct(Position $center, $size, $what = null, bool $dropItem = true){\n\t\t$this->level = $center->getLevel();\n\t\t$this->source = $center;\n\t\t$this->size = max($size, 0);\n\t\t$this->what = $what;\n\t\t$this->dropItem = $dropItem;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function explodeA() : bool{\n\t\tif($this->size < 0.1){\n\t\t\treturn false;\n\t\t}\n\n\t\t$vector = new Vector3(0, 0, 0);\n\t\t$vBlock = new Vector3(0, 0, 0);\n\n\t\t$mRays = intval($this->rays - 1);\n\t\tfor($i = 0; $i < $this->rays; ++$i){\n\t\t\tfor($j = 0; $j < $this->rays; ++$j){\n\t\t\t\tfor($k = 0; $k < $this->rays; ++$k){\n\t\t\t\t\tif($i === 0 or $i === $mRays or $j === 0 or $j === $mRays or $k === 0 or $k === $mRays){\n\t\t\t\t\t\t$vector->setComponents($i / $mRays * 2 - 1, $j / $mRays * 2 - 1, $k / $mRays * 2 - 1);\n\t\t\t\t\t\t$vector->setComponents(($vector->x / ($len = $vector->length())) * $this->stepLen, ($vector->y / $len) * $this->stepLen, ($vector->z / $len) * $this->stepLen);\n\t\t\t\t\t\t$pointerX = $this->source->x;\n\t\t\t\t\t\t$pointerY = $this->source->y;\n\t\t\t\t\t\t$pointerZ = $this->source->z;\n\n\t\t\t\t\t\tfor($blastForce = $this->size * (mt_rand(700, 1300) / 1000); $blastForce > 0; $blastForce -= $this->stepLen * 0.75){\n\t\t\t\t\t\t\t$x = (int) $pointerX;\n\t\t\t\t\t\t\t$y = (int) $pointerY;\n\t\t\t\t\t\t\t$z = (int) $pointerZ;\n\t\t\t\t\t\t\t$vBlock->x = $pointerX >= $x ? $x : $x - 1;\n\t\t\t\t\t\t\t$vBlock->y = $pointerY >= $y ? $y : $y - 1;\n\t\t\t\t\t\t\t$vBlock->z = $pointerZ >= $z ? $z : $z - 1;\n\t\t\t\t\t\t\tif($vBlock->y < 0 or $vBlock->y >= Level::Y_MAX){\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$block = $this->level->getBlock($vBlock);\n\n\t\t\t\t\t\t\tif($block->getId() !== 0){\n\t\t\t\t\t\t\t\t$blastForce -= ($block->getResistance() / 5 + 0.3) * $this->stepLen;\n\t\t\t\t\t\t\t\tif($blastForce > 0){\n\t\t\t\t\t\t\t\t\tif(!isset($this->affectedBlocks[$index = Level::blockHash($block->x, $block->y, $block->z)])){\n\t\t\t\t\t\t\t\t\t\t$this->affectedBlocks[$index] = $block;\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t$pointerX += $vector->x;\n\t\t\t\t\t\t\t$pointerY += $vector->y;\n\t\t\t\t\t\t\t$pointerZ += $vector->z;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function explodeB() : bool{\n\t\t$send = [];\n\t\t$updateBlocks = [];\n\n\t\t$source = (new Vector3($this->source->x, $this->source->y, $this->source->z))->floor();\n\t\t$yield = (1 / $this->size) * 100;\n\n\t\tif($this->what instanceof Entity){\n\t\t\t$this->level->getServer()->getPluginManager()->callEvent($ev = new EntityExplodeEvent($this->what, $this->source, $this->affectedBlocks, $yield));\n\t\t\tif($ev->isCancelled()){\n\t\t\t\treturn false;\n\t\t\t}else{\n\t\t\t\t$yield = $ev->getYield();\n\t\t\t\t$this->affectedBlocks = $ev->getBlockList();\n\t\t\t}\n\t\t}\n\n\t\t$explosionSize = $this->size * 2;\n\t\t$minX = Math::floorFloat($this->source->x - $explosionSize - 1);\n\t\t$maxX = Math::ceilFloat($this->source->x + $explosionSize + 1);\n\t\t$minY = Math::floorFloat($this->source->y - $explosionSize - 1);\n\t\t$maxY = Math::ceilFloat($this->source->y + $explosionSize + 1);\n\t\t$minZ = Math::floorFloat($this->source->z - $explosionSize - 1);\n\t\t$maxZ = Math::ceilFloat($this->source->z + $explosionSize + 1);\n\n\t\t$explosionBB = new AxisAlignedBB($minX, $minY, $minZ, $maxX, $maxY, $maxZ);\n\n\t\t$list = $this->level->getNearbyEntities($explosionBB, $this->what instanceof Entity ? $this->what : null);\n\t\tforeach($list as $entity){\n\t\t\t$distance = $entity->distance($this->source) / $explosionSize;\n\n\t\t\tif($distance <= 1){\n\t\t\t\t$motion = $entity->subtract($this->source)->normalize();\n\n\t\t\t\t$impact = (1 - $distance) * ($exposure = 1);\n\n\t\t\t\t$damage = (int) ((($impact * $impact + $impact) / 2) * 8 * $explosionSize + 1);\n\n\t\t\t\tif($this->what instanceof Entity){\n\t\t\t\t\t$ev = new EntityDamageByEntityEvent($this->what, $entity, EntityDamageEvent::CAUSE_ENTITY_EXPLOSION, $damage);\n\t\t\t\t}elseif($this->what instanceof Block){\n\t\t\t\t\t$ev = new EntityDamageByBlockEvent($this->what, $entity, EntityDamageEvent::CAUSE_BLOCK_EXPLOSION, $damage);\n\t\t\t\t}else{\n\t\t\t\t\t$ev = new EntityDamageEvent($entity, EntityDamageEvent::CAUSE_BLOCK_EXPLOSION, $damage);\n\t\t\t\t}\n\n\t\t\t\tif($entity->attack($ev->getFinalDamage(), $ev) === true){\n\t\t\t\t\t$ev->useArmors();\n\t\t\t\t}\n\t\t\t\t$entity->setMotion($motion->multiply($impact));\n\t\t\t}\n\t\t}\n\n\n\t\t$air = Item::get(Item::AIR);\n\n\t\tforeach($this->affectedBlocks as $block){\n\t\t\tif($block->getId() === Block::TNT){\n\t\t\t\t$mot = (new Random())->nextSignedFloat() * M_PI * 2;\n\t\t\t\t$tnt = Entity::createEntity(\"PrimedTNT\", $this->level->getChunk($block->x >> 4, $block->z >> 4), new CompoundTag(\"\", [\n\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\tnew DoubleTag(\"\", $block->x + 0.5),\n\t\t\t\t\t\tnew DoubleTag(\"\", $block->y),\n\t\t\t\t\t\tnew DoubleTag(\"\", $block->z + 0.5)\n\t\t\t\t\t]),\n\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\tnew DoubleTag(\"\", -sin($mot) * 0.02),\n\t\t\t\t\t\tnew DoubleTag(\"\", 0.2),\n\t\t\t\t\t\tnew DoubleTag(\"\", -cos($mot) * 0.02)\n\t\t\t\t\t]),\n\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t]),\n\t\t\t\t\t\"Fuse\" => new ByteTag(\"Fuse\", mt_rand(10, 30))\n\t\t\t\t]));\n\t\t\t\t$tnt->spawnToAll();\n\t\t\t}elseif($this->dropItem and mt_rand(0, 100) < $yield){\n\t\t\t\tforeach($block->getDrops($air) as $drop){\n\t\t\t\t\t$this->level->dropItem($block->add(0.5, 0.5, 0.5), Item::get(...$drop));\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->level->setBlockIdAt($block->x, $block->y, $block->z, 0);\n\n\t\t\t$pos = new Vector3($block->x, $block->y, $block->z);\n\n\t\t\tfor($side = 0; $side < 5; $side++){\n\t\t\t\t$sideBlock = $pos->getSide($side);\n\t\t\t\tif(!isset($this->affectedBlocks[$index = Level::blockHash($sideBlock->x, $sideBlock->y, $sideBlock->z)]) and !isset($updateBlocks[$index])){\n\t\t\t\t\t$this->level->getServer()->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->level->getBlock($sideBlock)));\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$ev->getBlock()->onUpdate(Level::BLOCK_UPDATE_NORMAL);\n\t\t\t\t\t}\n\t\t\t\t\t$updateBlocks[$index] = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$send[] = new Vector3($block->x - $source->x, $block->y - $source->y, $block->z - $source->z);\n\t\t}\n\n\t\t$pk = new ExplodePacket();\n\t\t$pk->x = $this->source->x;\n\t\t$pk->y = $this->source->y;\n\t\t$pk->z = $this->source->z;\n\t\t$pk->radius = $this->size;\n\t\t$pk->records = $send;\n\t\t$this->level->addChunkPacket($source->x >> 4, $source->z >> 4, $pk);\n\n\t\t$this->level->addParticle(new HugeExplodeSeedParticle($source));\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/Level.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * All Level related classes are here, like Generators, Populators, Noise, ...\n */\nnamespace pocketmine\\level;\n\nuse pocketmine\\block\\Air;\nuse pocketmine\\block\\Beetroot;\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\BrownMushroom;\nuse pocketmine\\block\\Cactus;\nuse pocketmine\\block\\Carrot;\nuse pocketmine\\block\\Farmland;\nuse pocketmine\\block\\Grass;\nuse pocketmine\\block\\Ice;\nuse pocketmine\\block\\Leaves;\nuse pocketmine\\block\\Leaves2;\nuse pocketmine\\block\\NetherWart;\nuse pocketmine\\block\\MelonStem;\nuse pocketmine\\block\\Mycelium;\nuse pocketmine\\block\\Potato;\nuse pocketmine\\block\\PumpkinStem;\nuse pocketmine\\block\\RedMushroom;\nuse pocketmine\\block\\Sapling;\nuse pocketmine\\block\\SnowLayer;\nuse pocketmine\\block\\Sugarcane;\nuse pocketmine\\block\\Wheat;\nuse pocketmine\\block\\CocoaBlock;\nuse pocketmine\\entity\\Arrow;\nuse pocketmine\\entity\\Effect;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Item as DroppedItem;\nuse pocketmine\\event\\block\\BlockBreakEvent;\nuse pocketmine\\event\\block\\BlockPlaceEvent;\nuse pocketmine\\event\\block\\BlockUpdateEvent;\nuse pocketmine\\event\\level\\ChunkLoadEvent;\nuse pocketmine\\event\\level\\ChunkPopulateEvent;\nuse pocketmine\\event\\level\\ChunkUnloadEvent;\nuse pocketmine\\event\\level\\LevelSaveEvent;\nuse pocketmine\\event\\level\\LevelUnloadEvent;\nuse pocketmine\\event\\level\\SpawnChangeEvent;\nuse pocketmine\\event\\LevelTimings;\nuse pocketmine\\event\\player\\PlayerInteractEvent;\nuse pocketmine\\event\\Timings;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\item\\Item;\nuse pocketmine\\item\\enchantment\\enchantment;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\format\\io\\BaseLevelProvider;\nuse pocketmine\\level\\format\\io\\LevelProvider;\nuse pocketmine\\level\\generator\\GenerationTask;\nuse pocketmine\\level\\generator\\Generator;\nuse pocketmine\\level\\generator\\GeneratorRegisterTask;\nuse pocketmine\\level\\generator\\GeneratorUnregisterTask;\nuse pocketmine\\level\\generator\\LightPopulationTask;\nuse pocketmine\\level\\generator\\PopulationTask;\nuse pocketmine\\math\\AxisAlignedBB;\nuse pocketmine\\math\\Math;\nuse pocketmine\\math\\Vector2;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\metadata\\BlockMetadataStore;\nuse pocketmine\\metadata\\Metadatable;\nuse pocketmine\\metadata\\MetadataValue;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\LongTag;\nuse pocketmine\\network\\protocol\\BatchPacket;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\network\\protocol\\FullChunkDataPacket;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\nuse pocketmine\\network\\protocol\\MoveEntityPacket;\nuse pocketmine\\network\\protocol\\MovePlayerPacket;\nuse pocketmine\\network\\protocol\\SetEntityMotionPacket;\nuse pocketmine\\network\\protocol\\SetTimePacket;\nuse pocketmine\\network\\protocol\\UpdateBlockPacket;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\Player;\nuse pocketmine\\plugin\\Plugin;\n\nuse pocketmine\\Server;\nuse pocketmine\\tile\\Chest;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\utils\\Binary;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\utils\\ReversePriorityQueue;\nuse pocketmine\\level\\particle\\Particle;\nuse pocketmine\\level\\sound\\BlockPlaceSound;\nuse pocketmine\\level\\sound\\Sound;\nuse pocketmine\\level\\particle\\DestroyBlockParticle;\nuse pocketmine\\entity\\Lightning;\nuse pocketmine\\entity\\XPOrb;\nuse pocketmine\\level\\weather\\Weather;\n\n#include <rules/Level.h>\n\nclass Level implements ChunkManager, Metadatable{\n\n\tprivate static $levelIdCounter = 1;\n\tprivate static $chunkLoaderCounter = 1;\n\tpublic static $COMPRESSION_LEVEL = 8;\n\n\tconst Y_MASK = 0xFF;\n\tconst Y_MAX = 0x100; //256\n\n\tconst BLOCK_UPDATE_NORMAL = 1;\n\tconst BLOCK_UPDATE_RANDOM = 2;\n\tconst BLOCK_UPDATE_SCHEDULED = 3;\n\tconst BLOCK_UPDATE_WEAK = 4;\n\tconst BLOCK_UPDATE_TOUCH = 5;\n\n\tconst TIME_DAY = 0;\n\tconst TIME_SUNSET = 12000;\n\tconst TIME_NIGHT = 14000;\n\tconst TIME_SUNRISE = 23000;\n\n\tconst TIME_FULL = 24000;\n\n\tconst DIMENSION_NORMAL = 0;\n\tconst DIMENSION_NETHER = 1;\n\n\t/** @var Tile[] */\n\tprivate $tiles = [];\n\n\tprivate $motionToSend = [];\n\tprivate $moveToSend = [];\n\n\t/** @var Player[] */\n\tprivate $players = [];\n\n\t/** @var Entity[] */\n\tprivate $entities = [];\n\n\t/** @var Entity[] */\n\tpublic $updateEntities = [];\n\t/** @var Tile[] */\n\tpublic $updateTiles = [];\n\n\tprivate $blockCache = [];\n\n\t/** @var DataPacket[] */\n\tprivate $chunkCache = [];\n\n\tprivate $cacheChunks = false;\n\n\tprivate $sendTimeTicker = 0;\n\n\t/** @var Server */\n\tprivate $server;\n\n\t/** @var int */\n\tprivate $levelId;\n\n\t/** @var LevelProvider */\n\tprivate $provider;\n\n\t/** @var ChunkLoader[] */\n\tprivate $loaders = [];\n\t/** @var int[] */\n\tprivate $loaderCounter = [];\n\t/** @var ChunkLoader[][] */\n\tprivate $chunkLoaders = [];\n\t/** @var Player[][] */\n\tprivate $playerLoaders = [];\n\n\t/** @var DataPacket[] */\n\tprivate $chunkPackets = [];\n\n\t/** @var float[] */\n\tprivate $unloadQueue;\n\n\tprivate $time;\n\tpublic $stopTime;\n\n\tprivate $folderName;\n\n\t/** @var Chunk[] */\n\tprivate $chunks = [];\n\n\t/** @var Vector3[][] */\n\tprivate $changedBlocks = [];\n\n\t/** @var ReversePriorityQueue */\n\tprivate $updateQueue;\n\tprivate $updateQueueIndex = [];\n\n\t/** @var Player[][] */\n\tprivate $chunkSendQueue = [];\n\tprivate $chunkSendTasks = [];\n\n\tprivate $chunkPopulationQueue = [];\n\tprivate $chunkPopulationLock = [];\n\tprivate $chunkGenerationQueue = [];\n\tprivate $chunkGenerationQueueSize = 8;\n\tprivate $chunkPopulationQueueSize = 2;\n\n\tprivate $autoSave = true;\n\n\t/** @var BlockMetadataStore */\n\tprivate $blockMetadata;\n\n\t/** @var Position */\n\tprivate $temporalPosition;\n\t/** @var Vector3 */\n\tprivate $temporalVector;\n\n\t/** @var \\SplFixedArray */\n\tprivate $blockStates;\n\n\tpublic $sleepTicks = 0;\n\n\tprivate $chunkTickRadius;\n\tprivate $chunkTickList = [];\n\tprivate $chunksPerTick;\n\tprivate $clearChunksOnTick;\n\tprivate $randomTickBlocks = [\n\t\tBlock::GRASS => Grass::class,\n\t\tBlock::SAPLING => Sapling::class,\n\t\tBlock::LEAVES => Leaves::class,\n\t\tBlock::WHEAT_BLOCK => Wheat::class,\n\t\tBlock::COCOA_BLOCK => CocoaBlock::class,\n\t\tBlock::FARMLAND => Farmland::class,\n\t\tBlock::SNOW_LAYER => SnowLayer::class,\n\t\tBlock::ICE => Ice::class,\n\t\tBlock::CACTUS => Cactus::class,\n\t\tBlock::SUGARCANE_BLOCK => Sugarcane::class,\n\t\tBlock::RED_MUSHROOM => RedMushroom::class,\n\t\tBlock::BROWN_MUSHROOM => BrownMushroom::class,\n\t\tBlock::PUMPKIN_STEM => PumpkinStem::class,\n\t\tBlock::NETHER_WART_BLOCK => NetherWart::class,\n\t\tBlock::MELON_STEM => MelonStem::class,\n\t\t//Block::VINE => true,\n\t\tBlock::MYCELIUM => Mycelium::class,\n\t\t//Block::COCOA_BLOCK => true,\n\t\tBlock::CARROT_BLOCK => Carrot::class,\n\t\tBlock::POTATO_BLOCK => Potato::class,\n\t\tBlock::LEAVES2 => Leaves2::class,\n\n\t\tBlock::BEETROOT_BLOCK => Beetroot::class,\n\t];\n\n\t/** @var LevelTimings */\n\tpublic $timings;\n\n\tprivate $tickRate;\n\tpublic $tickRateTime = 0;\n\tpublic $tickRateCounter = 0;\n\n\t/** @var Generator */\n\tprivate $generator;\n\t/** @var Generator */\n\tprivate $generatorInstance;\n\n\tprivate $closed = false;\n\t\n\t/** @var Weather */\n\tprivate $weather;\n\n\tprivate $blockTempData = [];\n\n\tprivate $dimension = self::DIMENSION_NORMAL;\n\n\t/**\n\t * This method is internal use only. Do not use this in plugins\n\t *\n\t * @param Vector3 $pos\n\t * @param         $data\n\t */\n\tpublic function setBlockTempData(Vector3 $pos, $data = null){\n\t\tif($data == null and isset($this->blockTempData[self::blockHash($pos->x, $pos->y, $pos->z)])){\n\t\t\tunset($this->blockTempData[self::blockHash($pos->x, $pos->y, $pos->z)]);\n\t\t}else{\n\t\t\t$this->blockTempData[self::blockHash($pos->x, $pos->y, $pos->z)] = $data;\n\t\t}\n\t}\n\n\t/**\n\t * This method is internal use only. Do not use this in plugins\n\t *\n\t * @param Vector3 $pos\n\t * @return int\n\t */\n\tpublic function getBlockTempData(Vector3 $pos){\n\t\tif(isset($this->blockTempData[self::blockHash($pos->x, $pos->y, $pos->z)])){\n\t\t\treturn $this->blockTempData[self::blockHash($pos->x, $pos->y, $pos->z)];\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Returns the chunk unique hash/key\n\t *\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return string\n\t */\n\tpublic static function chunkHash(int $x, int $z){\n\t\treturn PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFFF) << 32) | ($z & 0xFFFFFFFF) : $x . \":\" . $z;\n\t}\n\n\tpublic static function blockHash(int $x, int $y, int $z){\n\t\treturn PHP_INT_SIZE === 8 ? (($x & 0xFFFFFFF) << 36) | (($y & Level::Y_MASK) << 28) | ($z & 0xFFFFFFF) : $x . \":\" . $y . \":\" . $z;\n\t}\n\n\tpublic static function getBlockXYZ($hash, &$x, &$y, &$z){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\t$x = $hash >> 36;\n\t\t\t$y = ($hash >> 28) & Level::Y_MASK; //it's always positive\n\t\t\t$z = ($hash & 0xFFFFFFF) << 36 >> 36;\n\t\t}else{\n\t\t\t$hash = explode(\":\", $hash);\n\t\t\t$x = (int) $hash[0];\n\t\t\t$y = (int) $hash[1];\n\t\t\t$z = (int) $hash[2];\n\t\t}\n\t}\n\n\tpublic static function getXZ($hash, &$x, &$z){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\t$x = $hash >> 32;\n\t\t\t$z = ($hash & 0xFFFFFFFF) << 32 >> 32;\n\t\t}else{\n\t\t\t$hash = explode(\":\", $hash);\n\t\t\t$x = (int) $hash[0];\n\t\t\t$z = (int) $hash[1];\n\t\t}\n\t}\n\n\tpublic static function generateChunkLoaderId(ChunkLoader $loader) : int{\n\t\tif($loader->getLoaderId() === 0 or $loader->getLoaderId() === null or $loader->getLoaderId() === null){\n\t\t\treturn self::$chunkLoaderCounter++;\n\t\t}else{\n\t\t\tthrow new \\InvalidStateException(\"ChunkLoader has a loader id already assigned: \" . $loader->getLoaderId());\n\t\t}\n\t}\n\n\t/**\n\t * Init the default level data\n\t *\n\t * @param Server $server\n\t * @param string $name\n\t * @param string $path\n\t * @param string $provider Class that extends LevelProvider\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function __construct(Server $server, string $name, string $path, string $provider){\n\t\t$this->blockStates = Block::$fullList;\n\t\t$this->levelId = static::$levelIdCounter++;\n\t\t$this->blockMetadata = new BlockMetadataStore($this);\n\t\t$this->server = $server;\n\t\t$this->autoSave = $server->getAutoSave();\n\n\t\t/** @var LevelProvider $provider */\n\n\t\tif(is_subclass_of($provider, LevelProvider::class, true)){\n\t\t\t$this->provider = new $provider($this, $path);\n\t\t}else{\n\t\t\tthrow new LevelException(\"Provider is not a subclass of LevelProvider\");\n\t\t}\n\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.level.preparing\", [$this->provider->getName()]));\n\t\t$this->generator = Generator::getGenerator($this->provider->getGenerator());\n\n\t\t$this->folderName = $name;\n\t\t$this->updateQueue = new ReversePriorityQueue();\n\t\t$this->updateQueue->setExtractFlags(\\SplPriorityQueue::EXTR_BOTH);\n\t\t$this->time = (int) $this->provider->getTime();\n\n\t\t$this->chunkTickRadius = min($this->server->getViewDistance(), max(1, (int) $this->server->getProperty(\"chunk-ticking.tick-radius\", 4)));\n\t\t$this->chunksPerTick = (int) $this->server->getProperty(\"chunk-ticking.per-tick\", 40);\n\t\t$this->chunkGenerationQueueSize = (int) $this->server->getProperty(\"chunk-generation.queue-size\", 8);\n\t\t$this->chunkPopulationQueueSize = (int) $this->server->getProperty(\"chunk-generation.population-queue-size\", 2);\n\t\t$this->chunkTickList = [];\n\t\t$this->clearChunksOnTick = (bool) $this->server->getProperty(\"chunk-ticking.clear-tick-list\", true);\n\t\t$this->cacheChunks = (bool) $this->server->getProperty(\"chunk-sending.cache-chunks\", false);\n\n\t\t$this->timings = new LevelTimings($this);\n\t\t$this->temporalPosition = new Position(0, 0, 0, $this);\n\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t\t$this->tickRate = 1;\n\n\t\t$this->weather = new Weather($this, 0);\n\t\tif($this->server->netherEnabled and $this->server->netherName == $this->folderName) $this->setDimension(self::DIMENSION_NETHER);\n\t\telse $this->setDimension(self::DIMENSION_NORMAL);\n\t\tif($this->server->weatherEnabled and $this->getDimension() == self::DIMENSION_NORMAL){\n\t\t\t$this->weather->setCanCalculate(true);\n\t\t}else $this->weather->setCanCalculate(false);\n\t}\n\n\tpublic function setDimension(int $dimension){\n\t\t$this->dimension = $dimension;\n\t}\n\n\tpublic function getDimension() : int{\n\t\treturn $this->dimension;\n\t}\n\n\t/**\n\t * @return Weather\n\t */\n\tpublic function getWeather(){\n\t\treturn $this->weather;\n\t}\n\n\tpublic function getTickRate() : int{\n\t\treturn $this->tickRate;\n\t}\n\n\tpublic function getTickRateTime(){\n\t\treturn $this->tickRateTime;\n\t}\n\n\tpublic function setTickRate(int $tickRate){\n\t\t$this->tickRate = $tickRate;\n\t}\n\n\tpublic function initLevel(){\n\t\t$generator = $this->generator;\n\t\t$this->generatorInstance = new $generator($this->provider->getGeneratorOptions());\n\t\t$this->generatorInstance->init($this, new Random($this->getSeed()));\n\n\t\t$this->registerGenerator();\n\t}\n\n\tpublic function getWaterHeight() : int{\n\t\tif($this->generatorInstance instanceof Generator){\n\t\t\treturn $this->generatorInstance->getWaterHeight();\n\t\t}\n\t\treturn 0;\n\t}\n\n\tpublic function registerGenerator(){\n\t\t$size = $this->server->getScheduler()->getAsyncTaskPoolSize();\n\t\tfor($i = 0; $i < $size; ++$i){\n\t\t\t$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorRegisterTask($this, $this->generatorInstance), $i);\n\t\t}\n\t}\n\n\tpublic function unregisterGenerator(){\n\t\t$size = $this->server->getScheduler()->getAsyncTaskPoolSize();\n\t\tfor($i = 0; $i < $size; ++$i){\n\t\t\t$this->server->getScheduler()->scheduleAsyncTaskToWorker(new GeneratorUnregisterTask($this, $this->generatorInstance), $i);\n\t\t}\n\t}\n\n\t/**\n\t * @return BlockMetadataStore\n\t */\n\tpublic function getBlockMetadata() : BlockMetadataStore{\n\t\treturn $this->blockMetadata;\n\t}\n\n\t/**\n\t * @return Server\n\t */\n\tpublic function getServer() : Server{\n\t\treturn $this->server;\n\t}\n\n\t/**\n\t * @return LevelProvider\n\t */\n\tfinal public function getProvider(){\n\t\treturn $this->provider;\n\t}\n\n\t/**\n\t * Returns the unique level identifier\n\t *\n\t * @return int\n\t */\n\tfinal public function getId() : int{\n\t\treturn $this->levelId;\n\t}\n\t\n\tpublic function isClosed() : bool{\n\t\treturn $this->closed;\n\t}\n\n\tpublic function close(){\n\tassert(!$this->closed, \"Tried to close a level which is already closed\");\n\t\n\t\tif($this->getAutoSave()){\n\t\t\t$this->save();\n\t\t}\n\n\t\tforeach($this->chunks as $chunk){\n\t\t\t$this->unloadChunk($chunk->getX(), $chunk->getZ(), false);\n\t\t}\n\n\t\t$this->unregisterGenerator();\n\n\t\t$this->provider->close();\n\t\t$this->provider = null;\n\t\t$this->blockMetadata = null;\n\t\t$this->blockCache = [];\n\t\t$this->temporalPosition = null;\n\t\t\n\t\t$this->closed = true;\n\t}\n\n\tpublic function addSound(Sound $sound, array $players = null){\n\t\t$pk = $sound->encode();\n\n\t\tif($players === null){\n\t\t\tif($pk !== null){\n\t\t\t\tif(!is_array($pk)){\n\t\t\t\t\t$this->addChunkPacket($sound->x >> 4, $sound->z >> 4, $pk);\n\t\t\t\t}else{\n\t\t\t\t\tforeach($pk as $e){\n\t\t\t\t\t\t$this->addChunkPacket($sound->x >> 4, $sound->z >> 4, $e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tif($pk !== null){\n\t\t\t\tif(!is_array($pk)){\n\t\t\t\t\t$this->server->broadcastPacket($players, $pk);\n\t\t\t\t}else{\n\t\t\t\t\t$this->server->batchPackets($players, $pk, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function addParticle(Particle $particle, array $players = null){\n\t\t$pk = $particle->encode();\n\n\t\tif($players === null){\n\t\t\tif($pk !== null){\n\t\t\t\tif(!is_array($pk)){\n\t\t\t\t\t$this->addChunkPacket($particle->x >> 4, $particle->z >> 4, $pk);\n\t\t\t\t}else{\n\t\t\t\t\tforeach($pk as $e){\n\t\t\t\t\t\t$this->addChunkPacket($particle->x >> 4, $particle->z >> 4, $e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tif($pk !== null){\n\t\t\t\tif(!is_array($pk)){\n\t\t\t\t\t$this->server->broadcastPacket($players, $pk);\n\t\t\t\t}else{\n\t\t\t\t\t$this->server->batchPackets($players, $pk, false);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function getAutoSave() : bool{\n\t\treturn $this->autoSave;\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setAutoSave(bool $value){\n\t\t$this->autoSave = $value;\n\t}\n\n\t/**\n\t * Unloads the current level from memory safely\n\t *\n\t * @param bool $force default false, force unload of default level\n\t *\n\t * @return bool\n\t */\n\tpublic function unload(bool $force = false) : bool{\n\n\t\t$ev = new LevelUnloadEvent($this);\n\n\t\tif($this === $this->server->getDefaultLevel() and $force !== true){\n\t\t\t$ev->setCancelled(true);\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\n\t\tif(!$force and $ev->isCancelled()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.level.unloading\", [$this->getName()]));\n\t\t$defaultLevel = $this->server->getDefaultLevel();\n\t\tforeach($this->getPlayers() as $player){\n\t\t\tif($this === $defaultLevel or $defaultLevel === null){\n\t\t\t\t$player->close($player->getLeaveMessage(), \"Forced default level unload\");\n\t\t\t}elseif($defaultLevel instanceof Level){\n\t\t\t\t$player->teleport($this->server->getDefaultLevel()->getSafeSpawn());\n\t\t\t}\n\t\t}\n\n\t\tif($this === $defaultLevel){\n\t\t\t$this->server->setDefaultLevel(null);\n\t\t}\n\n\t\t$this->close();\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Gets the players being used in a specific chunk\n\t *\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return Player[]\n\t */\n\tpublic function getChunkPlayers(int $chunkX, int $chunkZ) : array{\n\t\treturn isset($this->playerLoaders[$index = Level::chunkHash($chunkX, $chunkZ)]) ? $this->playerLoaders[$index] : [];\n\t}\n\n\t/**\n\t * Gets the chunk loaders being used in a specific chunk\n\t *\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return ChunkLoader[]\n\t */\n\tpublic function getChunkLoaders(int $chunkX, int $chunkZ) : array{\n\t\treturn isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)]) ? $this->chunkLoaders[$index] : [];\n\t}\n\n\tpublic function addChunkPacket(int $chunkX, int $chunkZ, DataPacket $packet){\n\t\tif(!isset($this->chunkPackets[$index = Level::chunkHash($chunkX, $chunkZ)])){\n\t\t\t$this->chunkPackets[$index] = [$packet];\n\t\t}else{\n\t\t\t$this->chunkPackets[$index][] = $packet;\n\t\t}\n\t}\n\n\tpublic function registerChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad = true){\n\t\t$hash = $loader->getLoaderId();\n\n\t\tif(!isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)])){\n\t\t\t$this->chunkLoaders[$index] = [];\n\t\t\t$this->playerLoaders[$index] = [];\n\t\t}elseif(isset($this->chunkLoaders[$index][$hash])){\n\t\t\treturn;\n\t\t}\n\n\t\t$this->chunkLoaders[$index][$hash] = $loader;\n\t\tif($loader instanceof Player){\n\t\t\t$this->playerLoaders[$index][$hash] = $loader;\n\t\t}\n\n\t\tif(!isset($this->loaders[$hash])){\n\t\t\t$this->loaderCounter[$hash] = 1;\n\t\t\t$this->loaders[$hash] = $loader;\n\t\t}else{\n\t\t\t++$this->loaderCounter[$hash];\n\t\t}\n\n\t\t$this->cancelUnloadChunkRequest($chunkX, $chunkZ);\n\n\t\tif($autoLoad){\n\t\t\t$this->loadChunk($chunkX, $chunkZ);\n\t\t}\n\t}\n\n\tpublic function unregisterChunkLoader(ChunkLoader $loader, int $chunkX, int $chunkZ){\n\t\tif(isset($this->chunkLoaders[$index = Level::chunkHash($chunkX, $chunkZ)][$hash = $loader->getLoaderId()])){\n\t\t\tunset($this->chunkLoaders[$index][$hash]);\n\t\t\tunset($this->playerLoaders[$index][$hash]);\n\t\t\tif(count($this->chunkLoaders[$index]) === 0){\n\t\t\t\tunset($this->chunkLoaders[$index]);\n\t\t\t\tunset($this->playerLoaders[$index]);\n\t\t\t\t$this->unloadChunkRequest($chunkX, $chunkZ, true);\n\t\t\t}\n\n\t\t\tif(--$this->loaderCounter[$hash] === 0){\n\t\t\t\tunset($this->loaderCounter[$hash]);\n\t\t\t\tunset($this->loaders[$hash]);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * WARNING: Do not use this, it's only for internal use.\n\t * Changes to this function won't be recorded on the version.\n\t */\n\tpublic function checkTime(){\n\t\tif($this->stopTime == true){\n\t\t\treturn;\n\t\t}else{\n\t\t\t$this->time += 1;\n\t\t}\n\t}\n\n\t/**\n\t * WARNING: Do not use this, it's only for internal use.\n\t * Changes to this function won't be recorded on the version.\n\t */\n\tpublic function sendTime(){\n\t\t$pk = new SetTimePacket();\n\t\t$pk->time = (int) $this->time;\n\t\t$pk->started = $this->stopTime == false;\n\n\t\t$this->server->broadcastPacket($this->players, $pk);\n\t}\n\n\t/**\n\t * WARNING: Do not use this, it's only for internal use.\n\t * Changes to this function won't be recorded on the version.\n\t *\n\t * @param int $currentTick\n\t *\n\t * @return bool\n\t */\n\tpublic function doTick(int $currentTick){\n\n\t\t$this->timings->doTick->startTiming();\n\n\t\t$this->checkTime();\n\n\t\tif(++$this->sendTimeTicker === 280){\n\t\t\t$this->sendTime();\n\t\t\t$this->sendTimeTicker = 0;\n\t\t}\n\n\t\t$this->weather->calcWeather($currentTick);\n\n\t\t$this->unloadChunks();\n\n\t\t//Do block updates\n\t\t$this->timings->doTickPending->startTiming();\n\t\tif($this->updateQueue->count() > 0 and $this->updateQueue->current()[\"priority\"] <= $currentTick){\n\t\t\t$block = $this->getBlock($this->updateQueue->extract()[\"data\"]);\n\t\t\tunset($this->updateQueueIndex[Level::blockHash($block->x, $block->y, $block->z)]);\n\t\t\t$block->onUpdate(self::BLOCK_UPDATE_SCHEDULED);\n\t\t}\n\t\t$this->timings->doTickPending->stopTiming();\n\n\t\t$this->timings->entityTick->startTiming();\n\t\t//Update entities that need update\n\t\tTimings::$tickEntityTimer->startTiming();\n\t\tforeach($this->updateEntities as $id => $entity){\n\t\t\tif($entity->closed or !$entity->onUpdate($currentTick)){\n\t\t\t\tunset($this->updateEntities[$id]);\n\t\t\t}\n\t\t}\n\t\tTimings::$tickEntityTimer->stopTiming();\n\t\t$this->timings->entityTick->stopTiming();\n\n\t\t$this->timings->tileEntityTick->startTiming();\n\t\tTimings::$tickTileEntityTimer->startTiming();\n\t\t//Update tiles that need update\n\t\tif(count($this->updateTiles) > 0){\n\t\t\tforeach($this->updateTiles as $id => $tile){\n\t\t\t\tif($tile->onUpdate() !== true){\n\t\t\t\t\tunset($this->updateTiles[$id]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tTimings::$tickTileEntityTimer->stopTiming();\n\t\t$this->timings->tileEntityTick->stopTiming();\n\n\t\t$this->timings->doTickTiles->startTiming();\n\t\tif(($currentTick % 2) === 0) $this->tickChunks();\n\t\t$this->timings->doTickTiles->stopTiming();\n\n\t\tif(count($this->changedBlocks) > 0){\n\t\t\tif(count($this->players) > 0){\n\t\t\t\tforeach($this->changedBlocks as $index => $blocks){\n\t\t\t\t\tunset($this->chunkCache[$index]);\n\t\t\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\t\t\t\t\tif(count($blocks) > 512){\n\t\t\t\t\t\t$chunk = $this->getChunk($chunkX, $chunkZ);\n\t\t\t\t\t\tforeach($this->getChunkPlayers($chunkX, $chunkZ) as $p){\n\t\t\t\t\t\t\t$p->onChunkChanged($chunk);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->sendBlocks($this->getChunkPlayers($chunkX, $chunkZ), $blocks, UpdateBlockPacket::FLAG_ALL);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->chunkCache = [];\n\t\t\t}\n\n\t\t\t$this->changedBlocks = [];\n\n\t\t}\n\n\t\t$this->processChunkRequest();\n\n\t\tif($this->sleepTicks > 0 and --$this->sleepTicks <= 0){\n\t\t\t$this->checkSleep();\n\t\t}\n\n\t\tforeach($this->moveToSend as $index => $entry){\n\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\t\t\tforeach($entry as $e) {\n\t\t\t\t$this->addChunkPacket($chunkX, $chunkZ, $e);\n\t\t\t}\n\t\t}\n\t\t$this->moveToSend = [];\n\n\t\tforeach($this->motionToSend as $index => $entry){\n\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\t\t\tforeach($entry as $entity){\n\t\t\t\t$pk = new SetEntityMotionPacket();\n\t\t\t\t$pk->eid = $entity[0];\n\t\t\t\t$pk->motionX = $entity[1];\n\t\t\t\t$pk->motionY = $entity[2];\n\t\t\t\t$pk->motionZ = $entity[3];\n\t\t\t\t$this->addChunkPacket($chunkX, $chunkZ, $pk);\n\t\t\t}\n\t\t}\n\t\t$this->motionToSend = [];\n\n\t\tforeach($this->chunkPackets as $index => $entries){\n\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\t\t\t$chunkPlayers = $this->getChunkPlayers($chunkX, $chunkZ);\n\t\t\tif(count($chunkPlayers) > 0){\n\t\t\t\tforeach($entries as $pk){\n\t\t\t\t\t$this->server->broadcastPacket($chunkPlayers, $pk);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->chunkPackets = [];\n\n\t\t$this->timings->doTick->stopTiming();\n\t}\n\n\tpublic function checkSleep(){\n\t\tif(count($this->players) === 0){\n\t\t\treturn;\n\t\t}\n\n\t\t$resetTime = true;\n\t\tforeach($this->getPlayers() as $p){\n\t\t\tif(!$p->isSleeping()){\n\t\t\t\t$resetTime = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif($resetTime){\n\t\t\t$time = $this->getTime() % Level::TIME_FULL;\n\n\t\t\tif($time >= Level::TIME_NIGHT and $time < Level::TIME_SUNRISE){\n\t\t\t\t$this->setTime($this->getTime() + Level::TIME_FULL - $time);\n\n\t\t\t\tforeach($this->getPlayers() as $p){\n\t\t\t\t\t$p->stopSleep();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function sendBlockExtraData(int $x, int $y, int $z, int $id, int $data, array $targets = null){\n\t\t$pk = new LevelEventPacket;\n\t\t$pk->evid = LevelEventPacket::EVENT_SET_DATA;\n\t\t$pk->x = $x + 0.5;\n\t\t$pk->y = $y + 0.5;\n\t\t$pk->z = $z + 0.5;\n\t\t$pk->data = ($data << 8) | $id;\n\n\t\t$this->server->broadcastPacket($targets === null ? $this->getChunkPlayers($x >> 4, $z >> 4) : $targets, $pk);\n\t}\n\n\t/**\n\t * @param Player[] $target\n\t * @param Block[]  $blocks\n\t * @param int      $flags\n\t * @param bool     $optimizeRebuilds\n\t */\n\tpublic function sendBlocks(array $target, array $blocks, $flags = UpdateBlockPacket::FLAG_NONE, bool $optimizeRebuilds = false){\n\t\tif($optimizeRebuilds){\n\t\t\t$chunks = [];\n\t\t\tforeach($blocks as $b){\n\t\t\t\tif($b === null){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$pk = new UpdateBlockPacket();\n\t\t\t\t$first = false;\n\t\t\t\tif(!isset($chunks[$index = Level::chunkHash($b->x >> 4, $b->z >> 4)])){\n\t\t\t\t\t$chunks[$index] = true;\n\t\t\t\t\t$first = true;\n\t\t\t\t}\n\n\t\t\t\t$pk->x = $b->x;\n\t\t\t\t$pk->z = $b->z;\n\t\t\t\t$pk->y = $b->y;\n\n\t\t\t\tif($b instanceof Block){\n\t\t\t\t\t$pk->blockId = $b->getId();\n\t\t\t\t\t$pk->blockData = $b->getDamage();\n\t\t\t\t}else{\n\t\t\t\t\t$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);\n\t\t\t\t\t$pk->blockId = $fullBlock >> 4;\n\t\t\t\t\t$pk->blockData = $fullBlock & 0xf;\n\t\t\t\t}\n\t\t\t\t$pk->flags = $first ? $flags : UpdateBlockPacket::FLAG_NONE;\n\t\t\t\t$this->server->broadcastPacket($target, $pk);\n\t\t\t}\n\t\t}else{\n\t\t\tforeach($blocks as $b){\n\t\t\t\tif($b === null){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$pk = new UpdateBlockPacket();\n\n\t\t\t\t$pk->x = $b->x;\n\t\t\t\t$pk->z = $b->z;\n\t\t\t\t$pk->y = $b->y;\n\n\t\t\t\tif($b instanceof Block){\n\t\t\t\t\t$pk->blockId = $b->getId();\n\t\t\t\t\t$pk->blockData = $b->getDamage();\n\t\t\t\t}else{\n\t\t\t\t\t$fullBlock = $this->getFullBlock($b->x, $b->y, $b->z);\n\t\t\t\t\t$pk->blockId = $fullBlock >> 4;\n\t\t\t\t\t$pk->blockData = $fullBlock & 0xf;\n\t\t\t\t}\n\t\t\t\t$pk->flags = $flags;\n\t\t\t\t$this->server->broadcastPacket($target, $pk);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function clearCache(bool $full = false){\n\t\tif($full){\n\t\t\t$this->chunkCache = [];\n\t\t\t$this->blockCache = [];\n\t\t}else{\n\t\t\tif(count($this->chunkCache) > 768){\n\t\t\t\t$this->chunkCache = [];\n\t\t\t}\n\n\t\t\tif(count($this->blockCache) > 2048){\n\t\t\t\t$this->blockCache = [];\n\t\t\t}\n\n\t\t}\n\n\t}\n\n\tpublic function clearChunkCache(int $chunkX, int $chunkZ){\n\t\tunset($this->chunkCache[Level::chunkHash($chunkX, $chunkZ)]);\n\t}\n\n\tprivate function tickChunks(){\n\t\tif($this->chunksPerTick <= 0 or count($this->loaders) === 0){\n\t\t\t$this->chunkTickList = [];\n\t\t\treturn;\n\t\t}\n\n\t\t$chunksPerLoader = min(200, max(1, (int) ((($this->chunksPerTick - count($this->loaders)) / count($this->loaders)) + 0.5)));\n\t\t$randRange = 3 + $chunksPerLoader / 30;\n\t\t$randRange = (int) ($randRange > $this->chunkTickRadius ? $this->chunkTickRadius : $randRange);\n\n\t\tforeach($this->loaders as $loader){\n\t\t\t$chunkX = $loader->getX() >> 4;\n\t\t\t$chunkZ = $loader->getZ() >> 4;\n\n\t\t\t$index = Level::chunkHash($chunkX, $chunkZ);\n\t\t\t$existingLoaders = max(0, isset($this->chunkTickList[$index]) ? $this->chunkTickList[$index] : 0);\n\t\t\t$this->chunkTickList[$index] = $existingLoaders + 1;\n\t\t\tfor($chunk = 0; $chunk < $chunksPerLoader; ++$chunk){\n\t\t\t\t$dx = mt_rand(-$randRange, $randRange);\n\t\t\t\t$dz = mt_rand(-$randRange, $randRange);\n\t\t\t\t$hash = Level::chunkHash($dx + $chunkX, $dz + $chunkZ);\n\t\t\t\tif(!isset($this->chunkTickList[$hash]) and isset($this->chunks[$hash])){\n\t\t\t\t\t$this->chunkTickList[$hash] = -1;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->chunkTickList as $index => $loaders){\n\t\t\tLevel::getXZ($index, $chunkX, $chunkZ);\n\n\n\t\t\tif(!isset($this->chunks[$index]) or ($chunk = $this->getChunk($chunkX, $chunkZ, false)) === null){\n\t\t\t\tunset($this->chunkTickList[$index]);\n\t\t\t\tcontinue;\n\t\t\t}elseif($loaders <= 0){\n\t\t\t\tunset($this->chunkTickList[$index]);\n\t\t\t}\n\n\t\t\tforeach($chunk->getEntities() as $entity){\n\t\t\t\t$entity->scheduleUpdate();\n\t\t\t}\n\n\n\t\t\tforeach($chunk->getSubChunks() as $Y => $subChunk){\n\t\t\t\tif(!$subChunk->isEmpty()){\n\t\t\t\t\t$k = mt_rand(0, 0x7fffffff);\n\t\t\t\t\tfor($i = 0; $i < 3; ++$i, $k >>= 10){\n\t\t\t\t\t\t$x = $k & 0x0f;\n\t\t\t\t\t\t$y = ($k >> 8) & 0x0f;\n\t\t\t\t\t\t$z = ($k >> 16) & 0x0f;\n\n\t\t\t\t\t\t$blockId = $subChunk->getBlockId($x, $y, $z);\n\t\t\t\t\t\tif(isset($this->randomTickBlocks[$blockId])){\n\t\t\t\t\t\t\t$class = $this->randomTickBlocks[$blockId];\n\t\t\t\t\t\t\t/** @var Block $block */\n\t\t\t\t\t\t\t$block = new $class($subChunk->getBlockData($x, $y, $z));\n\t\t\t\t\t\t\t$block->x = $chunkX * 16 + $x;\n\t\t\t\t\t\t\t$block->y = ($Y << 4) + $y;\n\t\t\t\t\t\t\t$block->z = $chunkZ * 16 + $z;\n\t\t\t\t\t\t\t$block->level = $this;\n\t\t\t\t\t\t\t$block->onUpdate(self::BLOCK_UPDATE_RANDOM);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($this->clearChunksOnTick){\n\t\t\t$this->chunkTickList = [];\n\t\t}\n\t}\n\n\tpublic function __debugInfo() : array{\n\t\treturn [];\n\t}\n\n\t/**\n\t * @param bool $force\n\t *\n\t * @return bool\n\t */\n\tpublic function save(bool $force = false) : bool{\n\n\t\tif(!$this->getAutoSave() and !$force){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent(new LevelSaveEvent($this));\n\n\t\t$this->provider->setTime((int) $this->time);\n\t\t$this->saveChunks();\n\t\tif($this->provider instanceof BaseLevelProvider){\n\t\t\t$this->provider->saveLevelData();\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function saveChunks(){\n\t\tforeach($this->chunks as $chunk){\n\t\t\tif($chunk->hasChanged()){\n\t\t\t\t$this->provider->setChunk($chunk->getX(), $chunk->getZ(), $chunk);\n\t\t\t\t$this->provider->saveChunk($chunk->getX(), $chunk->getZ());\n\t\t\t\t$chunk->setChanged(false);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param Vector3 $pos\n\t */\n\tpublic function updateAround(Vector3 $pos){\n\t\t$pos = $pos->floor();\n\t\t$this->server->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->getBlock($this->temporalVector->setComponents($pos->x, $pos->y - 1, $pos->z))));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$ev->getBlock()->onUpdate(self::BLOCK_UPDATE_NORMAL);\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->getBlock($this->temporalVector->setComponents($pos->x, $pos->y + 1, $pos->z))));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$ev->getBlock()->onUpdate(self::BLOCK_UPDATE_NORMAL);\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->getBlock($this->temporalVector->setComponents($pos->x - 1, $pos->y, $pos->z))));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$ev->getBlock()->onUpdate(self::BLOCK_UPDATE_NORMAL);\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->getBlock($this->temporalVector->setComponents($pos->x + 1, $pos->y, $pos->z))));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$ev->getBlock()->onUpdate(self::BLOCK_UPDATE_NORMAL);\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->getBlock($this->temporalVector->setComponents($pos->x, $pos->y, $pos->z - 1))));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$ev->getBlock()->onUpdate(self::BLOCK_UPDATE_NORMAL);\n\t\t}\n\n\t\t$this->server->getPluginManager()->callEvent($ev = new BlockUpdateEvent($this->getBlock($this->temporalVector->setComponents($pos->x, $pos->y, $pos->z + 1))));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$ev->getBlock()->onUpdate(self::BLOCK_UPDATE_NORMAL);\n\t\t}\n\t}\n\n\t/**\n\t * @param Vector3 $pos\n\t * @param int     $delay\n\t */\n\tpublic function scheduleUpdate(Vector3 $pos, int $delay){\n\t\tif(isset($this->updateQueueIndex[$index = Level::blockHash($pos->x, $pos->y, $pos->z)]) and $this->updateQueueIndex[$index] <= $delay){\n\t\t\treturn;\n\t\t}\n\t\t$this->updateQueueIndex[$index] = $delay;\n\t\t$this->updateQueue->insert(new Vector3((int) $pos->x, (int) $pos->y, (int) $pos->z), (int) $delay + $this->server->getTick());\n\t}\n\n\t/**\n\t * @param AxisAlignedBB $bb\n\t * @param bool          $targetFirst\n\t *\n\t * @return Block[]\n\t */\n\tpublic function getCollisionBlocks(AxisAlignedBB $bb, bool $targetFirst = false) : array{\n\t\t$minX = Math::floorFloat($bb->minX);\n\t\t$minY = Math::floorFloat($bb->minY);\n\t\t$minZ = Math::floorFloat($bb->minZ);\n\t\t$maxX = Math::ceilFloat($bb->maxX);\n\t\t$maxY = Math::ceilFloat($bb->maxY);\n\t\t$maxZ = Math::ceilFloat($bb->maxZ);\n\n\t\t$collides = [];\n\n\t\tif($targetFirst){\n\t\t\tfor($z = $minZ; $z <= $maxZ; ++$z){\n\t\t\t\tfor($x = $minX; $x <= $maxX; ++$x){\n\t\t\t\t\tfor($y = $minY; $y <= $maxY; ++$y){\n\t\t\t\t\t\t$block = $this->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\t\t\t\t\t\tif($block->getId() !== 0 and $block->collidesWithBB($bb)){\n\t\t\t\t\t\t\treturn [$block];\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\tfor($z = $minZ; $z <= $maxZ; ++$z){\n\t\t\t\tfor($x = $minX; $x <= $maxX; ++$x){\n\t\t\t\t\tfor($y = $minY; $y <= $maxY; ++$y){\n\t\t\t\t\t\t$block = $this->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\t\t\t\t\t\tif($block->getId() !== 0 and $block->collidesWithBB($bb)){\n\t\t\t\t\t\t\t$collides[] = $block;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\treturn $collides;\n\t}\n\n\t/**\n\t * @param Vector3 $pos\n\t *\n\t * @return bool\n\t */\n\tpublic function isFullBlock(Vector3 $pos) : bool{\n\t\tif($pos instanceof Block){\n\t\t\tif($pos->isSolid()){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\t$bb = $pos->getBoundingBox();\n\t\t}else{\n\t\t\t$bb = $this->getBlock($pos)->getBoundingBox();\n\t\t}\n\n\t\treturn $bb !== null and $bb->getAverageEdgeLength() >= 1;\n\t}\n\n\t/**\n\t * @param Entity        $entity\n\t * @param AxisAlignedBB $bb\n\t * @param boolean       $entities\n\t *\n\t * @return AxisAlignedBB[]\n\t */\n\tpublic function getCollisionCubes(Entity $entity, AxisAlignedBB $bb, bool $entities = true) : array{\n\t\t$minX = Math::floorFloat($bb->minX);\n\t\t$minY = Math::floorFloat($bb->minY);\n\t\t$minZ = Math::floorFloat($bb->minZ);\n\t\t$maxX = Math::ceilFloat($bb->maxX);\n\t\t$maxY = Math::ceilFloat($bb->maxY);\n\t\t$maxZ = Math::ceilFloat($bb->maxZ);\n\n\t\t$collides = [];\n\n\t\tfor($z = $minZ; $z <= $maxZ; ++$z){\n\t\t\tfor($x = $minX; $x <= $maxX; ++$x){\n\t\t\t\tfor($y = $minY; $y <= $maxY; ++$y){\n\t\t\t\t\t$block = $this->getBlock($this->temporalVector->setComponents($x, $y, $z));\n\t\t\t\t\tif(!$block->canPassThrough() and $block->collidesWithBB($bb)){\n\t\t\t\t\t\t$collides[] = $block->getBoundingBox();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($entities){\n\t\t\tforeach($this->getCollidingEntities($bb->grow(0.25, 0.25, 0.25), $entity) as $ent){\n\t\t\t\t$collides[] = clone $ent->boundingBox;\n\t\t\t}\n\t\t}\n\n\t\treturn $collides;\n\t}\n\n\t/*\n\tpublic function rayTraceBlocks(Vector3 $pos1, Vector3 $pos2, $flag = false, $flag1 = false, $flag2 = false){\n\t\tif(!is_nan($pos1->x) and !is_nan($pos1->y) and !is_nan($pos1->z)){\n\t\t\tif(!is_nan($pos2->x) and !is_nan($pos2->y) and !is_nan($pos2->z)){\n\t\t\t\t$x1 = (int) $pos1->x;\n\t\t\t\t$y1 = (int) $pos1->y;\n\t\t\t\t$z1 = (int) $pos1->z;\n\t\t\t\t$x2 = (int) $pos2->x;\n\t\t\t\t$y2 = (int) $pos2->y;\n\t\t\t\t$z2 = (int) $pos2->z;\n\n\t\t\t\t$block = $this->getBlock(Vector3::createVector($x1, $y1, $z1));\n\n\t\t\t\tif(!$flag1 or $block->getBoundingBox() !== null){\n\t\t\t\t\t$ob = $block->calculateIntercept($pos1, $pos2);\n\t\t\t\t\tif($ob !== null){\n\t\t\t\t\t\treturn $ob;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$movingObjectPosition = null;\n\n\t\t\t\t$k = 200;\n\n\t\t\t\twhile($k-- >= 0){\n\t\t\t\t\tif(is_nan($pos1->x) or is_nan($pos1->y) or is_nan($pos1->z)){\n\t\t\t\t\t\treturn null;\n\t\t\t\t\t}\n\n\t\t\t\t\tif($x1 === $x2 and $y1 === $y2 and $z1 === $z2){\n\t\t\t\t\t\treturn $flag2 ? $movingObjectPosition : null;\n\t\t\t\t\t}\n\n\t\t\t\t\t$flag3 = true;\n\t\t\t\t\t$flag4 = true;\n\t\t\t\t\t$flag5 = true;\n\n\t\t\t\t\t$i = 999;\n\t\t\t\t\t$j = 999;\n\t\t\t\t\t$k = 999;\n\n\t\t\t\t\tif($x1 > $x2){\n\t\t\t\t\t\t$i = $x2 + 1;\n\t\t\t\t\t}elseif($x1 < $x2){\n\t\t\t\t\t\t$i = $x2;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$flag3 = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif($y1 > $y2){\n\t\t\t\t\t\t$j = $y2 + 1;\n\t\t\t\t\t}elseif($y1 < $y2){\n\t\t\t\t\t\t$j = $y2;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$flag4 = false;\n\t\t\t\t\t}\n\n\t\t\t\t\tif($z1 > $z2){\n\t\t\t\t\t\t$k = $z2 + 1;\n\t\t\t\t\t}elseif($z1 < $z2){\n\t\t\t\t\t\t$k = $z2;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$flag5 = false;\n\t\t\t\t\t}\n\n\t\t\t\t\t//TODO\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t*/\n\n\tpublic function getFullLight(Vector3 $pos) : int{\n\t\t$chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);\n\t\t$level = 0;\n\t\tif($chunk !== null){\n\t\t\t$level = $chunk->getBlockSkyLight($pos->x & 0x0f, $pos->y & Level::Y_MASK, $pos->z & 0x0f);\n\t\t\t//TODO: decrease light level by time of day\n\t\t\tif($level < 15){\n\t\t\t\t$level = max($chunk->getBlockLight($pos->x & 0x0f, $pos->y & Level::Y_MASK, $pos->z & 0x0f));\n\t\t\t}\n\t\t}\n\n\t\treturn $level;\n\t}\n\n\t/**\n\t * @param $x\n\t * @param $y\n\t * @param $z\n\t *\n\t * @return int bitmap, (id << 4) | data\n\t */\n\tpublic function getFullBlock(int $x, int $y, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, false)->getFullBlock($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f);\n\t}\n\n\t/**\n\t * Gets the Block object on the Vector3 location\n\t *\n\t * @param Vector3 $pos\n\t * @param boolean $cached\n\t *\n\t * @return Block\n\t */\n\tpublic function getBlock(Vector3 $pos, $cached = true) : Block{\n\t\t$pos = $pos->floor();\n\t\t$index = Level::blockHash($pos->x, $pos->y, $pos->z);\n\t\tif($cached and isset($this->blockCache[$index])){\n\t\t\treturn $this->blockCache[$index];\n\t\t}elseif($pos->y >= 0 and $pos->y < $this->provider->getWorldHeight() and isset($this->chunks[$chunkIndex = Level::chunkHash($pos->x >> 4, $pos->z >> 4)])){\n\t\t\t$fullState = $this->chunks[$chunkIndex]->getFullBlock($pos->x & 0x0f, $pos->y & Level::Y_MASK, $pos->z & 0x0f);\n\t\t}else{\n\t\t\t$fullState = 0;\n\t\t}\n\n\t\t$block = clone $this->blockStates[$fullState & 0xfff];\n\n\t\t$block->x = $pos->x;\n\t\t$block->y = $pos->y;\n\t\t$block->z = $pos->z;\n\t\t$block->level = $this;\n\n\t\treturn $this->blockCache[$index] = $block;\n\t}\n\n\tpublic function updateAllLight(Vector3 $pos){\n\t\t$this->updateBlockSkyLight($pos->x, $pos->y, $pos->z);\n\t\t$this->updateBlockLight($pos->x, $pos->y, $pos->z);\n\t}\n\n\tpublic function updateBlockSkyLight(int $x, int $y, int $z){\n\t\t//TODO\n\t}\n\n\tpublic function updateBlockLight(int $x, int $y, int $z){\n\t\t$lightPropagationQueue = new \\SplQueue();\n\t\t$lightRemovalQueue = new \\SplQueue();\n\t\t$visited = [];\n\t\t$removalVisited = [];\n\n\t\t$oldLevel = $this->getBlockLightAt($x, $y, $z);\n\t\t$newLevel = (int) Block::$light[$this->getBlockIdAt($x, $y, $z)];\n\n\t\tif($oldLevel !== $newLevel){\n\t\t\t$this->setBlockLightAt($x, $y, $z, $newLevel);\n\n\t\t\tif($newLevel < $oldLevel){\n\t\t\t\t$removalVisited[Level::blockHash($x, $y, $z)] = true;\n\t\t\t\t$lightRemovalQueue->enqueue([new Vector3($x, $y, $z), $oldLevel]);\n\t\t\t}else{\n\t\t\t\t$visited[Level::blockHash($x, $y, $z)] = true;\n\t\t\t\t$lightPropagationQueue->enqueue(new Vector3($x, $y, $z));\n\t\t\t}\n\t\t}\n\n\t\twhile(!$lightRemovalQueue->isEmpty()){\n\t\t\t/** @var Vector3 $node */\n\t\t\t$val = $lightRemovalQueue->dequeue();\n\t\t\t$node = $val[0];\n\t\t\t$lightLevel = $val[1];\n\n\t\t\t$this->computeRemoveBlockLight($node->x - 1, $node->y, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x + 1, $node->y, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y - 1, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y + 1, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y, $node->z - 1, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y, $node->z + 1, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t}\n\n\t\twhile(!$lightPropagationQueue->isEmpty()){\n\t\t\t/** @var Vector3 $node */\n\t\t\t$node = $lightPropagationQueue->dequeue();\n\n\t\t\t$lightLevel = $this->getBlockLightAt($node->x, $node->y, $node->z) - (int) Block::$lightFilter[$this->getBlockIdAt($node->x, $node->y, $node->z)];\n\n\t\t\tif($lightLevel >= 1){\n\t\t\t\t$this->computeSpreadBlockLight($node->x - 1, $node->y, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x + 1, $node->y, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y - 1, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y + 1, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y, $node->z - 1, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y, $node->z + 1, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function computeRemoveBlockLight(int $x, int $y, int $z, int $currentLight, \\SplQueue $queue, \\SplQueue $spreadQueue, array &$visited, array &$spreadVisited){\n\t\tif($y < 0) return;\n\t\t$current = $this->getBlockLightAt($x, $y, $z);\n\n\t\tif($current !== 0 and $current < $currentLight){\n\t\t\t$this->setBlockLightAt($x, $y, $z, 0);\n\n\t\t\tif(!isset($visited[$index = Level::blockHash($x, $y, $z)])){\n\t\t\t\t$visited[$index] = true;\n\t\t\t\tif($current > 1){\n\t\t\t\t\t$queue->enqueue([new Vector3($x, $y, $z), $current]);\n\t\t\t\t}\n\t\t\t}\n\t\t}elseif($current >= $currentLight){\n\t\t\tif(!isset($spreadVisited[$index = Level::blockHash($x, $y, $z)])){\n\t\t\t\t$spreadVisited[$index] = true;\n\t\t\t\t$spreadQueue->enqueue(new Vector3($x, $y, $z));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function computeSpreadBlockLight(int $x, int $y, int $z, int $currentLight, \\SplQueue $queue, array &$visited){\n\t\tif($y < 0) return;\n\t\t$current = $this->getBlockLightAt($x, $y, $z);\n\n\t\tif($current < $currentLight){\n\t\t\t$this->setBlockLightAt($x, $y, $z, $currentLight);\n\n\t\t\tif(!isset($visited[$index = Level::blockHash($x, $y, $z)])){\n\t\t\t\t$visited[$index] = true;\n\t\t\t\tif($currentLight > 1){\n\t\t\t\t\t$queue->enqueue(new Vector3($x, $y, $z));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Sets on Vector3 the data from a Block object,\n\t * does block updates and puts the changes to the send queue.\n\t *\n\t * If $direct is true, it'll send changes directly to players. if false, it'll be queued\n\t * and the best way to send queued changes will be done in the next tick.\n\t * This way big changes can be sent on a single chunk update packet instead of thousands of packets.\n\t *\n\t * If $update is true, it'll get the neighbour blocks (6 sides) and update them.\n\t * If you are doing big changes, you might want to set this to false, then update manually.\n\t *\n\t * @param Vector3 $pos\n\t * @param Block   $block\n\t * @param bool    $direct @deprecated\n\t * @param bool    $update\n\t *\n\t * @return bool Whether the block has been updated or not\n\t */\n\tpublic function setBlock(Vector3 $pos, Block $block, bool $direct = false, bool $update = true) : bool{\n\t\t$pos = $pos->floor();\n\t\tif($pos->y < 0 or $pos->y >= $this->provider->getWorldHeight()){\n\t\t\treturn false;\n\t\t}\n\n\t\tif($this->getChunk($pos->x >> 4, $pos->z >> 4, true)->setBlock($pos->x & 0x0f, $pos->y & Level::Y_MASK, $pos->z & 0x0f, $block->getId(), $block->getDamage())){\n\t\t\tif(!($pos instanceof Position)){\n\t\t\t\t$pos = $this->temporalPosition->setComponents($pos->x, $pos->y, $pos->z);\n\t\t\t}\n\n\t\t\t$block->position($pos);\n\t\t\tunset($this->blockCache[Level::blockHash($pos->x, $pos->y, $pos->z)]);\n\n\t\t\t$index = Level::chunkHash($pos->x >> 4, $pos->z >> 4);\n\n\t\t\tif($direct === true){\n\t\t\t\t$this->sendBlocks($this->getChunkPlayers($pos->x >> 4, $pos->z >> 4), [$block], UpdateBlockPacket::FLAG_ALL_PRIORITY);\n\t\t\t\tunset($this->chunkCache[$index]);\n\t\t\t}else{\n\t\t\t\tif(!isset($this->changedBlocks[$index])){\n\t\t\t\t\t$this->changedBlocks[$index] = [];\n\t\t\t\t}\n\n\t\t\t\t$this->changedBlocks[$index][Level::blockHash($block->x, $block->y, $block->z)] = clone $block;\n\t\t\t}\n\n\t\t\tforeach($this->getChunkLoaders($pos->x >> 4, $pos->z >> 4) as $loader){\n\t\t\t\t$loader->onBlockChanged($block);\n\t\t\t}\n\n\t\t\tif($update === true){\n\t\t\t\t$this->updateAllLight($block);\n\n\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new BlockUpdateEvent($block));\n\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\tforeach($this->getNearbyEntities(new AxisAlignedBB($block->x - 1, $block->y - 1, $block->z - 1, $block->x + 1, $block->y + 1, $block->z + 1)) as $entity){\n\t\t\t\t\t\t$entity->scheduleUpdate();\n\t\t\t\t\t}\n\t\t\t\t\t$ev->getBlock()->onUpdate(self::BLOCK_UPDATE_NORMAL);\n\t\t\t\t}\n\n\t\t\t\t$this->updateAround($pos);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param Vector3 $source\n\t * @param Item    $item\n\t * @param Vector3 $motion\n\t * @param int     $delay\n\t *\n\t * @return null|Entity|DroppedItem|\\pocketmine\\entity\\Projectile\n     */\n\tpublic function dropItem(Vector3 $source, Item $item, Vector3 $motion = null, int $delay = 10){\n\t\t$motion = $motion === null ? new Vector3(lcg_value() * 0.2 - 0.1, 0.2, lcg_value() * 0.2 - 0.1) : $motion;\n\n\t\tif($item->getId() > 0 and $item->getCount() > 0){\n\t\t\t$itemEntity = Entity::createEntity(\"Item\", $this->getChunk($source->getX() >> 4, $source->getZ() >> 4, true), new CompoundTag(\"\", [\n\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\tnew DoubleTag(\"\", $source->getX()),\n\t\t\t\t\tnew DoubleTag(\"\", $source->getY()),\n\t\t\t\t\tnew DoubleTag(\"\", $source->getZ())\n\t\t\t\t]),\n\n\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\tnew DoubleTag(\"\", $motion->x),\n\t\t\t\t\tnew DoubleTag(\"\", $motion->y),\n\t\t\t\t\tnew DoubleTag(\"\", $motion->z)\n\t\t\t\t]),\n\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\tnew FloatTag(\"\", lcg_value() * 360),\n\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t\t\"Health\" => new ShortTag(\"Health\", 5),\n\t\t\t\t\"Item\" => $item->nbtSerialize(-1, \"Item\"),\n\t\t\t\t\"PickupDelay\" => new ShortTag(\"PickupDelay\", $delay)\n\t\t\t]));\n\n\t\t\t$itemEntity->spawnToAll();\n\n\t\t\treturn $itemEntity;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Tries to break a block using a item, including Player time checks if available\n\t * It'll try to lower the durability if Item is a tool, and set it to Air if broken.\n\t *\n\t * @param Vector3 $vector\n\t * @param Item    &$item (if null, can break anything)\n\t * @param Player  $player\n\t * @param bool    $createParticles\n\t *\n\t * @return bool\n\t */\n\tpublic function useBreakOn(Vector3 $vector, Item &$item = null, Player $player = null, bool $createParticles = false) : bool{\n\t\t$target = $this->getBlock($vector);\n\n\t\tif($item === null){\n\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t}\n\n\t\tif($player !== null){\n\t\t\t$ev = new BlockBreakEvent($player, $target, $item, ($player->isCreative() or $this->server->allowInstabreak));\n\n\t\t\tif($player->isAdventure() or $player->isSpectator() or ($player->isSurvival() and $item instanceof Item and !$target->isBreakable($item))){\n\t\t\t\t$ev->setCancelled();\n\t\t\t}elseif(!$player->isOp() and ($distance = $this->server->getSpawnRadius()) > -1){\n\t\t\t\t$t = new Vector2($target->x, $target->z);\n\t\t\t\t$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z);\n\t\t\t\tif(count($this->server->getOps()->getAll()) > 0 and $t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this\n\t\t\t\t\t$ev->setCancelled();\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\tif($ev->isCancelled()){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$breakTime = $target->getBreakTime($item);\n\n\t\t\tif($player->isCreative() and $breakTime > 0.15){\n\t\t\t\t$breakTime = 0.15;\n\t\t\t}\n\n\t\t\tif($player->hasEffect(Effect::SWIFTNESS)){\n\t\t\t\t$breakTime *= 1 - (0.2 * ($player->getEffect(Effect::SWIFTNESS)->getAmplifier() + 1));\n\t\t\t}\n\n\t\t\tif($player->hasEffect(Effect::MINING_FATIGUE)){\n\t\t\t\t$breakTime *= 1 + (0.3 * ($player->getEffect(Effect::MINING_FATIGUE)->getAmplifier() + 1));\n\t\t\t}\n\n\t\t\t$breakTime -= 0.05; //1 tick compensation\n\n\t\t\tif(!$ev->getInstaBreak() and ($player->lastBreak + $breakTime) > microtime(true)){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t$player->lastBreak = microtime(true);\n\n\t\t\t$drops = $ev->getDrops();\n\n\t\t\tif($player->isSurvival() and $this->getServer()->expEnabled){\n\t\t\t\t$exp = 0;\n\t\t\t\tif($item->getEnchantmentLevel(Enchantment::TYPE_MINING_SILK_TOUCH) === 0){\n\t\t\t\t\tswitch($target->getId()){\n\t\t\t\t\t\tcase Block::COAL_ORE:\n\t\t\t\t\t\t\t$exp = mt_rand(0, 2);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Block::DIAMOND_ORE:\n\t\t\t\t\t\tcase Block::EMERALD_ORE:\n\t\t\t\t\t\t\t$exp = mt_rand(3, 7);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Block::NETHER_QUARTZ_ORE:\n\t\t\t\t\t\tcase Block::LAPIS_ORE:\n\t\t\t\t\t\t\t$exp = mt_rand(2, 5);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\tcase Block::REDSTONE_ORE:\n\t\t\t\t\t\tcase Block::GLOWING_REDSTONE_ORE:\n\t\t\t\t\t\t\t$exp = mt_rand(1, 5);\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tswitch($target->getId()){\n\t\t\t\t\tcase Block::MONSTER_SPAWNER:\n\t\t\t\t\t\t$exp = mt_rand(15, 43);\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif($exp > 0){$this->spawnXPOrb($vector->add(0, 1, 0), $exp);}\n\t\t\t}\n\n\t\t}elseif($item !== null and !$target->isBreakable($item)){\n\t\t\treturn false;\n\t\t}else{\n\t\t\t$drops = $target->getDrops($item); //Fixes tile entities being deleted before getting drops\n\t\t\tforeach($drops as $k => $i){\n\t\t\t\tif((isset ($i[0])) && (isset ($i[1])) && (isset ($i[2]))) $drops[$k] = Item::get($i[0], $i[1], $i[2]);\n\t\t\t}\n\t\t}\n\n\t\t$above = $this->getBlock(new Vector3($target->x, $target->y + 1, $target->z));\n\t\tif($above !== null){\n\t\t\tif($above->getId() === Item::FIRE){\n\t\t\t\t$this->setBlock($above, new Air(), true);\n\t\t\t}\n\t\t}\n\n\t\t$tag = $item->getNamedTagEntry(\"CanDestroy\");\n\t\tif($tag instanceof ListTag){\n\t\t\t$canBreak = false;\n\t\t\tforeach($tag as $v){\n\t\t\t\tif($v instanceof StringTag){\n\t\t\t\t\t$entry = Item::fromString($v->getValue());\n\t\t\t\t\tif($entry->getId() > 0 and $entry->getBlock() !== null and $entry->getBlock()->getId() === $target->getId()){\n\t\t\t\t\t\t$canBreak = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!$canBreak){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif($createParticles){\n\t\t\t$this->addParticle(new DestroyBlockParticle($target, $target));\n\t\t}\n\n\t\t$target->onBreak($item);\n\n\t\t$tile = $this->getTile($target);\n\t\tif($tile !== null){\n\t\t\tif($tile instanceof InventoryHolder){\n\t\t\t\tif($tile instanceof Chest){\n\t\t\t\t\t$tile->unpair();\n\t\t\t\t}\n\n\t\t\t\tforeach($tile->getInventory()->getContents() as $chestItem){\n\t\t\t\t\t$this->dropItem($target, $chestItem);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$tile->close();\n\t\t}\n\n\t\tif($item !== null){\n\t\t\t$item->useOn($target);\n\t\t\tif($item->isTool() and $item->getDamage() >= $item->getMaxDurability()){\n\t\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t\t}\n\t\t}\n\n\t\tif($player === null or $player->isSurvival()){\n\t\t\tforeach($drops as $drop){\n\t\t\t\tif($drop->getCount() > 0){\n\t\t\t\t\t$this->dropItem($vector->add(0.5, 0.5, 0.5), $drop);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Uses a item on a position and face, placing it or activating the block\n\t *\n\t * @param Vector3 $vector\n\t * @param Item    $item\n\t * @param int     $face\n\t * @param float   $fx     default 0.0\n\t * @param float   $fy     default 0.0\n\t * @param float   $fz     default 0.0\n\t * @param Player  $player default null\n\t *\n\t * @return bool\n\t */\n\tpublic function useItemOn(Vector3 $vector, Item &$item, int $face, float $fx = 0.0, float $fy = 0.0, float $fz = 0.0, Player $player = null) : bool{\n\t\t$target = $this->getBlock($vector);\n\t\t$block = $target->getSide($face);\n\n\t\tif($block->y >= $this->provider->getWorldHeight() or $block->y < 0){\n\t\t\t//TODO: build height limit messages for custom world heights and mcregion cap\n\t\t\treturn false;\n\t\t}\n\n\t\tif($target->getId() === Item::AIR){\n\t\t\treturn false;\n\t\t}\n\n\t\tif($player !== null){\n\t\t\t$ev = new PlayerInteractEvent($player, $item, $target, $face, $target->getId() === 0 ? PlayerInteractEvent::RIGHT_CLICK_AIR : PlayerInteractEvent::RIGHT_CLICK_BLOCK);\n\t\t\tif(!$player->isOp() and ($distance = $this->server->getSpawnRadius()) > -1){\n\t\t\t\t$t = new Vector2($target->x, $target->z);\n\t\t\t\t$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z);\n\t\t\t\tif(count($this->server->getOps()->getAll()) > 0 and $t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this\n\t\t\t\t\t$ev->setCancelled();\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($player->isSpectator()){\n\t\t\t\t$ev->setCancelled();\n\t\t\t}\n\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t$target->onUpdate(self::BLOCK_UPDATE_TOUCH);\n\t\t\t\tif(!$player->isSneaking()){\n\t\t\t\t\tif($target->canBeActivated() === true and $target->onActivate($item, $player) === true){\n\t\t\t\t\t\tif($item->getCount() <= 0){\n\t\t\t\t\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t\t\t\t\t}elseif($item->isTool() and $item->getDamage() >= $item->getMaxDurability()){\n\t\t\t\t\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t\tif($item->canBeActivated() and $item->onActivate($this, $player, $block, $target, $face, $fx, $fy, $fz)){\n\t\t\t\t\t\tif($item->getCount() <= 0){\n\t\t\t\t\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}elseif($item->isTool() and $item->getDamage() >= $item->getMaxDurability()){\n\t\t\t\t\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t\t\t\t\t\treturn true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t/*if(!$player->isSneaking() and $target->canBeActivated() === true and $target->onActivate($item, $player) === true){\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\n\t\t\t\tif(!$player->isSneaking() and $item->canBeActivated() and $item->onActivate($this, $player, $block, $target, $face, $fx, $fy, $fz)){\n\t\t\t\t\tif($item->getCount() <= 0){\n\t\t\t\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\n\t\t\t\t\t\treturn true;\n\t\t\t\t\t}\n\t\t\t\t}*/\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}elseif($target->canBeActivated() === true and $target->onActivate($item, $player) === true){\n\t\t\treturn true;\n\t\t}\n\n\t\tif($item->canBePlaced()){\n\t\t\t$hand = $item->getBlock();\n\t\t\t$hand->position($block);\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!($block->canBeReplaced() === true or ($hand->getId() === Item::SLAB and $block->getId() === Item::SLAB))){\n\t\t\treturn false;\n\t\t}\n\n\t\tif($target->canBeReplaced() === true){\n\t\t\t$block = $target;\n\t\t\t$hand->position($block);\n\t\t\t//$face = -1;\n\t\t}\n\n\t\tif($hand->isSolid() === true and $hand->getBoundingBox() !== null){\n\t\t\t$entities = $this->getCollidingEntities($hand->getBoundingBox());\n\t\t\t$realCount = 0;\n\t\t\tforeach($entities as $e){\n\t\t\t\tif($e instanceof Arrow or $e instanceof DroppedItem or ($e instanceof Player and $e->isSpectator())){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t++$realCount;\n\t\t\t}\n\n\t\t\tif($player !== null){\n\t\t\t\tif(($diff = $player->getNextPosition()->subtract($player->getPosition())) and $diff->lengthSquared() > 0.00001){\n\t\t\t\t\t$bb = $player->getBoundingBox()->getOffsetBoundingBox($diff->x, $diff->y, $diff->z);\n\t\t\t\t\tif($hand->getBoundingBox()->intersectsWith($bb)){\n\t\t\t\t\t\t++$realCount;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($realCount > 0){\n\t\t\t\treturn false; //Entity in block\n\t\t\t}\n\t\t}\n\n\t\t$tag = $item->getNamedTagEntry(\"CanPlaceOn\");\n\t\tif($tag instanceof ListTag){\n\t\t\t$canPlace = false;\n\t\t\tforeach($tag as $v){\n\t\t\t\tif($v instanceof StringTag){\n\t\t\t\t\t$entry = Item::fromString($v->getValue());\n\t\t\t\t\tif($entry->getId() > 0 and $entry->getBlock() !== null and $entry->getBlock()->getId() === $target->getId()){\n\t\t\t\t\t\t$canPlace = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!$canPlace){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\n\t\tif($player !== null){\n\t\t\t$ev = new BlockPlaceEvent($player, $hand, $block, $target, $item);\n\t\t\tif(!$player->isOp() and ($distance = $this->server->getSpawnRadius()) > -1){\n\t\t\t\t$t = new Vector2($target->x, $target->z);\n\t\t\t\t$s = new Vector2($this->getSpawnLocation()->x, $this->getSpawnLocation()->z);\n\t\t\t\tif(count($this->server->getOps()->getAll()) > 0 and $t->distance($s) <= $distance){ //set it to cancelled so plugins can bypass this\n\t\t\t\t\t$ev->setCancelled();\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t\tif($ev->isCancelled()){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tif($hand->place($item, $block, $target, $face, $fx, $fy, $fz, $player) === false){\n\t\t\treturn false;\n\t\t}\n\t\t$this->addSound(new BlockPlaceSound($this->getBlock($block))); //Get updated block, $block is still the original block and cannot be used directly\n\n\t\tif($hand->getId() === Item::SIGN_POST or $hand->getId() === Item::WALL_SIGN){\n\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\"id\" => new StringTag(\"id\", Tile::SIGN),\n\t\t\t\t\"x\" => new IntTag(\"x\", $block->x),\n\t\t\t\t\"y\" => new IntTag(\"y\", $block->y),\n\t\t\t\t\"z\" => new IntTag(\"z\", $block->z),\n\t\t\t\t\"Text1\" => new StringTag(\"Text1\", \"\"),\n\t\t\t\t\"Text2\" => new StringTag(\"Text2\", \"\"),\n\t\t\t\t\"Text3\" => new StringTag(\"Text3\", \"\"),\n\t\t\t\t\"Text4\" => new StringTag(\"Text4\", \"\")\n\t\t\t]);\n\n\t\t\tif($player !== null){\n\t\t\t\t$nbt->Creator = new StringTag(\"Creator\", $player->getRawUniqueId());\n\t\t\t}\n\n\t\t\tif($item->hasCustomBlockData()){\n\t\t\t\tforeach($item->getCustomBlockData() as $key => $v){\n\t\t\t\t\t$nbt->{$key} = $v;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tTile::createTile(\"Sign\", $this->getChunk($block->x >> 4, $block->z >> 4), $nbt);\n\t\t}\n\t\tif ($player != null && $player->isCreative()) {\n\t\t\t$item->setCount($item->getCount());\n\t\t} else {\n\t\t\t$item->setCount($item->getCount() - 1);\n\t\t}\n\t\tif($item->getCount() <= 0){\n\t\t\t$item = Item::get(Item::AIR, 0, 0);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param int $entityId\n\t *\n\t * @return Entity\n\t */\n\tpublic function getEntity(int $entityId){\n\t\treturn isset($this->entities[$entityId]) ? $this->entities[$entityId] : null;\n\t}\n\n\t/**\n\t * Gets the list of all the entities in this level\n\t *\n\t * @return Entity[]\n\t */\n\tpublic function getEntities() : array{\n\t\treturn $this->entities;\n\t}\n\n\t/**\n\t * Returns the entities colliding the current one inside the AxisAlignedBB\n\t *\n\t * @param AxisAlignedBB $bb\n\t * @param Entity        $entity\n\t *\n\t * @return Entity[]\n\t */\n\tpublic function getCollidingEntities(AxisAlignedBB $bb, Entity $entity = null) : array{\n\t\t$nearby = [];\n\n\t\tif($entity === null or $entity->canCollide){\n\t\t\t$minX = Math::floorFloat(($bb->minX - 2) / 16);\n\t\t\t$maxX = Math::ceilFloat(($bb->maxX + 2) / 16);\n\t\t\t$minZ = Math::floorFloat(($bb->minZ - 2) / 16);\n\t\t\t$maxZ = Math::ceilFloat(($bb->maxZ + 2) / 16);\n\n\t\t\tfor($x = $minX; $x <= $maxX; ++$x){\n\t\t\t\tfor($z = $minZ; $z <= $maxZ; ++$z){\n\t\t\t\t\tforeach($this->getChunkEntities($x, $z) as $ent){\n\t\t\t\t\t\tif($ent instanceof Player and $ent->isSpectator()){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($entity == null){\n\t\t\t\t\t\t\tif($ent->boundingBox->intersectsWith($bb)){\n\t\t\t\t\t\t\t\t$nearby[] = $ent;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}elseif($entity instanceof Entity and $ent !== $entity and $entity->canCollideWith($ent)){\n\t\t\t\t\t\t\tif($ent->boundingBox->intersectsWith($bb)){\n\t\t\t\t\t\t\t\t$nearby[] = $ent;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $nearby;\n\t}\n\n\t/**\n\t * Returns the entities near the current one inside the AxisAlignedBB\n\t *\n\t * @param AxisAlignedBB $bb\n\t * @param Entity        $entity\n\t *\n\t * @return Entity[]\n\t */\n\tpublic function getNearbyEntities(AxisAlignedBB $bb, Entity $entity = null) : array{\n\t\t$nearby = [];\n\n\t\t$minX = Math::floorFloat(($bb->minX - 2) / 16);\n\t\t$maxX = Math::ceilFloat(($bb->maxX + 2) / 16);\n\t\t$minZ = Math::floorFloat(($bb->minZ - 2) / 16);\n\t\t$maxZ = Math::ceilFloat(($bb->maxZ + 2) / 16);\n\n\t\tfor($x = $minX; $x <= $maxX; ++$x){\n\t\t\tfor($z = $minZ; $z <= $maxZ; ++$z){\n\t\t\t\tforeach($this->getChunkEntities($x, $z) as $ent){\n\t\t\t\t\tif($ent instanceof Player and $ent->isSpectator()){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif($ent !== $entity and $ent->boundingBox->intersectsWith($bb)){\n\t\t\t\t\t\t$nearby[] = $ent;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $nearby;\n\t}\n\n\tpublic function getNearbyExperienceOrb(AxisAlignedBB $bb) : array{\n\t\t$nearby = [];\n\n\t\tforeach($this->getNearbyEntities($bb) as $entity){\n\t\t\tif($entity instanceof XPOrb){\n\t\t\t\t$nearby[] = $entity;\n\t\t\t}\n\t\t}\n\n\t\treturn $nearby;\n\t}\n\n\t/**\n\t * Returns a list of the Tile entities in this level\n\t *\n\t * @return Tile[]\n\t */\n\tpublic function getTiles() : array{\n\t\treturn $this->tiles;\n\t}\n\n\t/**\n\t * @param $tileId\n\t *\n\t * @return Tile\n\t */\n\tpublic function getTileById(int $tileId){\n\t\treturn isset($this->tiles[$tileId]) ? $this->tiles[$tileId] : null;\n\t}\n\n\t/**\n\t * Returns a list of the players in this level\n\t *\n\t * @return Player[]\n\t */\n\tpublic function getPlayers() : array{\n\t\treturn $this->players;\n\t}\n\n\t/**\n\t * @return ChunkLoader[]\n\t */\n\tpublic function getLoaders() : array{\n\t\treturn $this->loaders;\n\t}\n\n\t/**\n\t * Returns the Tile in a position, or null if not found\n\t *\n\t * @param Vector3 $pos\n\t *\n\t * @return Tile\n\t */\n\tpublic function getTile(Vector3 $pos){\n\t\t$chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);\n\n\t\tif($chunk !== null){\n\t\t\treturn $chunk->getTile($pos->x & 0x0f, $pos->y & Level::Y_MASK, $pos->z & 0x0f);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Returns a list of the entities on a given chunk\n\t *\n\t * @param int $X\n\t * @param int $Z\n\t *\n\t * @return Entity[]\n\t */\n\tpublic function getChunkEntities($X, $Z) : array{\n\t\treturn ($chunk = $this->getChunk($X, $Z)) !== null ? $chunk->getEntities() : [];\n\t}\n\n\t/**\n\t * Gives a list of the Tile entities on a given chunk\n\t *\n\t * @param int $X\n\t * @param int $Z\n\t *\n\t * @return Tile[]\n\t */\n\tpublic function getChunkTiles($X, $Z) : array{\n\t\treturn ($chunk = $this->getChunk($X, $Z)) !== null ? $chunk->getTiles() : [];\n\t}\n\n\t/**\n\t * Gets the raw block id.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-255\n\t */\n\tpublic function getBlockIdAt(int $x, int $y, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getBlockId($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f);\n\t}\n\n\t/**\n\t * Sets the raw block id.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $id 0-255\n\t */\n\tpublic function setBlockIdAt(int $x, int $y, int $z, int $id){\n\t\tunset($this->blockCache[Level::blockHash($x, $y, $z)]);\n\t\t$this->getChunk($x >> 4, $z >> 4, true)->setBlockId($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f, $id & 0xff);\n\n\t\tif(!isset($this->changedBlocks[$index = Level::chunkHash($x >> 4, $z >> 4)])){\n\t\t\t$this->changedBlocks[$index] = [];\n\t\t}\n\t\t$this->changedBlocks[$index][Level::blockHash($x, $y, $z)] = $v = new Vector3($x, $y, $z);\n\t\tforeach($this->getChunkLoaders($x >> 4, $z >> 4) as $loader){\n\t\t\t$loader->onBlockChanged($v);\n\t\t}\n\t}\n\n\t/**\n\t * Gets the raw block extra data\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 16-bit\n\t */\n\tpublic function getBlockExtraDataAt(int $x, int $y, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getBlockExtraData($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f);\n\t}\n\n\t/**\n\t * Sets the raw block metadata.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $id\n\t * @param int $data\n\t */\n\tpublic function setBlockExtraDataAt(int $x, int $y, int $z, int $id, int $data){\n\t\t$this->getChunk($x >> 4, $z >> 4, true)->setBlockExtraData($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f, ($data << 8) | $id);\n\n\t\t$this->sendBlockExtraData($x, $y, $z, $id, $data);\n\t}\n\n\t/**\n\t * Gets the raw block metadata\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockDataAt(int $x, int $y, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getBlockData($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f);\n\t}\n\n\t/**\n\t * Sets the raw block metadata.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $data 0-15\n\t */\n\tpublic function setBlockDataAt(int $x, int $y, int $z, int $data){\n\t\tunset($this->blockCache[Level::blockHash($x, $y, $z)]);\n\t\t$this->getChunk($x >> 4, $z >> 4, true)->setBlockData($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f, $data & 0x0f);\n\n\t\tif(!isset($this->changedBlocks[$index = Level::chunkHash($x >> 4, $z >> 4)])){\n\t\t\t$this->changedBlocks[$index] = [];\n\t\t}\n\t\t$this->changedBlocks[$index][Level::blockHash($x, $y, $z)] = $v = new Vector3($x, $y, $z);\n\t\tforeach($this->getChunkLoaders($x >> 4, $z >> 4) as $loader){\n\t\t\t$loader->onBlockChanged($v);\n\t\t}\n\t}\n\n\t/**\n\t * Gets the raw block skylight level\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockSkyLightAt(int $x, int $y, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getBlockSkyLight($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f);\n\t}\n\n\t/**\n\t * Sets the raw block skylight level.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $level 0-15\n\t */\n\tpublic function setBlockSkyLightAt(int $x, int $y, int $z, int $level){\n\t\t$this->getChunk($x >> 4, $z >> 4, true)->setBlockSkyLight($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f, $level & 0x0f);\n\t}\n\n\t/**\n\t * Gets the raw block light level\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockLightAt(int $x, int $y, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getBlockLight($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f);\n\t}\n\n\t/**\n\t * Sets the raw block light level.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $level 0-15\n\t */\n\tpublic function setBlockLightAt(int $x, int $y, int $z, int $level){\n\t\t$this->getChunk($x >> 4, $z >> 4, true)->setBlockLight($x & 0x0f, $y & Level::Y_MASK, $z & 0x0f, $level & 0x0f);\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return int\n\t */\n\tpublic function getBiomeId(int $x, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getBiomeId($x & 0x0f, $z & 0x0f);\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return int\n\t */\n\tpublic function getHeightMap(int $x, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getHeightMap($x & 0x0f, $z & 0x0f);\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t * @param int $biomeId\n\t */\n\tpublic function setBiomeId(int $x, int $z, int $biomeId){\n\t\t$this->getChunk($x >> 4, $z >> 4, true)->setBiomeId($x & 0x0f, $z & 0x0f, $biomeId);\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t * @param int $value\n\t */\n\tpublic function setHeightMap(int $x, int $z, int $value){\n\t\t$this->getChunk($x >> 4, $z >> 4, true)->setHeightMap($x & 0x0f, $z & 0x0f, $value);\n\t}\n\n\t/**\n\t * @return Chunk[]\n\t */\n\tpublic function getChunks() : array{\n\t\treturn $this->chunks;\n\t}\n\n\t/**\n\t * Gets the Chunk object\n\t *\n\t * @param int  $x\n\t * @param int  $z\n\t * @param bool $create Whether to generate the chunk if it does not exist\n\t *\n\t * @return Chunk\n\t */\n\tpublic function getChunk(int $x, int $z, bool $create = false){\n\t\tif(isset($this->chunks[$index = Level::chunkHash($x, $z)])){\n\t\t\treturn $this->chunks[$index];\n\t\t}elseif($this->loadChunk($x, $z, $create)){\n\t\t\treturn $this->chunks[$index];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function generateChunkCallback(int $x, int $z, Chunk $chunk){\n\t\tTimings::$generationCallbackTimer->startTiming();\n\t\tif(isset($this->chunkPopulationQueue[$index = Level::chunkHash($x, $z)])){\n\t\t\t$oldChunk = $this->getChunk($x, $z, false);\n\t\t\tfor($xx = -1; $xx <= 1; ++$xx){\n\t\t\t\tfor($zz = -1; $zz <= 1; ++$zz){\n\t\t\t\t\tunset($this->chunkPopulationLock[Level::chunkHash($x + $xx, $z + $zz)]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tunset($this->chunkPopulationQueue[$index]);\n\t\t\t$chunk->setProvider($this->provider);\n\t\t\t$this->setChunk($x, $z, $chunk, false);\n\t\t\t$chunk = $this->getChunk($x, $z, false);\n\t\t\tif($chunk !== null and ($oldChunk === null or $oldChunk->isPopulated() === false) and $chunk->isPopulated() and $chunk->getProvider() !== null){\n\t\t\t\t$this->server->getPluginManager()->callEvent(new ChunkPopulateEvent($chunk));\n\n\t\t\t\tforeach($this->getChunkLoaders($x, $z) as $loader){\n\t\t\t\t\t$loader->onChunkPopulated($chunk);\n\t\t\t\t}\n\t\t\t}\n\t\t}elseif(isset($this->chunkGenerationQueue[$index]) or isset($this->chunkPopulationLock[$index])){\n\t\t\tunset($this->chunkGenerationQueue[$index]);\n\t\t\tunset($this->chunkPopulationLock[$index]);\n\t\t\t$chunk->setProvider($this->provider);\n\t\t\t$this->setChunk($x, $z, $chunk, false);\n\t\t}else{\n\t\t\t$chunk->setProvider($this->provider);\n\t\t\t$this->setChunk($x, $z, $chunk, false);\n\t\t}\n\t\tTimings::$generationCallbackTimer->stopTiming();\n\t}\n\n\t/**\n\t * @param int   $chunkX\n\t * @param int   $chunkZ\n\t * @param Chunk $chunk\n\t * @param bool  $unload\n\t */\n\tpublic function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null, bool $unload = true){\n\t\tif($chunk === null){\n\t\t\treturn;\n\t\t}\n\t\t$index = Level::chunkHash($chunkX, $chunkZ);\n\t\t$oldChunk = $this->getChunk($chunkX, $chunkZ, false);\n\t\tif($unload and $oldChunk !== null){\n\t\t\t$this->unloadChunk($chunkX, $chunkZ, false, false);\n\n\t\t\t$this->provider->setChunk($chunkX, $chunkZ, $chunk);\n\t\t\t$this->chunks[$index] = $chunk;\n\t\t}else{\n\t\t\t$oldEntities = $oldChunk !== null ? $oldChunk->getEntities() : [];\n\t\t\t$oldTiles = $oldChunk !== null ? $oldChunk->getTiles() : [];\n\n\t\t\t$this->provider->setChunk($chunkX, $chunkZ, $chunk);\n\t\t\t$this->chunks[$index] = $chunk;\n\n\t\t\tforeach($oldEntities as $entity){\n\t\t\t\t$chunk->addEntity($entity);\n\t\t\t\t$entity->chunk = $chunk;\n\t\t\t}\n\n\t\t\tforeach($oldTiles as $tile){\n\t\t\t\t$chunk->addTile($tile);\n\t\t\t\t$tile->chunk = $chunk;\n\t\t\t}\n\t\t}\n\n\t\tunset($this->chunkCache[$index]);\n\t\t$chunk->setChanged();\n\n\t\tif(!$this->isChunkInUse($chunkX, $chunkZ)){\n\t\t\t$this->unloadChunkRequest($chunkX, $chunkZ);\n\t\t}else{\n\t\t\tforeach($this->getChunkLoaders($chunkX, $chunkZ) as $loader){\n\t\t\t\t$loader->onChunkChanged($chunk);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Directly send a lightning to a player\n\t *\n\t * @deprecated\n\t *\n\t * @param int    $x\n\t * @param int    $y\n\t * @param int    $z\n\t * @param Player $p\n\t */\n\tpublic function sendLighting(int $x, int $y, int $z, Player $p){\n\t\t$pk = new AddEntityPacket();\n\t\t$pk->type = Lightning::NETWORK_ID;\n\t\t$pk->eid = mt_rand(10000000, 100000000);\n\t\t$pk->x = $x;\n\t\t$pk->y = $y;\n\t\t$pk->z = $z;\n\t\t$pk->metadata = array(3, 3, 3, 3);\n\t\t$p->dataPacket($pk);\n\t}\n\n\t/**\n\t * Add a lightning\n\t *\n\t * @param Vector3 $pos\n\t * @return Lightning\n\t */\n\tpublic function spawnLightning(Vector3 $pos) : Lightning{\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\tnew DoubleTag(\"\", $pos->getX()),\n\t\t\t\tnew DoubleTag(\"\", $pos->getY()),\n\t\t\t\tnew DoubleTag(\"\", $pos->getZ())\n\t\t\t]),\n\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t]),\n\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t]),\n\t\t]);\n\n\t\t$chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);\n\n\t\t$lightning = new Lightning($chunk, $nbt);\n\t\t$lightning->spawnToAll();\n\n\t\treturn $lightning;\n\t}\n\n\t/**\n\t * Add an experience orb\n\t *\n\t * @param Vector3 $pos\n\t * @param int     $exp\n\t * @return bool|XPOrb\n\t */\n\tpublic function spawnXPOrb(Vector3 $pos, int $exp = 1){\n\t\tif($exp > 0){\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\tnew DoubleTag(\"\", $pos->getX()),\n\t\t\t\t\tnew DoubleTag(\"\", $pos->getY() + 0.5),\n\t\t\t\t\tnew DoubleTag(\"\", $pos->getZ())\n\t\t\t\t]),\n\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\tnew FloatTag(\"\", 0),\n\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t\t\"Experience\" => new LongTag(\"Experience\", $exp),\n\t\t\t]);\n\n\t\t\t$chunk = $this->getChunk($pos->x >> 4, $pos->z >> 4, false);\n\n\t\t\t$expOrb = new XPOrb($chunk, $nbt);\n\t\t\t$expOrb->spawnToAll();\n\n\t\t\treturn $expOrb;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Gets the highest block Y value at a specific $x and $z\n\t *\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return int 0-255\n\t */\n\tpublic function getHighestBlockAt(int $x, int $z) : int{\n\t\treturn $this->getChunk($x >> 4, $z >> 4, true)->getHighestBlockAt($x & 0x0f, $z & 0x0f);\n\t}\n\n\tpublic function canBlockSeeSky(Vector3 $pos) : bool{\n\t\treturn $this->getHighestBlockAt($pos->getFloorX(), $pos->getFloorZ()) < $pos->getY();\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return bool\n\t */\n\tpublic function isChunkLoaded(int $x, int $z) : bool{\n\t\treturn isset($this->chunks[Level::chunkHash($x, $z)]) or $this->provider->isChunkLoaded($x, $z);\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return bool\n\t */\n\tpublic function isChunkGenerated(int $x, int $z) : bool{\n\t\t$chunk = $this->getChunk($x, $z);\n\t\treturn $chunk !== null ? $chunk->isGenerated() : false;\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return bool\n\t */\n\tpublic function isChunkPopulated(int $x, int $z) : bool{\n\t\t$chunk = $this->getChunk($x, $z);\n\t\treturn $chunk !== null ? $chunk->isPopulated() : false;\n\t}\n\n\t/**\n\t * Returns a Position pointing to the spawn\n\t *\n\t * @return Position\n\t */\n\tpublic function getSpawnLocation(): Position{\n\t\treturn Position::fromObject($this->provider->getSpawn(), $this);\n\t}\n\n\t/**\n\t * Sets the level spawn location\n\t *\n\t * @param Vector3 $pos\n\t */\n\tpublic function setSpawnLocation(Vector3 $pos){\n\t\t$previousSpawn = $this->getSpawnLocation();\n\t\t$this->provider->setSpawn($pos);\n\t\t$this->server->getPluginManager()->callEvent(new SpawnChangeEvent($this, $previousSpawn));\n\t}\n\n\tpublic function requestChunk(int $x, int $z, Player $player){\n\t\t$index = Level::chunkHash($x, $z);\n\t\tif(!isset($this->chunkSendQueue[$index])){\n\t\t\t$this->chunkSendQueue[$index] = [];\n\t\t}\n\n\t\t$this->chunkSendQueue[$index][$player->getLoaderId()] = $player;\n\t}\n\n\tprivate function sendChunkFromCache($x, $z){\n\t\tif(isset($this->chunkSendTasks[$index = Level::chunkHash($x, $z)])){\n\t\t\tforeach($this->chunkSendQueue[$index] as $player){\n\t\t\t\t/** @var Player $player */\n\t\t\t\tif($player->isConnected() and isset($player->usedChunks[$index])){\n\t\t\t\t\t$player->sendChunk($x, $z, $this->chunkCache[$index]);\n\t\t\t\t}\n\t\t\t}\n\t\t\tunset($this->chunkSendQueue[$index]);\n\t\t\tunset($this->chunkSendTasks[$index]);\n\t\t}\n\t}\n\n\tprivate function processChunkRequest(){\n\t\tif(count($this->chunkSendQueue) > 0){\n\t\t\t$this->timings->syncChunkSendTimer->startTiming();\n\n\t\t\t$x = null;\n\t\t\t$z = null;\n\t\t\tforeach($this->chunkSendQueue as $index => $players){\n\t\t\t\tif(isset($this->chunkSendTasks[$index])){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tLevel::getXZ($index, $x, $z);\n\t\t\t\t$this->chunkSendTasks[$index] = true;\n\t\t\t\tif(isset($this->chunkCache[$index])){\n\t\t\t\t\t$this->sendChunkFromCache($x, $z);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$this->timings->syncChunkSendPrepareTimer->startTiming();\n\t\t\t\t$task = $this->provider->requestChunkTask($x, $z);\n\t\t\t\tif($task !== null){\n\t\t\t\t\t$this->server->getScheduler()->scheduleAsyncTask($task);\n\t\t\t\t}\n\t\t\t\t$this->timings->syncChunkSendPrepareTimer->stopTiming();\n\t\t\t}\n\n\t\t\t$this->timings->syncChunkSendTimer->stopTiming();\n\t\t}\n\t}\n\n\tpublic function chunkRequestCallback(int $x, int $z, string $payload){\n\t\t$this->timings->syncChunkSendTimer->startTiming();\n\n\t\t$index = Level::chunkHash($x, $z);\n\n\t\tif(!isset($this->chunkCache[$index]) and $this->cacheChunks and $this->server->getMemoryManager()->canUseChunkCache()){\n\t\t\t$this->chunkCache[$index] = Level::getChunkCacheFromData($x, $z, $payload);\n\t\t\t$this->sendChunkFromCache($x, $z);\n\t\t\t$this->timings->syncChunkSendTimer->stopTiming();\n\t\t\treturn;\n\t\t}\n\n\t\tif(isset($this->chunkSendTasks[$index])){\n\t\t\tforeach($this->chunkSendQueue[$index] as $player){\n\t\t\t\t/** @var Player $player */\n\t\t\t\tif($player->isConnected() and isset($player->usedChunks[$index])){\n\t\t\t\t\t$player->sendChunk($x, $z, $payload);\n\t\t\t\t}\n\t\t\t}\n\t\t\tunset($this->chunkSendQueue[$index]);\n\t\t\tunset($this->chunkSendTasks[$index]);\n\t\t}\n\t\t$this->timings->syncChunkSendTimer->stopTiming();\n\t}\n\n\t/**\n\t * Removes the entity from the level index\n\t *\n\t * @param Entity $entity\n\t *\n\t * @throws LevelException\n\t */\n\tpublic function removeEntity(Entity $entity){\n\t\tif($entity->getLevel() !== $this){\n\t\t\tthrow new LevelException(\"Invalid Entity level\");\n\t\t}\n\n\t\tif($entity instanceof Player){\n\t\t\tunset($this->players[$entity->getId()]);\n\t\t\t$this->checkSleep();\n\t\t}else{\n\t\t\t$entity->close();\n\t\t}\n\n\t\tunset($this->entities[$entity->getId()]);\n\t\tunset($this->updateEntities[$entity->getId()]);\n\t}\n\n\t/**\n\t * @param Entity $entity\n\t *\n\t * @throws LevelException\n\t */\n\tpublic function addEntity(Entity $entity){\n\t\tif($entity->getLevel() !== $this){\n\t\t\tthrow new LevelException(\"Invalid Entity level\");\n\t\t}\n\t\tif($entity instanceof Player){\n\t\t\t$this->players[$entity->getId()] = $entity;\n\t\t}\n\t\t$this->entities[$entity->getId()] = $entity;\n\t}\n\n\t/**\n\t * @param Tile $tile\n\t *\n\t * @throws LevelException\n\t */\n\tpublic function addTile(Tile $tile){\n\t\tif($tile->getLevel() !== $this){\n\t\t\tthrow new LevelException(\"Invalid Tile level\");\n\t\t}\n\t\t$this->tiles[$tile->getId()] = $tile;\n\t\t$this->clearChunkCache($tile->getX() >> 4, $tile->getZ() >> 4);\n\t}\n\n\t/**\n\t * @param Tile $tile\n\t *\n\t * @throws LevelException\n\t */\n\tpublic function removeTile(Tile $tile){\n\t\tif($tile->getLevel() !== $this){\n\t\t\tthrow new LevelException(\"Invalid Tile level\");\n\t\t}\n\n\t\tunset($this->tiles[$tile->getId()]);\n\t\tunset($this->updateTiles[$tile->getId()]);\n\t\t$this->clearChunkCache($tile->getX() >> 4, $tile->getZ() >> 4);\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return bool\n\t */\n\tpublic function isChunkInUse(int $x, int $z) : bool{\n\t\treturn isset($this->chunkLoaders[$index = Level::chunkHash($x, $z)]) and count($this->chunkLoaders[$index]) > 0;\n\t}\n\n\t/**\n\t * @param int  $x\n\t * @param int  $z\n\t * @param bool $generate\n\t *\n\t * @return bool\n\t */\n\tpublic function loadChunk(int $x, int $z, bool $generate = true) : bool{\n\t\tif(isset($this->chunks[$index = Level::chunkHash($x, $z)])){\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->timings->syncChunkLoadTimer->startTiming();\n\n\t\t$this->cancelUnloadChunkRequest($x, $z);\n\n\t\t$chunk = $this->provider->getChunk($x, $z, $generate);\n\t\tif($chunk === null){\n\t\t\tif($generate){\n\t\t\t\tthrow new \\InvalidStateException(\"Could not create new Chunk\");\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->chunks[$index] = $chunk;\n\t\t$chunk->initChunk();\n\n\t\tif($chunk->getProvider() !== null){\n\t\t\t$this->server->getPluginManager()->callEvent(new ChunkLoadEvent($chunk, !$chunk->isGenerated()));\n\t\t}else{\n\t\t\t$this->unloadChunk($x, $z, false);\n\t\t\t$this->timings->syncChunkLoadTimer->stopTiming();\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!$chunk->isLightPopulated() and $chunk->isPopulated() and $this->getServer()->getProperty(\"chunk-ticking.light-updates\", false)){\n\t\t\t$this->getServer()->getScheduler()->scheduleAsyncTask(new LightPopulationTask($this, $chunk));\n\t\t}\n\n\t\tif($this->isChunkInUse($x, $z)){\n\t\t\tforeach($this->getChunkLoaders($x, $z) as $loader){\n\t\t\t\t$loader->onChunkLoaded($chunk);\n\t\t\t}\n\t\t}else{\n\t\t\t$this->unloadChunkRequest($x, $z);\n\t\t}\n\n\t\t$this->timings->syncChunkLoadTimer->stopTiming();\n\n\t\treturn true;\n\t}\n\n\tprivate function queueUnloadChunk(int $x, int $z){\n\t\t$this->unloadQueue[$index = Level::chunkHash($x, $z)] = microtime(true);\n\t\tunset($this->chunkTickList[$index]);\n\t}\n\n\tpublic function unloadChunkRequest(int $x, int $z, bool $safe = true) : bool{\n\t\tif(($safe === true and $this->isChunkInUse($x, $z)) or $this->isSpawnChunk($x, $z)){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->queueUnloadChunk($x, $z);\n\n\t\treturn true;\n\t}\n\n\tpublic function cancelUnloadChunkRequest(int $x, int $z){\n\t\tunset($this->unloadQueue[Level::chunkHash($x, $z)]);\n\t}\n\n\tpublic function unloadChunk(int $x, int $z, bool $safe = true, bool $trySave = true) : bool{\n\t\tif(($safe === true and $this->isChunkInUse($x, $z))){\n\t\t\treturn false;\n\t\t}\n\n\t\tif(!$this->isChunkLoaded($x, $z)){\n\t\t\treturn true;\n\t\t}\n\n\t\t$this->timings->doChunkUnload->startTiming();\n\n\t\t$index = Level::chunkHash($x, $z);\n\n\t\t$chunk = $this->getChunk($x, $z);\n\n\t\tif($chunk !== null and $chunk->getProvider() !== null){\n\t\t\t$this->server->getPluginManager()->callEvent($ev = new ChunkUnloadEvent($chunk));\n\t\t\tif($ev->isCancelled()){\n\t\t\t\t$this->timings->doChunkUnload->stopTiming();\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\ttry{\n\t\t\tif($chunk !== null){\n\t\t\t\tif($trySave and $this->getAutoSave()){\n\t\t\t\t\t$entities = 0;\n\t\t\t\t\tforeach($chunk->getEntities() as $e){\n\t\t\t\t\t\tif($e instanceof Player){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t++$entities;\n\t\t\t\t\t}\n\n\t\t\t\t\tif($chunk->hasChanged() or count($chunk->getTiles()) > 0 or $entities > 0){\n\t\t\t\t\t\t$this->provider->setChunk($x, $z, $chunk);\n\t\t\t\t\t\t$this->provider->saveChunk($x, $z);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tforeach($this->getChunkLoaders($x, $z) as $loader){\n\t\t\t\t\t$loader->onChunkUnloaded($chunk);\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->provider->unloadChunk($x, $z, $safe);\n\t\t}catch(\\Throwable $e){\n\t\t\t$logger = $this->server->getLogger();\n\t\t\t$logger->error($this->server->getLanguage()->translateString(\"pocketmine.level.chunkUnloadError\", [$e->getMessage()]));\n\t\t\t$logger->logException($e);\t\n\t\t}\n\n\t\tunset($this->chunks[$index]);\n\t\tunset($this->chunkTickList[$index]);\n\t\tunset($this->chunkCache[$index]);\n\n\t\t$this->timings->doChunkUnload->stopTiming();\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * Returns true if the spawn is part of the spawn\n\t *\n\t * @param int $X\n\t * @param int $Z\n\t *\n\t * @return bool\n\t */\n\tpublic function isSpawnChunk(int $X, int $Z) : bool{\n\t\t$spawnX = $this->provider->getSpawn()->getX() >> 4;\n\t\t$spawnZ = $this->provider->getSpawn()->getZ() >> 4;\n\n\t\treturn abs($X - $spawnX) <= 1 and abs($Z - $spawnZ) <= 1;\n\t}\n\n\t/**\n\t * @param Vector3 $spawn default null\n\t *\n\t * @return bool|Position\n\t */\n\tpublic function getSafeSpawn($spawn = null){\n\t\tif(!($spawn instanceof Vector3) or $spawn->y < 1){\n\t\t\t$spawn = $this->getSpawnLocation();\n\t\t}\n\t\tif($spawn instanceof Vector3){\n\t\t\t$max = $this->provider->getWorldHeight();\n\t\t\t$v = $spawn->floor();\n\t\t\t$chunk = $this->getChunk($v->x >> 4, $v->z >> 4, false);\n\t\t\t$x = $v->x & 0x0f;\n\t\t\t$z = $v->z & 0x0f;\n\t\t\tif($chunk !== null){\n\t\t\t\t$y = (int) min($max - 2, $v->y);\n\t\t\t\t$wasAir = ($chunk->getBlockId($x, $y - 1, $z) === 0);\n\t\t\t\tfor(; $y > 0; --$y){\n\t\t\t\t\t$b = $chunk->getFullBlock($x, $y, $z);\n\t\t\t\t\t$block = Block::get($b >> 4, $b & 0x0f);\n\t\t\t\t\tif($this->isFullBlock($block)){\n\t\t\t\t\t\tif($wasAir){\n\t\t\t\t\t\t\t$y++;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$wasAir = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tfor(; $y >= 0 and $y < $max; ++$y){\n\t\t\t\t\t$b = $chunk->getFullBlock($x, $y + 1, $z);\n\t\t\t\t\t$block = Block::get($b >> 4, $b & 0x0f);\n\t\t\t\t\tif(!$this->isFullBlock($block)){\n\t\t\t\t\t\t$b = $chunk->getFullBlock($x, $y, $z);\n\t\t\t\t\t\t$block = Block::get($b >> 4, $b & 0x0f);\n\t\t\t\t\t\tif(!$this->isFullBlock($block)){\n\t\t\t\t\t\t\treturn new Position($spawn->x, $y === (int) $spawn->y ? $spawn->y : $y, $spawn->z, $this);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t++$y;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$v->y = $y;\n\t\t\t}\n\n\t\t\treturn new Position($spawn->x, $v->y, $spawn->z, $this);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Gets the current time\n\t *\n\t * @return int\n\t */\n\tpublic function getTime() : int{\n\t\treturn $this->time;\n\t}\n\n\t/**\n\t * Returns the Level name\n\t *\n\t * @return string\n\t */\n\tpublic function getName() : string{\n\t\treturn $this->provider->getName();\n\t}\n\n\t/**\n\t * Returns the Level folder name\n\t *\n\t * @return string\n\t */\n\tpublic function getFolderName() : string{\n\t\treturn $this->folderName;\n\t}\n\n\t/**\n\t * Sets the current time on the level\n\t *\n\t * @param int $time\n\t */\n\tpublic function setTime(int $time){\n\t\t$this->time = $time;\n\t\t$this->sendTime();\n\t}\n\n\t/**\n\t * Stops the time for the level, will not save the lock state to disk\n\t */\n\tpublic function stopTime(){\n\t\t$this->stopTime = true;\n\t\t$this->sendTime();\n\t}\n\n\t/**\n\t * Start the time again, if it was stopped\n\t */\n\tpublic function startTime(){\n\t\t$this->stopTime = false;\n\t\t$this->sendTime();\n\t}\n\n\t/**\n\t * Gets the level seed\n\t *\n\t * @return int|string\n\t */\n\tpublic function getSeed(){\n\t\treturn $this->provider->getSeed();\n\t}\n\n\t/**\n\t * Sets the seed for the level\n\t *\n\t * @param int $seed\n\t */\n\tpublic function setSeed(int $seed){\n\t\t$this->provider->setSeed($seed);\n\t}\n\n\tpublic function populateChunk(int $x, int $z, bool $force = false) : bool{\n\t\tif(isset($this->chunkPopulationQueue[$index = Level::chunkHash($x, $z)]) or (count($this->chunkPopulationQueue) >= $this->chunkPopulationQueueSize and !$force)){\n\t\t\treturn false;\n\t\t}\n\n\t\t$chunk = $this->getChunk($x, $z, true);\n\t\tif(!$chunk->isPopulated()){\n\t\t\tTimings::$populationTimer->startTiming();\n\t\t\t$populate = true;\n\t\t\tfor($xx = -1; $xx <= 1; ++$xx){\n\t\t\t\tfor($zz = -1; $zz <= 1; ++$zz){\n\t\t\t\t\tif(isset($this->chunkPopulationLock[Level::chunkHash($x + $xx, $z + $zz)])){\n\t\t\t\t\t\t$populate = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($populate){\n\t\t\t\tif(!isset($this->chunkPopulationQueue[$index])){\n\t\t\t\t\t$this->chunkPopulationQueue[$index] = true;\n\t\t\t\t\tfor($xx = -1; $xx <= 1; ++$xx){\n\t\t\t\t\t\tfor($zz = -1; $zz <= 1; ++$zz){\n\t\t\t\t\t\t\t$this->chunkPopulationLock[Level::chunkHash($x + $xx, $z + $zz)] = true;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$task = new PopulationTask($this, $chunk);\n\t\t\t\t\t$this->server->getScheduler()->scheduleAsyncTask($task);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tTimings::$populationTimer->stopTiming();\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function generateChunk(int $x, int $z, bool $force = false){\n\t\tif(count($this->chunkGenerationQueue) >= $this->chunkGenerationQueueSize and !$force){\n\t\t\treturn;\n\t\t}\n\n\t\tif(!isset($this->chunkGenerationQueue[$index = Level::chunkHash($x, $z)])){\n\t\t\tTimings::$generationTimer->startTiming();\n\t\t\t$this->chunkGenerationQueue[$index] = true;\n\t\t\t$task = new GenerationTask($this, $this->getChunk($x, $z, true));\n\t\t\t$this->server->getScheduler()->scheduleAsyncTask($task);\n\t\t\tTimings::$generationTimer->stopTiming();\n\t\t}\n\t}\n\n\tpublic function regenerateChunk(int $x, int $z){\n\t\t$this->unloadChunk($x, $z, false);\n\n\t\t$this->cancelUnloadChunkRequest($x, $z);\n\n\t\t$this->generateChunk($x, $z);\n\t\t//TODO: generate & refresh chunk from the generator object\n\t}\n\n\tpublic function doChunkGarbageCollection(){\n\t\t$this->timings->doChunkGC->startTiming();\n\n\t\t$X = null;\n\t\t$Z = null;\n\n\t\tforeach($this->chunks as $index => $chunk){\n\t\t\tif(!isset($this->unloadQueue[$index])){\n\t\t\t\tLevel::getXZ($index, $X, $Z);\n\t\t\t\tif(!$this->isSpawnChunk($X, $Z)){\n\t\t\t\t\t$this->unloadChunkRequest($X, $Z, true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->provider->getLoadedChunks() as $chunk){\n\t\t\tif(!isset($this->chunks[Level::chunkHash($chunk->getX(), $chunk->getZ())])){\n\t\t\t\t$this->provider->unloadChunk($chunk->getX(), $chunk->getZ(), false);\n\t\t\t}\n\t\t}\n\n\t\t$this->provider->doGarbageCollection();\n\n\t\t$this->timings->doChunkGC->stopTiming();\n\t}\n\n\tpublic function unloadChunks(bool $force = false){\n\t\tif(count($this->unloadQueue) > 0){\n\t\t\t$maxUnload = 96;\n\t\t\t$now = microtime(true);\n\t\t\tforeach($this->unloadQueue as $index => $time){\n\t\t\t\tLevel::getXZ($index, $X, $Z);\n\n\t\t\t\tif(!$force){\n\t\t\t\t\tif($maxUnload <= 0){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}elseif($time > ($now - 30)){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t//If the chunk can't be unloaded, it stays on the queue\n\t\t\t\tif($this->unloadChunk($X, $Z, true)){\n\t\t\t\t\tunset($this->unloadQueue[$index]);\n\t\t\t\t\t--$maxUnload;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\t\n\t/**\n\t * @param int    $chunkX\n\t * @param int    $chunkZ\n\t * @param string $payload\n\t *\n\t * @return DataPacket\n\t */\n\tpublic static function getChunkCacheFromData($chunkX, $chunkZ, $payload){\n\t\t$pk = new FullChunkDataPacket();\n\t\t$pk->chunkX = $chunkX;\n\t\t$pk->chunkZ = $chunkZ;\n\t\t$pk->data = $payload;\n\t\t$pk->encode();\n\n\t\t$batch = new BatchPacket();\n\t\t$batch->payload = zlib_encode(Binary::writeUnsignedVarInt(strlen($pk->getBuffer())) . $pk->getBuffer(), ZLIB_ENCODING_DEFLATE, Server::getInstance()->networkCompressionLevel);\n\t\t$batch->encode();\n\t\t$batch->isEncoded = true;\n\t\treturn $batch;\n\t}\n\n\tpublic function setMetadata($metadataKey, MetadataValue $metadataValue){\n\t\t$this->server->getLevelMetadata()->setMetadata($this, $metadataKey, $metadataValue);\n\t}\n\n\tpublic function getMetadata($metadataKey){\n\t\treturn $this->server->getLevelMetadata()->getMetadata($this, $metadataKey);\n\t}\n\n\tpublic function hasMetadata($metadataKey){\n\t\treturn $this->server->getLevelMetadata()->hasMetadata($this, $metadataKey);\n\t}\n\n\tpublic function removeMetadata($metadataKey, Plugin $plugin){\n\t\t$this->server->getLevelMetadata()->removeMetadata($this, $metadataKey, $plugin);\n\t}\n\n\tpublic function addEntityMotion(int $chunkX, int $chunkZ, int $entityId, float $x, float $y, float $z){\n\t\tif(!isset($this->motionToSend[$index = Level::chunkHash($chunkX, $chunkZ)])){\n\t\t\t$this->motionToSend[$index] = [];\n\t\t}\n\t\t$this->motionToSend[$index][$entityId] = [$entityId, $x, $y, $z];\n\t}\n\n\tpublic function addEntityMovement(int $chunkX, int $chunkZ, int $entityId, float $x, float $y, float $z, float $yaw, float $pitch, $headYaw = null){\n\t\tif(!isset($this->moveToSend[$index = Level::chunkHash($chunkX, $chunkZ)])){\n\t\t\t$this->moveToSend[$index] = [];\n\t\t}\n\n\t\t$pk = new MoveEntityPacket();\n\t\t$pk->eid = $entityId;\n\t\t$pk->x = $x;\n\t\t$pk->y = $y;\n\t\t$pk->z = $z;\n\t\t$pk->yaw = $yaw;\n\t\t$pk->headYaw = $headYaw === null ? $yaw : $headYaw;\n\t\t$pk->pitch = $pitch;\n\t\t$this->moveToSend[$index][$entityId] = $pk;\n\t}\n\n\tpublic function addPlayerMovement($chunkX, $chunkZ, $entityId, $x, $y, $z, $yaw, $pitch, $onGround, $headYaw = null){\n\t\tif(!isset($this->moveToSend[$index = Level::chunkHash($chunkX, $chunkZ)])){\n\t\t\t$this->moveToSend[$index] = [];\n\t\t}\n\n\t\t$pk = new MovePlayerPacket();\n\t\t$pk->eid = $entityId;\n\t\t$pk->x = $x;\n\t\t$pk->y = $y;\n\t\t$pk->z = $z;\n\t\t$pk->yaw = $headYaw === null ? $yaw : $headYaw;\n\t\t$pk->bodyYaw = $yaw;\n\t\t$pk->pitch = $pitch;\n\t\t$pk->onGround = $onGround;\n\t\t$pk->mode = MovePlayerPacket::MODE_NORMAL;\n\t\t$this->moveToSend[$index][$entityId] = $pk;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/LevelException.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\utils\\ServerException;\n\nclass LevelException extends ServerException{\n\n}"
  },
  {
    "path": "src/pocketmine/level/Location.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\math\\Vector3;\n\nclass Location extends Position{\n\n\tpublic $yaw;\n\tpublic $pitch;\n\n\t/**\n\t * @param int   $x\n\t * @param int   $y\n\t * @param int   $z\n\t * @param float $yaw\n\t * @param float $pitch\n\t * @param Level $level\n\t */\n\tpublic function __construct($x = 0, $y = 0, $z = 0, $yaw = 0.0, $pitch = 0.0, Level $level = null){\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t\t$this->z = $z;\n\t\t$this->yaw = $yaw;\n\t\t$this->pitch = $pitch;\n\t\t$this->level = $level;\n\t}\n\n\t/**\n\t * @param Vector3    $pos\n\t * @param Level|null $level default null\n\t * @param float      $yaw   default 0.0\n\t * @param float      $pitch default 0.0\n\t *\n\t * @return Location\n\t */\n\tpublic static function fromObject(Vector3 $pos, Level $level = null, $yaw = 0.0, $pitch = 0.0){\n\t\treturn new Location($pos->x, $pos->y, $pos->z, $yaw, $pitch, ($level === null) ? (($pos instanceof Position) ? $pos->level : null) : $level);\n\t}\n\n\tpublic function add($x, $y = 0, $z = 0, $yaw = 0, $pitch = 0){\n\t\tif($x instanceof Location){\n\t\t\treturn new Location($this->x + $x->x, $this->y + $x->y, $this->z + $x->z, $this->yaw + $x->yaw, $this->pitch + $x->pitch, $this->level);\n\t\t}else{\n\t\t\treturn new Location($this->x + $x, $this->y + $y, $this->z + $z, $this->yaw + $yaw, $this->pitch + $pitch, $this->level);\n\t\t}\n\t}\n\n\tpublic function getYaw(){\n\t\treturn $this->yaw;\n\t}\n\n\tpublic function getPitch(){\n\t\treturn $this->pitch;\n\t}\n\n\tpublic function fromObjectAdd(Vector3 $pos, $x, $y, $z){\n\t\tif($pos instanceof Location){\n\t\t\t$this->yaw = $pos->yaw;\n\t\t\t$this->pitch = $pos->pitch;\n\t\t}\n\t\tparent::fromObjectAdd($pos, $x, $y, $z);\n\t\treturn $this;\n\t}\n\n\tpublic function __toString(){\n\t\treturn \"Location (level=\" . ($this->isValid() ? $this->getLevel()->getName() : \"null\") . \", x=$this->x, y=$this->y, z=$this->z, yaw=$this->yaw, pitch=$this->pitch)\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/MovingObjectPosition.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\math\\Vector3;\n\nclass MovingObjectPosition{\n\n\t/** 0 = block, 1 = entity */\n\tpublic $typeOfHit;\n\n\tpublic $blockX;\n\tpublic $blockY;\n\tpublic $blockZ;\n\n\t/**\n\t * Which side was hit. If its -1 then it went the full length of the ray trace.\n\t * Bottom = 0, Top = 1, East = 2, West = 3, North = 4, South = 5.\n\t */\n\tpublic $sideHit;\n\n\t/** @var Vector3 */\n\tpublic $hitVector;\n\n\t/** @var Entity */\n\tpublic $entityHit = null;\n\n\tprotected function __construct(){\n\n\t}\n\n\t/**\n\t * @param int     $x\n\t * @param int     $y\n\t * @param int     $z\n\t * @param int     $side\n\t * @param Vector3 $hitVector\n\t *\n\t * @return MovingObjectPosition\n\t */\n\tpublic static function fromBlock($x, $y, $z, $side, Vector3 $hitVector){\n\t\t$ob = new MovingObjectPosition;\n\t\t$ob->typeOfHit = 0;\n\t\t$ob->blockX = $x;\n\t\t$ob->blockY = $y;\n\t\t$ob->blockZ = $z;\n\t\t$ob->hitVector = new Vector3($hitVector->x, $hitVector->y, $hitVector->z);\n\t\treturn $ob;\n\t}\n\n\t/**\n\t * @param Entity $entity\n\t *\n\t * @return MovingObjectPosition\n\t */\n\tpublic static function fromEntity(Entity $entity){\n\t\t$ob = new MovingObjectPosition;\n\t\t$ob->typeOfHit = 1;\n\t\t$ob->entityHit = $entity;\n\t\t$ob->hitVector = new Vector3($entity->x, $entity->y, $entity->z);\n\t\treturn $ob;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/Position.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\utils\\MainLogger;\n\nclass Position extends Vector3{\n\n\t/** @var Level */\n\tpublic $level = null;\n\n\t/**\n\t * @param int   $x\n\t * @param int   $y\n\t * @param int   $z\n\t * @param Level $level\n\t */\n\tpublic function __construct($x = 0, $y = 0, $z = 0, Level $level = null){\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t\t$this->z = $z;\n\t\t$this->level = $level;\n\t}\n\n\tpublic static function fromObject(Vector3 $pos, Level $level = null){\n\t\treturn new Position($pos->x, $pos->y, $pos->z, $level);\n\t}\n\t\n\tpublic function add($x, $y = 0, $z = 0){\n\t\tif($x instanceof Vector3){\n\t\t\treturn new Position($this->x + $x->x, $this->y + $x->y, $this->z + $x->z, $this->level);\n\t\t}else{\n\t\t\treturn new Position($this->x + $x, $this->y + $y, $this->z + $z, $this->level);\n\t\t}\n\t}\n\n\t/**\n\t * @return Level\n\t */\n\tpublic function getLevel(){\n\t\tif($this->level !== null and $this->level->isClosed()){\n\t\t\tMainLogger::getLogger()->debug(\"Position was holding a reference to an unloaded Level\");\n\t\t\t$this->level = null;\n\t\t}\n \n\t\treturn $this->level;\n\t}\n\n\t/**\n\t * Sets the target Level of the position.\n\t *\n\t * @param Level|null $level\n\t *\n\t * @return $this\n\t *\n\t * @throws \\InvalidArgumentException if the specified Level has been closed\n\t */\n\tpublic function setLevel(Level $level = null){\n\t\tif($level !== null and $level->isClosed()){\n\t\t\tthrow new \\InvalidArgumentException(\"Specified level has been unloaded and cannot be used\");\n\t\t}\n \n\t\t$this->level = $level;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Checks if this object has a valid reference to a loaded Level\n\t *\n\t * @return bool\n\t */\n\tpublic function isValid(){\n\t\treturn $this->getLevel() instanceof Level;\n\t}\n\n\t/**\n\t * Returns a side Vector\n\t *\n\t * @param int $side\n\t * @param int $step\n\t *\n\t * @return Position\n\t *\n\t * @throws LevelException\n\t */\n\tpublic function getSide($side, $step = 1){\n\t\tif(!$this->isValid()){\n\t\t\tthrow new LevelException(\"Undefined Level reference\");\n\t\t}\n\n\t\treturn Position::fromObject(parent::getSide($side, $step), $this->level);\n\t}\n\n\tpublic function __toString(){\n\t\treturn \"Position(level=\" . ($this->isValid() ? $this->getLevel()->getName() : \"null\") . \",x=\" . $this->x . \",y=\" . $this->y . \",z=\" . $this->z . \")\";\n\t}\n\n\t/**\n\t * @param $x\n\t * @param $y\n\t * @param $z\n\t *\n\t * @return Position\n\t */\n\tpublic function setComponents($x, $y, $z){\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t\t$this->z = $z;\n\t\treturn $this;\n\t}\n\n\tpublic function fromObjectAdd(Vector3 $pos, $x, $y, $z){\n\t\tif($pos instanceof Position){\n\t\t\t$this->level = $pos->level;\n\t\t}\n\t\tparent::fromObjectAdd($pos, $x, $y, $z);\n\t\treturn $this;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/SimpleChunkManager.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types=1);\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\math\\Vector3;\n\nclass SimpleChunkManager implements ChunkManager{\n\n\t/** @var Chunk[] */\n\tprotected $chunks = [];\n\n\tprotected $seed;\n\tprotected $waterHeight = 0;\n\n\tpublic function __construct($seed, $waterHeight = 0){\n\t\t$this->seed = $seed;\n\t\t$this->waterHeight = $waterHeight;\n\t}\n\n\tpublic function getWaterHeight() : int{\n\t\treturn $this->waterHeight;\n\t}\n\n\t/**\n\t * Gets the raw block id.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-255\n\t */\n\tpublic function getBlockIdAt(int $x, int $y, int $z) : int{\n\t\tif($chunk = $this->getChunk($x >> 4, $z >> 4)){\n\t\t\treturn $chunk->getBlockId($x & 0xf, $y & Level::Y_MASK, $z & 0xf);\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Sets the raw block id.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $id 0-255\n\t */\n\tpublic function setBlockIdAt(int $x, int $y, int $z, int $id){\n\t\tif($chunk = $this->getChunk($x >> 4, $z >> 4)){\n\t\t\t$chunk->setBlockId($x & 0xf, $y & Level::Y_MASK, $z & 0xf, $id);\n\t\t}\n\t}\n\n\t/**\n\t * Gets the raw block metadata\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockDataAt(int $x, int $y, int $z) : int{\n\t\tif($chunk = $this->getChunk($x >> 4, $z >> 4)){\n\t\t\treturn $chunk->getBlockData($x & 0xf, $y & Level::Y_MASK, $z & 0xf);\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Sets the raw block metadata.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $data 0-15\n\t */\n\tpublic function setBlockDataAt(int $x, int $y, int $z, int $data){\n\t\tif($chunk = $this->getChunk($x >> 4, $z >> 4)){\n\t\t\t$chunk->setBlockData($x & 0xf, $y & Level::Y_MASK, $z & 0xf, $data);\n\t\t}\n\t}\n\n\t/**\n\t * Gets the raw block light level\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockLightAt(int $x, int $y, int $z) : int{\n\t\tif($chunk = $this->getChunk($x >> 4, $z >> 4)){\n\t\t\treturn $chunk->getBlockLight($x & 0x0f, $y & 0x7f, $z & 0x0f);\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/**\n\t * Sets the raw block light level.\n\t *\n\t * @param int $x\n\t * @param int $y\n\t * @param int $z\n\t * @param int $level 0-15\n\t */\n\tpublic function setBlockLightAt(int $x, int $y, int $z, int $level){\n\t\tif($chunk = $this->getChunk($x >> 4, $z >> 4)){\n\t\t\t$chunk->setBlockLight($x & 0x0f, $y & 0x7f, $z & 0x0f, $level & 0x0f);\n\t\t}\n\t}\n\n\t/**\n\t * Updates the light around the block\n\t * \n\t * @param $x\n\t * @param $y\n\t * @param $z\n\t */\n\tpublic function updateBlockLight(int $x, int $y, int $z){\n\t\t$lightPropagationQueue = new \\SplQueue();\n\t\t$lightRemovalQueue = new \\SplQueue();\n\t\t$visited = [];\n\t\t$removalVisited = [];\n\n\t\t$oldLevel = $this->getBlockLightAt($x, $y, $z);\n\t\t$newLevel = (int) Block::$light[$this->getBlockIdAt($x, $y, $z)];\n\n\t\tif($oldLevel !== $newLevel){\n\t\t\t$this->setBlockLightAt($x, $y, $z, $newLevel);\n\n\t\t\tif($newLevel < $oldLevel){\n\t\t\t\t$removalVisited[Level::blockHash($x, $y, $z)] = true;\n\t\t\t\t$lightRemovalQueue->enqueue([new Vector3($x, $y, $z), $oldLevel]);\n\t\t\t}else{\n\t\t\t\t$visited[Level::blockHash($x, $y, $z)] = true;\n\t\t\t\t$lightPropagationQueue->enqueue(new Vector3($x, $y, $z));\n\t\t\t}\n\t\t}\n\n\t\twhile(!$lightRemovalQueue->isEmpty()){\n\t\t\t/** @var Vector3 $node */\n\t\t\t$val = $lightRemovalQueue->dequeue();\n\t\t\t$node = $val[0];\n\t\t\t$lightLevel = $val[1];\n\n\t\t\t$this->computeRemoveBlockLight($node->x - 1, $node->y, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x + 1, $node->y, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y - 1, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y + 1, $node->z, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y, $node->z - 1, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t\t$this->computeRemoveBlockLight($node->x, $node->y, $node->z + 1, $lightLevel, $lightRemovalQueue, $lightPropagationQueue, $removalVisited, $visited);\n\t\t}\n\n\t\twhile(!$lightPropagationQueue->isEmpty()){\n\t\t\t/** @var Vector3 $node */\n\t\t\t$node = $lightPropagationQueue->dequeue();\n\n\t\t\t$lightLevel = $this->getBlockLightAt($node->x, $node->y, $node->z) - (int) Block::$lightFilter[$this->getBlockIdAt($node->x, $node->y, $node->z)];\n\n\t\t\tif($lightLevel >= 1){\n\t\t\t\t$this->computeSpreadBlockLight($node->x - 1, $node->y, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x + 1, $node->y, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y - 1, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y + 1, $node->z, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y, $node->z - 1, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t\t$this->computeSpreadBlockLight($node->x, $node->y, $node->z + 1, $lightLevel, $lightPropagationQueue, $visited);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function computeRemoveBlockLight($x, $y, $z, $currentLight, \\SplQueue $queue, \\SplQueue $spreadQueue, array &$visited, array &$spreadVisited){\n\t\t$current = $this->getBlockLightAt($x, $y, $z);\n\n\t\tif($current !== 0 and $current < $currentLight){\n\t\t\t$this->setBlockLightAt($x, $y, $z, 0);\n\n\t\t\tif(!isset($visited[$index = Level::blockHash($x, $y, $z)])){\n\t\t\t\t$visited[$index] = true;\n\t\t\t\tif($current > 1){\n\t\t\t\t\t$queue->enqueue([new Vector3($x, $y, $z), $current]);\n\t\t\t\t}\n\t\t\t}\n\t\t}elseif($current >= $currentLight){\n\t\t\tif(!isset($spreadVisited[$index = Level::blockHash($x, $y, $z)])){\n\t\t\t\t$spreadVisited[$index] = true;\n\t\t\t\t$spreadQueue->enqueue(new Vector3($x, $y, $z));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function computeSpreadBlockLight($x, $y, $z, $currentLight, \\SplQueue $queue, array &$visited){\n\t\t$current = $this->getBlockLightAt($x, $y, $z);\n\n\t\tif($current < $currentLight){\n\t\t\t$this->setBlockLightAt($x, $y, $z, $currentLight);\n\n\t\t\tif(!isset($visited[$index = Level::blockHash($x, $y, $z)])){\n\t\t\t\t$visited[$index] = true;\n\t\t\t\tif($currentLight > 1){\n\t\t\t\t\t$queue->enqueue(new Vector3($x, $y, $z));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return Chunk|null\n\t */\n\tpublic function getChunk(int $chunkX, int $chunkZ){\n\t\treturn isset($this->chunks[$index = Level::chunkHash($chunkX, $chunkZ)]) ? $this->chunks[$index] : null;\n\t}\n\n\t/**\n\t * @param int   $chunkX\n\t * @param int   $chunkZ\n\t * @param Chunk $chunk\n\t */\n\tpublic function setChunk(int $chunkX, int $chunkZ, Chunk $chunk = null){\n\t\tif($chunk === null){\n\t\t\tunset($this->chunks[Level::chunkHash($chunkX, $chunkZ)]);\n\t\t\treturn;\n\t\t}\n\t\t$this->chunks[Level::chunkHash($chunkX, $chunkZ)] = $chunk;\n\t}\n\n\tpublic function cleanChunks(){\n\t\t$this->chunks = [];\n\t}\n\n\t/**\n\t * Gets the level seed\n\t *\n\t * @return int|string\n\t */\n\tpublic function getSeed(){\n\t\treturn $this->seed;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/WeakPosition.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\Server;\n\nclass WeakPosition extends Position{\n\t\n\tprotected $levelId = -1;\n\n\t/**\n\t * @param int   $x\n\t * @param int   $y\n\t * @param int   $z\n\t * @param Level $level\n\t */\n\tpublic function __construct($x = 0, $y = 0, $z = 0, Level $level = null){\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t\t$this->z = $z;\n\t\t$this->levelId = ($level !== null ? $level->getId() : -1);\n\t}\n\n\tpublic static function fromObject(Vector3 $pos, Level $level = null){\n\t\treturn new WeakPosition($pos->x, $pos->y, $pos->z, $level);\n\t}\n\n\t/**\n\t * @return Level|null\n\t */\n\tpublic function getLevel(){\n\t\treturn Server::getInstance()->getLevel($this->levelId);\n\t}\n\n\t/**\n\t * @param Level|null $level\n\t *\n\t * @return $this\n\t *\n\t * @throws \\InvalidArgumentException if the specified Level has been closed\n\t */\n\tpublic function setLevel(Level $level = null){\n\t\tif($level !== null and $level->isClosed()){\n\t\t\tthrow new \\InvalidArgumentException(\"Specified level has been unloaded and cannot be used\");\n\t\t}\n \n\t\t$this->levelId = ($level !== null ? $level->getId() : -1);\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Returns a side Vector\n\t *\n\t * @param int $side\n\t * @param int $step\n\t *\n\t * @return WeakPosition\n\t *\n\t * @throws LevelException\n\t */\n\tpublic function getSide($side, $step = 1){\n\t\tassert($this->isValid());\n\n\t\treturn WeakPosition::fromObject(parent::getSide($side, $step), $this->level);\n\t}\n\n\tpublic function __toString(){\n\t\treturn \"Weak\" . parent::__toString();\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/format/Chunk.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Implementation of MCPE-style chunks with subchunks with XZY ordering.\n */\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\level\\format\\io\\ChunkException;\nuse pocketmine\\level\\format\\io\\LevelProvider;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\Player;\nuse pocketmine\\tile\\Spawnable;\nuse pocketmine\\tile\\Tile;\nuse pocketmine\\utils\\BinaryStream;\n\nclass Chunk{\n\n\tconst MAX_SUBCHUNKS = 16;\n\n\t/** @var LevelProvider */\n\tprotected $provider;\n\n\tprotected $x;\n\tprotected $z;\n\n\tprotected $hasChanged = false;\n\n\tprotected $isInit = false;\n\n\tprotected $lightPopulated = false;\n\tprotected $terrainGenerated = false;\n\tprotected $terrainPopulated = false;\n\n\tprotected $height = Chunk::MAX_SUBCHUNKS;\n\n\t/** @var SubChunk[] */\n\tprotected $subChunks = [];\n\n\t/** @var EmptySubChunk */\n\tprotected $emptySubChunk = null;\n\n\t/** @var Tile[] */\n\tprotected $tiles = [];\n\tprotected $tileList = [];\n\n\t/** @var Entity[] */\n\tprotected $entities = [];\n\n\t/** @var int[256] */\n\tprotected $heightMap = [];\n\n\t/** @var string */\n\tprotected $biomeIds;\n\n\tprotected $extraData = [];\n\n\t/** @var CompoundTag[] */\n\tprotected $NBTtiles = [];\n\n\t/** @var CompoundTag[] */\n\tprotected $NBTentities = [];\n\n\t/**\n\t * @param LevelProvider $provider\n\t * @param int           $chunkX\n\t * @param int           $chunkZ\n\t * @param SubChunk[]    $subChunks\n\t * @param CompoundTag[] $entities\n\t * @param CompoundTag[] $tiles\n\t * @param string        $biomeIds\n\t * @param int[]         $heightMap\n\t */\n\tpublic function __construct($provider, int $chunkX, int $chunkZ, array $subChunks = [], array $entities = [], array $tiles = [], string $biomeIds = \"\", array $heightMap = []){\n\t\t$this->provider = $provider;\n\t\t$this->x = $chunkX;\n\t\t$this->z = $chunkZ;\n\n\t\t$this->height = $provider !== null ? ($provider->getWorldHeight() >> 4) : 16;\n\n\t\t$this->emptySubChunk = new EmptySubChunk();\n\n\t\tforeach($subChunks as $y => $subChunk){\n\t\t\tif($y < 0 or $y >= $this->height){\n\t\t\t\tthrow new ChunkException(\"Invalid subchunk index $y!\");\n\t\t\t}\n\t\t\tif($subChunk->isEmpty()){\n\t\t\t\t$this->subChunks[$y] = $this->emptySubChunk;\n\t\t\t}else{\n\t\t\t\t$this->subChunks[$y] = $subChunk;\n\t\t\t}\n\t\t}\n\n\t\tfor($i = 0; $i < $this->height; ++$i){\n\t\t\tif(!isset($this->subChunks[$i])){\n\t\t\t\t$this->subChunks[$i] = $this->emptySubChunk;\n\t\t\t}\n\t\t}\n\n\t\tif(count($heightMap) === 256){\n\t\t\t$this->heightMap = $heightMap;\n\t\t}else{\n\t\t\tassert(count($heightMap) === 0, \"Wrong HeightMap value count, expected 256, got \" . count($heightMap));\n\t\t\t$val = ($this->height * 16) - 1;\n\t\t\t$this->heightMap = array_fill(0, 256, $val);\n\t\t}\n\n\t\tif(strlen($biomeIds) === 256){\n\t\t\t$this->biomeIds = $biomeIds;\n\t\t}else{\n\t\t\tassert(strlen($biomeIds) === 0, \"Wrong BiomeIds value count, expected 256, got \" . strlen($biomeIds));\n\t\t\t$this->biomeIds = str_repeat(\"\\x00\", 256);\n\t\t}\n\n\t\t$this->NBTtiles = $tiles;\n\t\t$this->NBTentities = $entities;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getX() : int{\n\t\treturn $this->x;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getZ() : int{\n\t\treturn $this->z;\n\t}\n\n\tpublic function setX(int $x){\n\t\t$this->x = $x;\n\t}\n\n\t/**\n\t * @param int $z\n\t */\n\tpublic function setZ(int $z){\n\t\t$this->z = $z;\n\t}\n\n\t/**\n\t * @return LevelProvider|null\n\t */\n\tpublic function getProvider(){\n\t\treturn $this->provider;\n\t}\n\n\t/**\n\t * @param LevelProvider $provider\n\t */\n\tpublic function setProvider(LevelProvider $provider){\n\t\t$this->provider = $provider;\n\t}\n\n\t/**\n\t * Returns the chunk height in count of subchunks.\n\t *\n\t * @return int\n\t */\n\tpublic function getHeight() : int{\n\t\treturn $this->height;\n\t}\n\n\t/**\n\t * Returns a bitmap of block ID and meta at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t *\n\t * @return int bitmap, (id << 4) | meta\n\t */\n\tpublic function getFullBlock(int $x, int $y, int $z) : int{\n\t\treturn $this->getSubChunk($y >> 4)->getFullBlock($x, $y & 0x0f, $z);\n\t}\n\n\t/**\n\t * Sets block ID and meta in one call at the specified chunk block coordinates\n\t *\n\t * @param int      $x 0-15\n\t * @param int      $y\n\t * @param int      $z 0-15\n\t * @param int|null $blockId 0-255 if null, does not change\n\t * @param int|null $meta 0-15 if null, does not change\n\t *\n\t * @return bool\n\t */\n\tpublic function setBlock(int $x, int $y, int $z, $blockId = null, $meta = null) : bool{\n\t\tif($this->getSubChunk($y >> 4, true)->setBlock($x, $y & 0x0f, $z, $blockId !== null ? ($blockId & 0xff) : null, $meta !== null ? ($meta & 0x0f) : null)){\n\t\t\t$this->hasChanged = true;\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns the block ID at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t *\n\t * @return int 0-255\n\t */\n\tpublic function getBlockId(int $x, int $y, int $z) : int{\n\t\treturn $this->getSubChunk($y >> 4)->getBlockId($x, $y & 0x0f, $z);\n\t}\n\n\t/**\n\t * Sets the block ID at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t * @param int $id 0-255\n\t */\n\tpublic function setBlockId(int $x, int $y, int $z, int $id){\n\t\tif($this->getSubChunk($y >> 4, true)->setBlockId($x, $y & 0x0f, $z, $id)){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * Returns the block meta value at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockData(int $x, int $y, int $z) : int{\n\t\treturn $this->getSubChunk($y >> 4)->getBlockData($x, $y & 0x0f, $z);\n\t}\n\n\t/**\n\t * Sets the block meta value at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t * @param int $data 0-15\n\t */\n\tpublic function setBlockData(int $x, int $y, int $z, int $data){\n\t\tif($this->getSubChunk($y >> 4)->setBlockData($x, $y & 0x0f, $z, $data)){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * Returns the raw block extra data value at the specified chunk block coordinates, or 0 if no data exists\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t *\n\t * @return int bitmap, (meta << 8) | id\n\t */\n\tpublic function getBlockExtraData(int $x, int $y, int $z) : int{\n\t\treturn $this->extraData[Chunk::chunkBlockHash($x, $y, $z)] ?? 0;\n\t}\n\n\t/**\n\t * Sets the raw block extra data value at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t * @param int $data bitmap, (meta << 8) | id\n\t */\n\tpublic function setBlockExtraData(int $x, int $y, int $z, int $data){\n\t\tif($data === 0){\n\t\t\tunset($this->extraData[Chunk::chunkBlockHash($x, $y, $z)]);\n\t\t}else{\n\t\t\t$this->extraData[Chunk::chunkBlockHash($x, $y, $z)] = $data;\n\t\t}\n\n\t\t$this->hasChanged = true;\n\t}\n\n\t/**\n\t * Returns the sky light level at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockSkyLight(int $x, int $y, int $z) : int{\n\t\treturn $this->getSubChunk($y >> 4)->getBlockSkyLight($x, $y & 0x0f, $z);\n\t}\n\n\t/**\n\t * Sets the sky light level at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t * @param int $level 0-15\n\t */\n\tpublic function setBlockSkyLight(int $x, int $y, int $z, int $level){\n\t\tif($this->getSubChunk($y >> 4)->setBlockSkyLight($x, $y & 0x0f, $z, $level)){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * Returns the block light level at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y 0-15\n\t * @param int $z 0-15\n\t *\n\t * @return int 0-15\n\t */\n\tpublic function getBlockLight(int $x, int $y, int $z) : int{\n\t\treturn $this->getSubChunk($y >> 4)->getBlockLight($x, $y & 0x0f, $z);\n\t}\n\n\t/**\n\t * Sets the block light level at the specified chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $y 0-15\n\t * @param int $z 0-15\n\t * @param int $level 0-15\n\t */\n\tpublic function setBlockLight(int $x, int $y, int $z, int $level){\n\t\tif($this->getSubChunk($y >> 4)->setBlockLight($x, $y & 0x0f, $z, $level)){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * Returns the Y coordinate of the highest non-air block at the specified X/Z chunk block coordinates\n\t *\n\t * @param int  $x 0-15\n\t * @param int  $z 0-15\n\t * @param bool $useHeightMap whether to use pre-calculated heightmap values or not\n\t *\n\t * @return int\n\t */\n\tpublic function getHighestBlockAt(int $x, int $z, bool $useHeightMap = true) : int{\n\t\tif($useHeightMap){\n\t\t\t$height = $this->getHeightMap($x, $z);\n\n\t\t\tif($height !== 0 and $height !== 255){\n\t\t\t\treturn $height;\n\t\t\t}\n\t\t}\n\n\t\t$index = $this->getHighestSubChunkIndex();\n\t\tif($index < 0){\n\t\t\treturn 0;\n\t\t}\n\n\t\t$height = $index << 4;\n\n\t\tfor($y = $index; $y >= 0; --$y){\n\t\t\t$height = $this->getSubChunk($y)->getHighestBlockAt($x, $z) | ($y << 4);\n\t\t\tif($height !== -1){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t$this->setHeightMap($x, $z, $height);\n\t\treturn $height;\n\t}\n\n\t/**\n\t * Returns the heightmap value at the specified X/Z chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t *\n\t * @return int\n\t */\n\tpublic function getHeightMap(int $x, int $z) : int{\n\t\treturn $this->heightMap[($z << 4) | $x];\n\t}\n\n\t/**\n\t * Returns the heightmap value at the specified X/Z chunk block coordinates\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t * @param int $value\n\t */\n\tpublic function setHeightMap(int $x, int $z, int $value){\n\t\t$this->heightMap[($z << 4) | $x] = $value;\n\t}\n\n\t/**\n\t * Recalculates the heightmap for the whole chunk.\n\t */\n\tpublic function recalculateHeightMap(){\n\t\tfor($z = 0; $z < 16; ++$z){\n\t\t\tfor($x = 0; $x < 16; ++$x){\n\t\t\t\t$this->setHeightMap($x, $z, $this->getHighestBlockAt($x, $z, false));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Performs basic sky light population on the chunk.\n\t *\n\t * TODO: rewrite this, use block light filters and diffusion, actual proper sky light population\n\t */\n\tpublic function populateSkyLight(){\n\t\tfor($x = 0; $x < 16; ++$x){\n\t\t\tfor($z = 0; $z < 16; ++$z){\n\t\t\t\t$heightMap = $this->getHeightMap($x, $z);\n\n\t\t\t\t$y = ($this->getHighestSubChunkIndex() + 1) << 4;\n\n\t\t\t\tfor(; $y > $heightMap; --$y){\n\t\t\t\t\t$this->setBlockSkyLight($x, $y, $z, 15);\n\t\t\t\t}\n\n\t\t\t\tfor(; $y > 0 and $this->getBlockId($x, $y, $z) === Block::AIR; --$y){\n\t\t\t\t\t$this->setBlockSkyLight($x, $y, $z, 15);\n\t\t\t\t}\n\n\t\t\t\t$this->setHeightMap($x, $z, $y);\n\t\t\t\t\n\t\t\t\tfor(; $y > 0; --$y){\t\t\n\t\t\t\t\t$this->setBlockSkyLight($x, $y, $z, 0);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns the biome ID at the specified X/Z chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t *\n\t * @return int 0-255\n\t */\n\tpublic function getBiomeId(int $x, int $z) : int{\n\t\treturn ord($this->biomeIds{($z << 4) | $x});\n\t}\n\n\t/**\n\t * Sets the biome ID at the specified X/Z chunk block coordinates\n\t *\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t * @param int $biomeId 0-255\n\t */\n\tpublic function setBiomeId(int $x, int $z, int $biomeId){\n\t\t$this->hasChanged = true;\n\t\t$this->biomeIds{($z << 4) | $x} = chr($biomeId & 0xff);\n\t}\n\n\t/**\n\t * Returns a column of block IDs from bottom to top at the specified X/Z chunk block coordinates.\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t *\n\t * @return string\n\t */\n\tpublic function getBlockIdColumn(int $x, int $z) : string{\n\t\t$result = \"\";\n\t\tforeach($this->subChunks as $subChunk){\n\t\t\t$result .= $subChunk->getBlockIdColumn($x, $z);\n\t\t}\n\t\treturn $result;\n\t}\n\n\t/**\n\t * Returns a column of block meta values from bottom to top at the specified X/Z chunk block coordinates.\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t *\n\t * @return string\n\t */\n\tpublic function getBlockDataColumn(int $x, int $z) : string{\n\t\t$result = \"\";\n\t\tforeach($this->subChunks as $subChunk){\n\t\t\t$result .= $subChunk->getBlockDataColumn($x, $z);\n\t\t}\n\t\treturn $result;\n\t}\n\n\t/**\n\t * Returns a column of sky light values from bottom to top at the specified X/Z chunk block coordinates.\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t *\n\t * @return string\n\t */\n\tpublic function getBlockSkyLightColumn(int $x, int $z) : string{\n\t\t$result = \"\";\n\t\tforeach($this->subChunks as $subChunk){\n\t\t\t$result .= $subChunk->getSkyLightColumn($x, $z);\n\t\t}\n\t\treturn $result;\n\t}\n\n\t/**\n\t * Returns a column of block light values from bottom to top at the specified X/Z chunk block coordinates.\n\t * @param int $x 0-15\n\t * @param int $z 0-15\n\t *\n\t * @return string\n\t */\n\tpublic function getBlockLightColumn(int $x, int $z) : string{\n\t\t$result = \"\";\n\t\tforeach($this->subChunks as $subChunk){\n\t\t\t$result .= $subChunk->getBlockLightColumn($x, $z);\n\t\t}\n\t\treturn $result;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isLightPopulated() : bool{\n\t\treturn $this->lightPopulated;\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setLightPopulated(bool $value = true){\n\t\t$this->lightPopulated = $value;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isPopulated() : bool{\n\t\treturn $this->terrainPopulated;\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setPopulated(bool $value = true){\n\t\t$this->terrainPopulated = $value;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isGenerated() : bool{\n\t\treturn $this->terrainGenerated;\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setGenerated(bool $value = true){\n\t\t$this->terrainGenerated = $value;\n\t}\n\n\t/**\n\t * @param Entity $entity\n\t */\n\tpublic function addEntity(Entity $entity){\n\t\t$this->entities[$entity->getId()] = $entity;\n\t\tif(!($entity instanceof Player) and $this->isInit){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * @param Entity $entity\n\t */\n\tpublic function removeEntity(Entity $entity){\n\t\tunset($this->entities[$entity->getId()]);\n\t\tif(!($entity instanceof Player) and $this->isInit){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * @param Tile $tile\n\t */\n\tpublic function addTile(Tile $tile){\n\t\t$this->tiles[$tile->getId()] = $tile;\n\t\tif(isset($this->tileList[$index = (($tile->x & 0x0f) << 12) | (($tile->z & 0x0f) << 8) | ($tile->y & 0xff)]) and $this->tileList[$index] !== $tile){\n\t\t\t$this->tileList[$index]->close();\n\t\t}\n\t\t$this->tileList[$index] = $tile;\n\t\tif($this->isInit){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * @param Tile $tile\n\t */\n\tpublic function removeTile(Tile $tile){\n\t\tunset($this->tiles[$tile->getId()]);\n\t\tunset($this->tileList[(($tile->x & 0x0f) << 12) | (($tile->z & 0x0f) << 8) | ($tile->y & 0xff)]);\n\t\tif($this->isInit){\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * Returns an array of entities currently using this chunk.\n\t *\n\t * @return Entity[]\n\t */\n\tpublic function getEntities() : array{\n\t\treturn $this->entities;\n\t}\n\n\t/**\n\t * @return Tile[]\n\t */\n\tpublic function getTiles() : array{\n\t\treturn $this->tiles;\n\t}\n\n\t/**\n\t * Returns the tile at the specified chunk block coordinates, or null if no tile exists.\n\t *\n\t * @param int $x 0-15\n\t * @param int $y\n\t * @param int $z 0-15\n\t *\n\t * @return Tile|null\n\t */\n\tpublic function getTile(int $x, int $y, int $z){\n\t\t$index = ($x << 12) | ($z << 8) | $y;\n\t\treturn $this->tileList[$index] ?? null;\n\t}\n\n\t/**\n\t * Unloads the chunk, closing entities and tiles.\n\t *\n\t * @param bool $save\n\t * @param bool $safe Whether to check if there are still players using this chunk\n\t *\n\t * @return bool\n\t */\n\tpublic function unload(bool $save = true, bool $safe = true) : bool{\n\t\t$level = $this->getProvider();\n\t\tif($level === null){\n\t\t\treturn true;\n\t\t}\n\t\tif($save === true and $this->hasChanged){\n\t\t\t$level->saveChunk($this->getX(), $this->getZ());\n\t\t}\n\t\tif($safe === true){\n\t\t\tforeach($this->getEntities() as $entity){\n\t\t\t\tif($entity instanceof Player){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->getEntities() as $entity){\n\t\t\tif($entity instanceof Player){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$entity->close();\n\t\t}\n\t\tforeach($this->getTiles() as $tile){\n\t\t\t$tile->close();\n\t\t}\n\t\t$this->provider = null;\n\t\treturn true;\n\t}\n\n\t/**\n\t * Deserializes tiles and entities from NBT\n\t * TODO: remove this\n\t */\n\tpublic function initChunk(){\n\t\tif($this->getProvider() instanceof LevelProvider and !$this->isInit){\n\t\t\t$changed = false;\n\t\t\tif($this->NBTentities !== null){\n\t\t\t\t$this->getProvider()->getLevel()->timings->syncChunkLoadEntitiesTimer->startTiming();\n\t\t\t\tforeach($this->NBTentities as $nbt){\n\t\t\t\t\tif($nbt instanceof CompoundTag){\n\t\t\t\t\t\tif(!isset($nbt->id)){\n\t\t\t\t\t\t\t$changed = true;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(($nbt[\"Pos\"][0] >> 4) !== $this->x or ($nbt[\"Pos\"][2] >> 4) !== $this->z){\n\t\t\t\t\t\t\t$changed = true;\n\t\t\t\t\t\t\tcontinue; //Fixes entities allocated in wrong chunks.\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(($entity = Entity::createEntity($nbt[\"id\"], $this, $nbt)) instanceof Entity){\n\t\t\t\t\t\t\t$entity->spawnToAll();\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$changed = true;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$this->getProvider()->getLevel()->timings->syncChunkLoadEntitiesTimer->stopTiming();\n\n\t\t\t\t$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->startTiming();\n\t\t\t\tforeach($this->NBTtiles as $nbt){\n\t\t\t\t\tif($nbt instanceof CompoundTag){\n\t\t\t\t\t\tif(!isset($nbt->id)){\n\t\t\t\t\t\t\t$changed = true;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(($nbt[\"x\"] >> 4) !== $this->x or ($nbt[\"z\"] >> 4) !== $this->z){\n\t\t\t\t\t\t\t$changed = true;\n\t\t\t\t\t\t\tcontinue; //Fixes tiles allocated in wrong chunks.\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(Tile::createTile($nbt[\"id\"], $this, $nbt) === null){\n\t\t\t\t\t\t\t$changed = true;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$this->getProvider()->getLevel()->timings->syncChunkLoadTileEntitiesTimer->stopTiming();\n\n\t\t\t\t$this->NBTentities = null;\n\t\t\t\t$this->NBTtiles = null;\n\t\t\t}\n\n\t\t\t$this->hasChanged = $changed;\n\n\t\t\t$this->isInit = true;\n\t\t}\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getBiomeIdArray() : string{\n\t\treturn $this->biomeIds;\n\t}\n\n\t/**\n\t * @return int[]\n\t */\n\tpublic function getHeightMapArray() : array{\n\t\treturn $this->heightMap;\n\t}\n\n\t/**\n\t * @return int[]\n\t */\n\tpublic function getBlockExtraDataArray() : array{\n\t\treturn $this->extraData;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function hasChanged() : bool{\n\t\treturn $this->hasChanged;\n\t}\n\n\t/**\n\t * @param bool $value\n\t */\n\tpublic function setChanged(bool $value = true){\n\t\t$this->hasChanged = $value;\n\t}\n\n\t/**\n\t * Returns the subchunk at the specified subchunk Y coordinate, or an empty, unmodifiable stub if it does not exist or the coordinate is out of range.\n\t *\n\t * @param int  $y\n\t * @param bool $generateNew Whether to create a new, modifiable subchunk if there is not one in place\n\t *\n\t * @return SubChunk|EmptySubChunk\n\t */\n\tpublic function getSubChunk(int $y, bool $generateNew = false) : SubChunk{\n\t\tif($y < 0 or $y >= $this->height){\n\t\t\treturn $this->emptySubChunk;\n\t\t}elseif($generateNew and $this->subChunks[$y] instanceof EmptySubChunk){\n\t\t\t$this->subChunks[$y] = new SubChunk();\n\t\t}\n\t\tassert($this->subChunks[$y] !== null, \"Somehow something broke, no such subchunk at index $y\");\n\t\treturn $this->subChunks[$y];\n\t}\n\n\t/**\n\t * Sets a subchunk in the chunk index\n\t * @param int           $y\n\t * @param SubChunk|null $subChunk\n\t * @param bool          $allowEmpty Whether to check if the chunk is empty, and if so replace it with an empty stub\n\t *\n\t * @return bool\n\t */\n\tpublic function setSubChunk(int $y, SubChunk $subChunk = null, bool $allowEmpty = false) : bool{\n\t\tif($y < 0 or $y >= $this->height){\n\t\t\treturn false;\n\t\t}\n\t\tif($subChunk === null or ($subChunk->isEmpty() and !$allowEmpty)){\n\t\t\t$this->subChunks[$y] = $this->emptySubChunk;\n\t\t}else{\n\t\t\t$this->subChunks[$y] = $subChunk;\n\t\t}\n\t\t$this->hasChanged = true;\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return SubChunk[]\n\t */\n\tpublic function getSubChunks() : array{\n\t\treturn $this->subChunks;\n\t}\n\n\t/**\n\t * Returns the Y coordinate of the highest non-empty subchunk in this chunk.\n\t *\n\t * @return int\n\t */\n\tpublic function getHighestSubChunkIndex() : int{\n\t\tfor($y = count($this->subChunks) - 1; $y >= 0; --$y){\n\t\t\tif($this->subChunks[$y] === null or $this->subChunks[$y] instanceof EmptySubChunk){\n\t\t\t\t//No need to thoroughly prune empties at runtime, this will just reduce performance.\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\n\t\treturn $y;\n\t}\n\n\t/**\n\t * Returns the count of subchunks that need sending to players\n\t *\n\t * @return int\n\t */\n\tpublic function getSubChunkSendCount() : int{\n\t\treturn $this->getHighestSubChunkIndex() + 1;\n\t}\n\n\t/**\n\t * Disposes of empty subchunks\n\t */\n\tpublic function pruneEmptySubChunks(){\n\t\tforeach($this->subChunks as $y => $subChunk){\n\t\t\tif($y < 0 or $y >= $this->height){\n\t\t\t\tassert(false, \"Invalid subchunk index\");\n\t\t\t\tunset($this->subChunks[$y]);\n\t\t\t}elseif($subChunk instanceof EmptySubChunk){\n\t\t\t\tcontinue;\n\t\t\t}elseif($subChunk->isEmpty()){ //normal subchunk full of air, remove it and replace it with an empty stub\n\t\t\t\t$this->subChunks[$y] = $this->emptySubChunk;\n\t\t\t}else{\n\t\t\t\tcontinue; //do not set changed\n\t\t\t}\n\t\t\t$this->hasChanged = true;\n\t\t}\n\t}\n\n\t/**\n\t * Serializes the chunk for sending to players\n\t *\n\t * @return string\n\t */\n\tpublic function networkSerialize() : string{\n\t\t$result = \"\";\n\t\t$subChunkCount = $this->getSubChunkSendCount();\n\t\t$result .= chr($subChunkCount);\n\t\tfor($y = 0; $y < $subChunkCount; ++$y){\n\t\t\t$result .= $this->subChunks[$y]->networkSerialize();\n\t\t}\n\t\t$result .= pack(\"v*\", ...$this->heightMap)\n\t\t        .  $this->biomeIds\n\t\t        .  chr(0); //border block array count\n\t\t//Border block entry format: 1 byte (4 bits X, 4 bits Z). These are however useless since they crash the regular client.\n\n\t\t$extraData = new BinaryStream();\n\t\t$extraData->putVarInt(count($this->extraData)); //WHY, Mojang, WHY\n\t\tforeach($this->extraData as $key => $value){\n\t\t\t$extraData->putVarInt($key);\n\t\t\t$extraData->putLShort($value);\n\t\t}\n\t\t$result .= $extraData->getBuffer();\n\n\t\tif(count($this->tiles) > 0){\n\t\t\t$nbt = new NBT(NBT::LITTLE_ENDIAN);\n\t\t\t$list = [];\n\t\t\tforeach($this->tiles as $tile){\n\t\t\t\tif($tile instanceof Spawnable){\n\t\t\t\t\t$list[] = $tile->getSpawnCompound();\n\t\t\t\t}\n\t\t\t}\n\t\t\t$nbt->setData($list);\n\t\t\t$result .= $nbt->write(true);\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\t/**\n\t * Fast-serializes the chunk for passing between threads\n\t * TODO: tiles and entities\n\t *\n\t * @return string\n\t */\n\tpublic function fastSerialize() : string{\n\t\t$stream = new BinaryStream();\n\t\t$stream->putInt($this->x);\n\t\t$stream->putInt($this->z);\n\t\t$count = 0;\n\t\t$subChunks = \"\";\n\t\tforeach($this->subChunks as $y => $subChunk){\n\t\t\tif($subChunk instanceof EmptySubChunk){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t++$count;\n\t\t\t$subChunks .= chr($y) . $subChunk->fastSerialize();\n\t\t}\n\t\t$stream->putByte($count);\n\t\t$stream->put($subChunks);\n\t\t$stream->put(pack(\"C*\", ...$this->heightMap) .\n\t\t\t$this->biomeIds .\n\t\t\tchr(($this->lightPopulated ? 1 << 2 : 0) | ($this->terrainPopulated ? 1 << 1 : 0) | ($this->terrainGenerated ? 1 : 0)));\n\t\treturn $stream->getBuffer();\n\t}\n\n\t/**\n\t * Deserializes a fast-serialized chunk\n\t *\n\t * @param string             $data\n\t * @param LevelProvider|null $provider\n\t *\n\t * @return Chunk\n\t */\n\tpublic static function fastDeserialize(string $data, LevelProvider $provider = null){\n\t\t$stream = new BinaryStream();\n\t\t$stream->setBuffer($data);\n\t\t$data = null;\n\t\t$x = $stream->getInt();\n\t\t$z = $stream->getInt();\n\t\t$subChunks = [];\n\t\t$count = $stream->getByte();\n\t\tfor($y = 0; $y < $count; ++$y){\n\t\t\t$subChunks[$stream->getByte()] = SubChunk::fastDeserialize($stream->get(10240));\n\t\t}\n\t\t$heightMap = array_values(unpack(\"C*\", $stream->get(256)));\n\t\t$biomeIds = $stream->get(256);\n\n\t\t$chunk = new Chunk($provider, $x, $z, $subChunks, [], [], $biomeIds, $heightMap);\n\t\t$flags = $stream->getByte();\n\t\t$chunk->lightPopulated = (bool) ($flags & 4);\n\t\t$chunk->terrainPopulated = (bool) ($flags & 2);\n\t\t$chunk->terrainGenerated = (bool) ($flags & 1);\n\t\treturn $chunk;\n\t}\n\n\t//TODO: get rid of this\n\tpublic static function getEmptyChunk(int $x, int $z, LevelProvider $provider = null) : Chunk{\n\t\treturn new Chunk($provider, $x, $z);\n\t}\n\n\t/**\n\t * Creates a block hash from chunk block coordinates. Used for extra data keys in chunk packets.\n\t * @internal\n\t *\n\t * @param int $x 0-15\n\t * @param int $y 0-255\n\t * @param int $z 0-15\n\t *\n\t * @return int\n\t */\n\tpublic static function chunkBlockHash(int $x, int $y, int $z) : int{\n\t\treturn ($x << 12) | ($z << 8) | $y;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/format/EmptySubChunk.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format;\n\n\n\nclass EmptySubChunk extends SubChunk{\n\n\tpublic function __construct(){\n\n\t}\n\n\tpublic function isEmpty() : bool{\n\t\treturn true;\n\t}\n\n\tpublic function getBlockId(int $x, int $y, int $z) : int{\n\t\treturn 0;\n\t}\n\n\tpublic function setBlockId(int $x, int $y, int $z, int $id) : bool{\n\t\treturn false;\n\t}\n\n\tpublic function getBlockData(int $x, int $y, int $z) : int{\n\t\treturn 0;\n\t}\n\n\tpublic function setBlockData(int $x, int $y, int $z, int $data) : bool{\n\t\treturn false;\n\t}\n\n\tpublic function getFullBlock(int $x, int $y, int $z) : int{\n\t\treturn 0;\n\t}\n\n\tpublic function setBlock(int $x, int $y, int $z, $id = null, $data = null) : bool{\n\t\treturn false;\n\t}\n\n\tpublic function getBlockLight(int $x, int $y, int $z) : int{\n\t\treturn 0;\n\t}\n\n\tpublic function setBlockLight(int $x, int $y, int $z, int $level) : bool{\n\t\treturn false;\n\t}\n\n\tpublic function getBlockSkyLight(int $x, int $y, int $z) : int{\n\t\treturn 15;\n\t}\n\n\tpublic function setBlockSkyLight(int $x, int $y, int $z, int $level) : bool{\n\t\treturn false;\n\t}\n\n\tpublic function getBlockIdColumn(int $x, int $z) : string{\n\t\treturn \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\n\t}\n\n\tpublic function getBlockDataColumn(int $x, int $z) : string{\n\t\treturn \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\n\t}\n\n\tpublic function getBlockLightColumn(int $x, int $z) : string{\n\t\treturn \"\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\";\n\t}\n\n\tpublic function getSkyLightColumn(int $x, int $z) : string{\n\t\treturn \"\\xff\\xff\\xff\\xff\\xff\\xff\\xff\\xff\";\n\t}\n\n\tpublic function getBlockIdArray() : string{\n\t\treturn str_repeat(\"\\x00\", 4096);\n\t}\n\n\tpublic function getBlockDataArray() : string{\n\t\treturn str_repeat(\"\\x00\", 2048);\n\t}\n\n\tpublic function getBlockLightArray() : string{\n\t\treturn str_repeat(\"\\x00\", 2048);\n\t}\n\n\tpublic function getSkyLightArray() : string{\n\t\treturn str_repeat(\"\\xff\", 2048);\n\t}\n\n\tpublic function networkSerialize() : string{\n\t\treturn \"\\x00\" . str_repeat(\"\\x00\", 10240);\n\t}\n\n\tpublic function fastSerialize() : string{\n\t\tthrow new \\BadMethodCallException(\"Should not try to serialize empty subchunks\");\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/format/SubChunk.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format;\n\nclass SubChunk{\n\n\tprotected $ids;\n\tprotected $data;\n\tprotected $blockLight;\n\tprotected $skyLight;\n\n\tprivate static function assignData(&$target, $data, $length, $value = \"\\x00\"){\n\t\tif(strlen($data) !== $length){\n\t\t\tassert($data === \"\", \"Invalid non-zero length given, expected $length, got \" . strlen($data));\n\t\t\t$target = str_repeat($value, $length);\n\t\t}else{\n\t\t\t$target = $data;\n\t\t}\n\t}\n\n\tpublic function __construct(string $ids = \"\", string $data = \"\", string $skyLight = \"\", string $blockLight = \"\"){\n\t\tself::assignData($this->ids, $ids, 4096);\n\t\tself::assignData($this->data, $data, 2048);\n\t\tself::assignData($this->skyLight, $skyLight, 2048, \"\\xff\");\n\t\tself::assignData($this->blockLight, $blockLight, 2048);\n\t}\n\n\tpublic function isEmpty() : bool{\n\t\tassert(strlen($this->ids) === 4096, \"Wrong length of ID array, expecting 4096 bytes, got \" . strlen($this->ids));\n\t\treturn substr_count($this->ids, \"\\x00\") === 4096;\n\t}\n\n\tpublic function getBlockId(int $x, int $y, int $z) : int{\n\t\treturn ord($this->ids{($x << 8) | ($z << 4) | $y});\n\t}\n\n\tpublic function setBlockId(int $x, int $y, int $z, int $id) : bool{\n\t\t$this->ids{($x << 8) | ($z << 4) | $y} = chr($id);\n\t\treturn true;\n\t}\n\n\tpublic function getBlockData(int $x, int $y, int $z) : int{\n\t\t$m = ord($this->data{($x << 7) + ($z << 3) + ($y >> 1)});\n\t\tif(($y & 1) === 0){\n\t\t\treturn $m & 0x0f;\n\t\t}else{\n\t\t\treturn $m >> 4;\n\t\t}\n\t}\n\n\tpublic function setBlockData(int $x, int $y, int $z, int $data) : bool{\n\t\t$i = ($x << 7) | ($z << 3) | ($y >> 1);\n\t\tif(($y & 1) === 0){\n\t\t\t$this->data{$i} = chr((ord($this->data{$i}) & 0xf0) | ($data & 0x0f));\n\t\t}else{\n\t\t\t$this->data{$i} = chr((($data & 0x0f) << 4) | (ord($this->data{$i}) & 0x0f));\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function getFullBlock(int $x, int $y, int $z) : int{\n\t\t$i = ($x << 8) | ($z << 4) | $y;\n\t\tif(($y & 1) === 0){\n\t\t\treturn (ord($this->ids{$i}) << 4) | (ord($this->data{$i >> 1}) & 0x0f);\n\t\t}else{\n\t\t\treturn (ord($this->ids{$i}) << 4) | (ord($this->data{$i >> 1}) >> 4);\n\t\t}\n\t}\n\n\tpublic function setBlock(int $x, int $y, int $z, $id = null, $data = null) : bool{\n\t\t$i = ($x << 8) | ($z << 4) | $y;\n\t\t$changed = false;\n\t\tif($id !== null){\n\t\t\t$block = chr($id);\n\t\t\tif($this->ids{$i} !== $block){\n\t\t\t\t$this->ids{$i} = $block;\n\t\t\t\t$changed = true;\n\t\t\t}\n\t\t}\n\n\t\tif($data !== null){\n\t\t\t$i >>= 1;\n\t\t\t$byte = ord($this->data{$i});\n\t\t\tif(($y & 1) === 0){\n\t\t\t\t$this->data{$i} = chr(($byte & 0xf0) | ($data & 0x0f));\n\t\t\t}else{\n\t\t\t\t$this->data{$i} = chr((($data & 0x0f) << 4) | ($byte & 0x0f));\n\t\t\t}\n\t\t\tif($this->data{$i} !== $byte){\n\t\t\t\t$changed = true;\n\t\t\t}\n\t\t}\n\n\t\treturn $changed;\n\t}\n\n\tpublic function getBlockLight(int $x, int $y, int $z) : int{\n\t\t$byte = ord($this->blockLight{($x << 7) + ($z << 3) + ($y >> 1)});\n\t\tif(($y & 1) === 0){\n\t\t\treturn $byte & 0x0f;\n\t\t}else{\n\t\t\treturn $byte >> 4;\n\t\t}\n\t}\n\n\tpublic function setBlockLight(int $x, int $y, int $z, int $level) : bool{\n\t\t$i = ($x << 7) + ($z << 3) + ($y >> 1);\n\t\t$byte = ord($this->blockLight{$i});\n\t\tif(($y & 1) === 0){\n\t\t\t$this->blockLight{$i} = chr(($byte & 0xf0) | ($level & 0x0f));\n\t\t}else{\n\t\t\t$this->blockLight{$i} = chr((($level & 0x0f) << 4) | ($byte & 0x0f));\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function getBlockSkyLight(int $x, int $y, int $z) : int{\n\t\t$byte = ord($this->skyLight{($x << 7) + ($z << 3) + ($y >> 1)});\n\t\tif(($y & 1) === 0){\n\t\t\treturn $byte & 0x0f;\n\t\t}else{\n\t\t\treturn $byte >> 4;\n\t\t}\n\t}\n\n\tpublic function setBlockSkyLight(int $x, int $y, int $z, int $level) : bool{\n\t\t$i = ($x << 7) + ($z << 3) + ($y >> 1);\n\t\t$byte = ord($this->skyLight{$i});\n\t\tif(($y & 1) === 0){\n\t\t\t$this->skyLight{$i} = chr(($byte & 0xf0) | ($level & 0x0f));\n\t\t}else{\n\t\t\t$this->skyLight{$i} = chr((($level & 0x0f) << 4) | ($byte & 0x0f));\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function getHighestBlockAt(int $x, int $z) : int{\n\t\tfor($y = 15; $y >= 0; --$y){\n\t\t\tif($this->ids{($x << 8) | ($z << 4) | $y} !== \"\\x00\"){\n\t\t\t\treturn $y;\n\t\t\t}\n\t\t}\n\n\t\treturn -1; //highest block not in this subchunk\n\t}\n\n\tpublic function getBlockIdColumn(int $x, int $z) : string{\n\t\treturn substr($this->ids, (($x << 8) | ($z << 4)), 16);\n\t}\n\n\tpublic function getBlockDataColumn(int $x, int $z) : string{\n\t\treturn substr($this->data, (($x << 7) | ($z << 3)), 8);\n\t}\n\n\tpublic function getBlockLightColumn(int $x, int $z) : string{\n\t\treturn substr($this->blockLight, (($x << 7) | ($z << 3)), 8);\n\t}\n\n\tpublic function getSkyLightColumn(int $x, int $z) : string{\n\t\treturn substr($this->skyLight, (($x << 7) | ($z << 3)), 8);\n\t}\n\n\tpublic function getBlockIdArray() : string{\n\t\tassert(strlen($this->ids) === 4096, \"Wrong length of ID array, expecting 4096 bytes, got \" . strlen($this->ids));\n\t\treturn $this->ids;\n\t}\n\n\tpublic function getBlockDataArray() : string{\n\t\tassert(strlen($this->data) === 2048, \"Wrong length of data array, expecting 2048 bytes, got \" . strlen($this->data));\n\t\treturn $this->data;\n\t}\n\n\tpublic function getSkyLightArray() : string{\n\t\tassert(strlen($this->skyLight) === 2048, \"Wrong length of skylight array, expecting 2048 bytes, got \" . strlen($this->skyLight));\n\t\treturn $this->skyLight;\n\t}\n\n\tpublic function getBlockLightArray() : string{\n\t\tassert(strlen($this->blockLight) === 2048, \"Wrong length of light array, expecting 2048 bytes, got \" . strlen($this->blockLight));\n\t\treturn $this->blockLight;\n\t}\n\n\tpublic function networkSerialize() : string{\n\t\t// storage version, ids, data, skylight, blocklight\n\t\treturn \"\\x00\" . $this->ids . $this->data . $this->skyLight . $this->blockLight;\n\t}\n\n\tpublic function fastSerialize() : string{\n\t\treturn\n\t\t\t$this->ids .\n\t\t\t$this->data .\n\t\t\t$this->skyLight .\n\t\t\t$this->blockLight;\n\t}\n\n\tpublic static function fastDeserialize(string $data) : SubChunk{\n\t\treturn new SubChunk(\n\t\t\tsubstr($data,    0, 4096), //ids\n\t\t\tsubstr($data, 4096, 2048), //data\n\t\t\tsubstr($data, 6144, 2048), //sky light\n\t\t\tsubstr($data, 8192, 2048)  //block light\n\t\t);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/format/io/BaseLevelProvider.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format\\io;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\generator\\Generator;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\LevelException;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\LongTag;\nuse pocketmine\\nbt\\tag\\StringTag;\n\nabstract class BaseLevelProvider implements LevelProvider{\n\t/** @var Level */\n\tprotected $level;\n\t/** @var string */\n\tprotected $path;\n\t/** @var CompoundTag */\n\tprotected $levelData;\n\t/** @var bool */\n\tprotected $asyncChunkRequest = false;\n\n\tpublic function __construct(Level $level, string $path){\n\t\t$this->level = $level;\n\t\t$this->path = $path;\n\t\tif(!file_exists($this->path)){\n\t\t\tmkdir($this->path, 0777, true);\n\t\t}\n\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\t$nbt->readCompressed(file_get_contents($this->getPath() . \"level.dat\"));\n\t\t$levelData = $nbt->getData();\n\t\tif($levelData->Data instanceof CompoundTag){\n\t\t\t$this->levelData = $levelData->Data;\n\t\t}else{\n\t\t\tthrow new LevelException(\"Invalid level.dat\");\n\t\t}\n\n\t\tif(!isset($this->levelData->generatorName)){\n\t\t\t$this->levelData->generatorName = new StringTag(\"generatorName\", Generator::getGenerator(\"DEFAULT\"));\n\t\t}\n\n\t\tif(!isset($this->levelData->generatorOptions)){\n\t\t\t$this->levelData->generatorOptions = new StringTag(\"generatorOptions\", \"\");\n\t\t}\n\t\t$this->asyncChunkRequest = (bool) $this->level->getServer()->getProperty(\"chunk-sending.async-chunk-request\", false);\n\t}\n\n\tpublic function getPath() : string{\n\t\treturn $this->path;\n\t}\n\n\tpublic function getServer(){\n\t\treturn $this->level->getServer();\n\t}\n\n\tpublic function getLevel(){\n\t\treturn $this->level;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn (string) $this->levelData[\"LevelName\"];\n\t}\n\n\tpublic function getTime(){\n\t\treturn $this->levelData[\"Time\"];\n\t}\n\n\tpublic function setTime($value){\n\t\t$this->levelData->Time = new LongTag(\"Time\", $value);\n\t}\n\n\tpublic function getSeed(){\n\t\treturn $this->levelData[\"RandomSeed\"];\n\t}\n\n\tpublic function setSeed($value){\n\t\t$this->levelData->RandomSeed = new LongTag(\"RandomSeed\", (int) $value);\n\t}\n\n\tpublic function getSpawn() : Vector3{\n\t\treturn new Vector3((float) $this->levelData[\"SpawnX\"], (float) $this->levelData[\"SpawnY\"], (float) $this->levelData[\"SpawnZ\"]);\n\t}\n\n\tpublic function setSpawn(Vector3 $pos){\n\t\t$this->levelData->SpawnX = new IntTag(\"SpawnX\", (int) $pos->x);\n\t\t$this->levelData->SpawnY = new IntTag(\"SpawnY\", (int) $pos->y);\n\t\t$this->levelData->SpawnZ = new IntTag(\"SpawnZ\", (int) $pos->z);\n\t}\n\n\tpublic function doGarbageCollection(){\n\n\t}\n\n\t/**\n\t * @return CompoundTag\n\t */\n\tpublic function getLevelData() : CompoundTag{\n\t\treturn $this->levelData;\n\t}\n\n\tpublic function saveLevelData(){\n\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\t$nbt->setData(new CompoundTag(\"\", [\n\t\t\t\"Data\" => $this->levelData\n\t\t]));\n\t\t$buffer = $nbt->writeCompressed();\n\t\tfile_put_contents($this->getPath() . \"level.dat\", $buffer);\n\t}\n\n\tpublic function requestChunkTask(int $x, int $z){\n\t\t$chunk = $this->getChunk($x, $z, false);\n\t\tif(!($chunk instanceof Chunk)){\n\t\t\tthrow new ChunkException(\"Invalid Chunk sent\");\n\t\t}\n\n\t\tif($this->asyncChunkRequest){\n\t\t\treturn new ChunkRequestTask($this->level, $chunk);\n\t\t}\n\n\t\t//non-async, call the callback directly with serialized data\n\t\t$this->getLevel()->chunkRequestCallback($x, $z, $chunk->networkSerialize());\n\n\t\treturn null;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/format/io/ChunkException.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\format\\io;\n\nclass ChunkException extends \\RuntimeException{\n\n}"
  },
  {
    "path": "src/pocketmine/level/format/io/ChunkRequestTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\format\\io;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\scheduler\\AsyncTask;\nuse pocketmine\\Server;\nuse pocketmine\\tile\\Spawnable;\n\nclass ChunkRequestTask extends AsyncTask{\n\n\tprotected $levelId;\n\n\tprotected $chunk;\n\tprotected $chunkX;\n\tprotected $chunkZ;\n\n\tprotected $tiles;\n\n\tpublic function __construct(Level $level, Chunk $chunk){\n\t\t$this->levelId = $level->getId();\n\n\t\t$this->chunk = $chunk->fastSerialize();\n\t\t$this->chunkX = $chunk->getX();\n\t\t$this->chunkZ = $chunk->getZ();\n\n\t\t//TODO: serialize tiles with chunks\n\t\t$tiles = \"\";\n\t\t$nbt = new NBT(NBT::LITTLE_ENDIAN);\n\t\tforeach($chunk->getTiles() as $tile){\n\t\t\tif($tile instanceof Spawnable){\n\t\t\t\t$nbt->setData($tile->getSpawnCompound());\n\t\t\t\t$tiles .= $nbt->write(true);\n\t\t\t}\n\t\t}\n\n\t\t$this->tiles = $tiles;\n\t}\n\n\tpublic function onRun(){\n\t\t$chunk = Chunk::fastDeserialize($this->chunk);\n\n\t\t$ordered = $chunk->networkSerialize() . $this->tiles;\n\n\t\t$this->setResult($ordered, false);\n\t}\n\n\tpublic function onCompletion(Server $server){\n\t\t$level = $server->getLevel($this->levelId);\n\t\tif($level instanceof Level and $this->hasResult()){\n\t\t\t$level->chunkRequestCallback($this->chunkX, $this->chunkZ, $this->getResult());\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/level/format/io/ChunkUtils.php",
    "content": "<?php\n \n /*\n  *\n  *  ____            _        _   __  __ _                  __  __ ____\n  * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n  * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n  * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n  * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n  *\n  * This program is free software: you can redistribute it and/or modify\n  * it under the terms of the GNU Lesser General Public License as published by\n  * the Free Software Foundation, either version 3 of the License, or\n  * (at your option) any later version.\n  *\n  * @author PocketMine Team\n  * @link http://www.pocketmine.net/\n  *\n  *\n */\n \n declare(strict_types = 1);\n \n namespace pocketmine\\level\\format\\io;\n \n class ChunkUtils{\n \n \t/**\n \t * Re-orders a byte array (YZX -> XZY and vice versa)\n \t *\n \t * @param string $array length 4096\n \t *\n \t * @return string length 4096\n \t */\n\tpublic static final function reorderByteArray(string $array) : string{\n\t\t$result = str_repeat(\"\\x00\", 4096);\n \t\tif($array !== $result){\n\t\t\t$i = 0;\n\t\t\t$zM = 0;\n\t\t\t$yM = 0;\n\t\t\tfor($x = 0; $x < 16; ++$x){\n\t\t\t\t$zM = $x + 256;\n\t\t\t\tfor($z = $x; $z < $zM; $z += 16){\n\t\t\t\t\t$yM = $z + 4096;\n\t\t\t\t\tfor($y = $z; $y < $yM; $y += 256){\n \t\t\t\t\t\t$result{$i} = $array{$y};\n\t\t\t\t\t\t++$i;\n\t\t\t\t\t}\n \t\t\t}\n \t\t\t}\n\t\t}\n \t\treturn $result;\n \t}\n\n     /**\n      * Re-orders a nibble array (YZX -> XZY and vice versa)\n      *\n      * @param string $array length 2048\n      *\n      * @param string $commonValue\n      * @return string length 2048\n      */\n \tpublic static final function reorderNibbleArray(string $array, string $commonValue = \"\\x00\") : string{\n \t\t$result = str_repeat($commonValue, 2048);\n\t\tif($array !== $result){\n\t\t\t$i = 0;\n\t\t\tfor($x = 0; $x < 8; ++$x){\n\t\t\t\tfor($z = 0; $z < 16; ++$z){\n\t\t\t\t\t$zx = (($z << 3) | $x);\n\t\t\t\t\tfor($y = 0; $y < 8; ++$y){\n\t\t\t\t\t\t$j = (($y << 8) | $zx);\n\t\t\t\t\t\t$j80 = ($j | 0x80);\n\t\t\t\t\t\tif($array{$j} === $commonValue and $array{$j80} === $commonValue){\n\t\t\t\t\t\t\t//values are already filled\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$i1 = ord($array{$j});\n\t\t\t\t\t\t\t$i2 = ord($array{$j80});\n\t\t\t\t\t\t\t$result{$i}        = chr(($i2 << 4) | ($i1 & 0x0f));\n\t\t\t\t\t\t\t$result{$i | 0x80} = chr(($i1 >> 4) | ($i2 & 0xf0));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$i += 128;\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}\n\t\n \t/**\n \t * Converts pre-MCPE-1.0 biome color array to biome ID array.\n \t *\n \t * @param int[] $array of biome color values\n \t *\n \t * @return string\n \t */\n \tpublic static function convertBiomeColors(array $array) : string{\n \t\t$result = str_repeat(\"\\x00\", 256);\n \t\tforeach($array as $i => $color){\n \t\t\t$result{$i} = chr(($color >> 24) & 0xff);\n \t\t}\n \t\treturn $result;\n \t}\n \n }"
  },
  {
    "path": "src/pocketmine/level/format/io/LevelProvider.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format\\io;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\n\ninterface LevelProvider{\n\n\t/**\n\t * @param Level  $level\n\t * @param string $path\n\t */\n\tpublic function __construct(Level $level, string $path);\n\n\t/**\n\t * Returns the full provider name, like \"anvil\" or \"mcregion\", will be used to find the correct format.\n\t *\n\t * @return string\n\t */\n\tpublic static function getProviderName() : string;\n\n\t/**\n\t * Gets the build height limit of this world\n\t *\n\t * @return int\n\t */\n\tpublic function getWorldHeight() : int;\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getPath() : string;\n\n\t/**\n\t * Tells if the path is a valid level.\n\t * This must tell if the current format supports opening the files in the directory\n\t *\n\t * @param string $path\n\t *\n\t * @return bool\n\t */\n\tpublic static function isValid(string $path) : bool;\n\n\t/**\n\t * Generate the needed files in the path given\n\t *\n\t * @param string     $path\n\t * @param string     $name\n\t * @param int|string $seed\n\t * @param string     $generator\n\t * @param array[]    $options\n\t */\n\tpublic static function generate(string $path, string $name, $seed, string $generator, array $options = []);\n\n\t/**\n\t * Returns the generator name\n\t *\n\t * @return string\n\t */\n\tpublic function getGenerator() : string;\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getGeneratorOptions() : array;\n\n\t/**\n\t * Gets the Chunk object\n\t * This method must be implemented by all the level formats.\n\t *\n\t * @param int  $chunkX\n\t * @param int  $chunkZ\n\t * @param bool $create\n\t *\n\t * @return Chunk|null\n\t */\n\tpublic function getChunk(int $chunkX, int $chunkZ, bool $create = false);\n\n\t/**\n\t * @param int   $chunkX\n\t * @param int   $chunkZ\n\t * @param Chunk $chunk\n\t */\n\tpublic function setChunk(int $chunkX, int $chunkZ, Chunk $chunk);\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return bool\n\t */\n\tpublic function saveChunk(int $chunkX, int $chunkZ) : bool;\n\n\tpublic function saveChunks();\n\n\t/**\n\t * @param int  $chunkX\n\t * @param int  $chunkZ\n\t * @param bool $create\n\t *\n\t * @return bool\n\t */\n\tpublic function loadChunk(int $chunkX, int $chunkZ, bool $create = false) : bool;\n\n\t/**\n\t * @param int  $chunkX\n\t * @param int  $chunkZ\n\t * @param bool $safe\n\t *\n\t * @return bool\n\t */\n\tpublic function unloadChunk(int $chunkX, int $chunkZ, bool $safe = true) : bool;\n\n\tpublic function unloadChunks();\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return bool\n\t */\n\tpublic function isChunkLoaded(int $chunkX, int $chunkZ) : bool;\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return bool\n\t */\n\tpublic function isChunkGenerated(int $chunkX, int $chunkZ) : bool;\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return bool\n\t */\n\tpublic function isChunkPopulated(int $chunkX, int $chunkZ) : bool;\n\n\t/**\n\t * Requests a MC: PE network chunk to be sent\n\t *\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return \\pocketmine\\scheduler\\AsyncTask|null\n\t */\n\tpublic function requestChunkTask(int $x, int $z);\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName();\n\n\t/**\n\t * @return int|string int, or the string numeric representation of a long in 32-bit systems\n\t */\n\tpublic function getTime();\n\n\t/**\n\t * @param int|string $value int, or the string numeric representation of a long in 32-bit systems\n\t */\n\tpublic function setTime($value);\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSeed();\n\n\t/**\n\t * @param int|string $value int, or the string numeric representation of a long in 32-bit systems\n\t */\n\tpublic function setSeed($value);\n\n\t/**\n\t * @return Vector3\n\t */\n\tpublic function getSpawn() : Vector3;\n\n\t/**\n\t * @param Vector3 $pos\n\t */\n\tpublic function setSpawn(Vector3 $pos);\n\n\t/**\n\t * @return Chunk[]\n\t */\n\tpublic function getLoadedChunks() : array;\n\n\tpublic function doGarbageCollection();\n\n\t/**\n\t * @return Level\n\t */\n\tpublic function getLevel();\n\n\tpublic function close();\n\n}"
  },
  {
    "path": "src/pocketmine/level/format/io/LevelProviderManager.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format\\io;\n\nuse pocketmine\\level\\LevelException;\n\nabstract class LevelProviderManager{\n\tprotected static $providers = [];\n\n\t/**\n\t * @param string $class\n\t *\n\t * @throws LevelException\n\t */\n\tpublic static function addProvider(string $class){\n\t\tif(!is_subclass_of($class, LevelProvider::class)){\n\t\t\tthrow new LevelException(\"Class is not a subclass of LevelProvider\");\n\t\t}\n\t\t/** @var LevelProvider $class */\n\t\tself::$providers[strtolower($class::getProviderName())] = $class;\n\t}\n\n\t/**\n\t * Returns a LevelProvider class for this path, or null\n\t *\n\t * @param string $path\n\t *\n\t * @return string|null\n\t */\n\tpublic static function getProvider(string $path){\n\t\tforeach(self::$providers as $provider){\n\t\t\t/** @var $provider LevelProvider */\n\t\t\tif($provider::isValid($path)){\n\t\t\t\treturn $provider;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Returns a LevelProvider by name, or null if not found\n\t *\n\t * @param string $name\n\t *\n\t * @return string|null\n\t */\n\tpublic static function getProviderByName(string $name){\n\t\treturn self::$providers[trim(strtolower($name))] ?? null;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/format/io/region/Anvil.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format\\io\\region;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\format\\io\\ChunkException;\nuse pocketmine\\level\\format\\io\\ChunkUtils;\nuse pocketmine\\level\\format\\SubChunk;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\{\n\tByteArrayTag, ByteTag, CompoundTag, IntArrayTag, IntTag, ListTag, LongTag\n};\nuse pocketmine\\Player;\nuse pocketmine\\utils\\MainLogger;\n\n\nclass Anvil extends McRegion{\n\n\tconst REGION_FILE_EXTENSION = \"mca\";\n\n\tpublic function nbtSerialize(Chunk $chunk) : string{\n\t\t$nbt = new CompoundTag(\"Level\", []);\n\t\t$nbt->xPos = new IntTag(\"xPos\", $chunk->getX());\n\t\t$nbt->zPos = new IntTag(\"zPos\", $chunk->getZ());\n\n\t\t$nbt->V = new ByteTag(\"V\", 1);\n\t\t$nbt->LastUpdate = new LongTag(\"LastUpdate\", 0); //TODO\n\t\t$nbt->InhabitedTime = new LongTag(\"InhabitedTime\", 0); //TODO\n\t\t$nbt->TerrainPopulated = new ByteTag(\"TerrainPopulated\", $chunk->isPopulated());\n\t\t$nbt->LightPopulated = new ByteTag(\"LightPopulated\", $chunk->isLightPopulated());\n\n\t\t$nbt->Sections = new ListTag(\"Sections\", []);\n\t\t$nbt->Sections->setTagType(NBT::TAG_Compound);\n\t\t$subChunks = -1;\n\t\tforeach($chunk->getSubChunks() as $y => $subChunk){\n\t\t\tif($subChunk->isEmpty()){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$nbt->Sections[++$subChunks] = new CompoundTag(null, [\n\t\t\t\t\"Y\"          => new ByteTag(\"Y\", $y),\n\t\t\t\t\"Blocks\"     => new ByteArrayTag(\"Blocks\", ChunkUtils::reorderByteArray($subChunk->getBlockIdArray())), //Generic in-memory chunks are currently always XZY\n\t\t\t\t\"Data\"       => new ByteArrayTag(\"Data\", ChunkUtils::reorderNibbleArray($subChunk->getBlockDataArray())),\n\t\t\t\t\"SkyLight\"   => new ByteArrayTag(\"SkyLight\", ChunkUtils::reorderNibbleArray($subChunk->getSkyLightArray(), \"\\xff\")),\n\t\t\t\t\"BlockLight\" => new ByteArrayTag(\"BlockLight\", ChunkUtils::reorderNibbleArray($subChunk->getBlockLightArray()))\n\t\t\t]);\n\t\t}\n\n\t\t$nbt->Biomes = new ByteArrayTag(\"Biomes\", $chunk->getBiomeIdArray());\n\t\t$nbt->HeightMap = new IntArrayTag(\"HeightMap\", $chunk->getHeightMapArray());\n\n\t\t$entities = [];\n\n\t\tforeach($chunk->getEntities() as $entity){\n\t\t\tif(!($entity instanceof Player) and !$entity->closed){\n\t\t\t\t$entity->saveNBT();\n\t\t\t\t$entities[] = $entity->namedtag;\n\t\t\t}\n\t\t}\n\n\t\t$nbt->Entities = new ListTag(\"Entities\", $entities);\n\t\t$nbt->Entities->setTagType(NBT::TAG_Compound);\n\n\t\t$tiles = [];\n\t\tforeach($chunk->getTiles() as $tile){\n\t\t\t$tile->saveNBT();\n\t\t\t$tiles[] = $tile->namedtag;\n\t\t}\n\n\t\t$nbt->TileEntities = new ListTag(\"TileEntities\", $tiles);\n\t\t$nbt->TileEntities->setTagType(NBT::TAG_Compound);\n\n\t\t//TODO: TileTicks\n\n\t\t$writer = new NBT(NBT::BIG_ENDIAN);\n\t\t$nbt->setName(\"Level\");\n\t\t$writer->setData(new CompoundTag(\"\", [\"Level\" => $nbt]));\n\n\t\treturn $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);\n\t}\n\n\tpublic function nbtDeserialize(string $data){\n\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\ttry{\n\t\t\t$nbt->readCompressed($data, ZLIB_ENCODING_DEFLATE);\n\n\t\t\t$chunk = $nbt->getData();\n\n\t\t\tif(!isset($chunk->Level) or !($chunk->Level instanceof CompoundTag)){\n\t\t\t\tthrow new ChunkException(\"Invalid NBT format\");\n\t\t\t}\n\n\t\t\t$chunk = $chunk->Level;\n\n\t\t\t$subChunks = [];\n\t\t\tif($chunk->Sections instanceof ListTag){\n\t\t\t\tforeach($chunk->Sections as $subChunk){\n\t\t\t\t\tif($subChunk instanceof CompoundTag){\n\t\t\t\t\t\t$subChunks[$subChunk->Y->getValue()] = new SubChunk(\n\t\t\t\t\t\t\tChunkUtils::reorderByteArray($subChunk->Blocks->getValue()),\n\t\t\t\t\t\t\tChunkUtils::reorderNibbleArray($subChunk->Data->getValue()),\n\t\t\t\t\t\t\tChunkUtils::reorderNibbleArray($subChunk->SkyLight->getValue(), \"\\xff\"),\n\t\t\t\t\t\t\tChunkUtils::reorderNibbleArray($subChunk->BlockLight->getValue())\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(isset($chunk->BiomeColors)){\n\t\t\t\t$biomeIds = ChunkUtils::convertBiomeColors($chunk->BiomeColors->getValue()); //Convert back to PC format (RIP colours D:)\n\t\t\t}elseif(isset($chunk->Biomes)){\n\t\t\t\t$biomeIds = $chunk->Biomes->getValue();\n\t\t\t}else{\n\t\t\t\t$biomeIds = \"\";\n\t\t\t}\n\n\t\t\t$result = new Chunk(\n\t\t\t\t$this,\n\t\t\t\t$chunk[\"xPos\"],\n\t\t\t\t$chunk[\"zPos\"],\n\t\t\t\t$subChunks,\n\t\t\t\tisset($chunk->Entities) ? $chunk->Entities->getValue() : [],\n\t\t\t\tisset($chunk->TileEntities) ? $chunk->TileEntities->getValue() : [],\n\t\t\t\t$biomeIds,\n\t\t\t\tisset($chunk->HeightMap) ? $chunk->HeightMap->getValue() : []\n\t\t\t);\n\t\t\t$result->setLightPopulated(isset($chunk->LightPopulated) ? ((bool) $chunk->LightPopulated->getValue()) : false);\n\t\t\t$result->setPopulated(isset($chunk->TerrainPopulated) ? ((bool) $chunk->TerrainPopulated->getValue()) : false);\n\t\t\t$result->setGenerated(true);\n\t\t\treturn $result;\n\t\t}catch(\\Throwable $e){\n\t\t\tMainLogger::getLogger()->logException($e);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic static function getProviderName() : string{\n\t\treturn \"anvil\";\n\t}\n\n\tpublic function getWorldHeight() : int{\n\t\t//TODO: add world height options\n\t\treturn 256;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/format/io/region/McRegion.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format\\io\\region;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\format\\io\\BaseLevelProvider;\nuse pocketmine\\level\\format\\io\\ChunkException;\nuse pocketmine\\level\\format\\io\\ChunkUtils;\nuse pocketmine\\level\\format\\SubChunk;\nuse pocketmine\\level\\generator\\Generator;\nuse pocketmine\\level\\Level;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\{\n\tByteArrayTag, ByteTag, CompoundTag, IntArrayTag, IntTag, ListTag, LongTag, StringTag\n};\nuse pocketmine\\Player;\nuse pocketmine\\utils\\MainLogger;\n\nclass McRegion extends BaseLevelProvider{\n\n\tconst REGION_FILE_EXTENSION = \"mcr\";\n\n\t/** @var RegionLoader[] */\n\tprotected $regions = [];\n\n\t/** @var Chunk[] */\n\tprotected $chunks = [];\n\n\t/**\n\t * @param Chunk $chunk\n\t *\n\t * @return string\n\t */\n\tpublic function nbtSerialize(Chunk $chunk) : string{\n\t\t$nbt = new CompoundTag(\"Level\", []);\n\t\t$nbt->xPos = new IntTag(\"xPos\", $chunk->getX());\n\t\t$nbt->zPos = new IntTag(\"zPos\", $chunk->getZ());\n\n\t\t$nbt->V = new ByteTag(\"V\", 0); //guess\n\t\t$nbt->LastUpdate = new LongTag(\"LastUpdate\", 0); //TODO\n\t\t$nbt->InhabitedTime = new LongTag(\"InhabitedTime\", 0); //TODO\n\t\t$nbt->TerrainPopulated = new ByteTag(\"TerrainPopulated\", $chunk->isPopulated());\n\t\t$nbt->LightPopulated = new ByteTag(\"LightPopulated\", $chunk->isLightPopulated());\n\n\t\t$ids = \"\";\n\t\t$data = \"\";\n\t\t$skyLight = \"\";\n\t\t$blockLight = \"\";\n\t\t$subChunks = $chunk->getSubChunks();\n\t\tfor($x = 0; $x < 16; ++$x){\n\t\t\tfor($z = 0; $z < 16; ++$z){\n\t\t\t\tfor($y = 0; $y < 8; ++$y){\n\t\t\t\t\t$subChunk = $subChunks[$y];\n\t\t\t\t\t$ids .= $subChunk->getBlockIdColumn($x, $z);\n\t\t\t\t\t$data .= $subChunk->getBlockDataColumn($x, $z);\n\t\t\t\t\t$skyLight .= $subChunk->getSkyLightColumn($x, $z);\n\t\t\t\t\t$blockLight .= $subChunk->getBlockLightColumn($x, $z);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$nbt->Blocks = new ByteArrayTag(\"Blocks\", $ids);\n\t\t$nbt->Data = new ByteArrayTag(\"Data\", $data);\n\t\t$nbt->SkyLight = new ByteArrayTag(\"SkyLight\", $skyLight);\n\t\t$nbt->BlockLight = new ByteArrayTag(\"BlockLight\", $blockLight);\n\n\t\t$nbt->Biomes = new ByteArrayTag(\"Biomes\", $chunk->getBiomeIdArray());\n\t\t$nbt->HeightMap = new ByteArrayTag(\"HeightMap\", pack(\"C*\", ...$chunk->getHeightMapArray()));\n\n\t\t$entities = [];\n\n\t\tforeach($chunk->getEntities() as $entity){\n\t\t\tif(!($entity instanceof Player) and !$entity->closed){\n\t\t\t\t$entity->saveNBT();\n\t\t\t\t$entities[] = $entity->namedtag;\n\t\t\t}\n\t\t}\n\n\t\t$nbt->Entities = new ListTag(\"Entities\", $entities);\n\t\t$nbt->Entities->setTagType(NBT::TAG_Compound);\n\n\t\t$tiles = [];\n\t\tforeach($chunk->getTiles() as $tile){\n\t\t\t$tile->saveNBT();\n\t\t\t$tiles[] = $tile->namedtag;\n\t\t}\n\n\t\t$nbt->TileEntities = new ListTag(\"TileEntities\", $tiles);\n\t\t$nbt->TileEntities->setTagType(NBT::TAG_Compound);\n\n\t\t//TODO: TileTicks\n\n\t\t$writer = new NBT(NBT::BIG_ENDIAN);\n\t\t$nbt->setName(\"Level\");\n\t\t$writer->setData(new CompoundTag(\"\", [\"Level\" => $nbt]));\n\n\t\treturn $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);\n\t}\n\n\t/**\n\t * @param string $data\n\t *\n\t * @return Chunk|null\n\t */\n\tpublic function nbtDeserialize(string $data){\n\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\ttry{\n\t\t\t$nbt->readCompressed($data, ZLIB_ENCODING_DEFLATE);\n\n\t\t\t$chunk = $nbt->getData();\n\n\t\t\tif(!isset($chunk->Level) or !($chunk->Level instanceof CompoundTag)){\n\t\t\t\tthrow new ChunkException(\"Invalid NBT format\");\n\t\t\t}\n\n\t\t\t$chunk = $chunk->Level;\n\n\t\t\t$subChunks = [];\n\t\t\t$fullIds = isset($chunk->Blocks) ? $chunk->Blocks->getValue() : str_repeat(\"\\x00\", 32768);\n\t\t\t$fullData = isset($chunk->Data) ? $chunk->Data->getValue() : (str_repeat(\"\\x00\", 16384));\n\t\t\t$fullSkyLight = isset($chunk->SkyLight) ? $chunk->SkyLight->getValue() : str_repeat(\"\\xff\", 16384);\n\t\t\t$fullBlockLight = isset($chunk->BlockLight) ? $chunk->BlockLight->getValue() : (str_repeat(\"\\x00\", 16384));\n\n\t\t\tfor($y = 0; $y < 8; ++$y){\n\t\t\t\t$offset = ($y << 4);\n\t\t\t\t$ids = \"\";\n\t\t\t\tfor($i = 0; $i < 256; ++$i){\n\t\t\t\t\t$ids .= substr($fullIds, $offset, 16);\n\t\t\t\t\t$offset += 128;\n\t\t\t\t}\n\t\t\t\t$data = \"\";\n\t\t\t\t$offset = ($y << 3);\n\t\t\t\tfor($i = 0; $i < 256; ++$i){\n\t\t\t\t\t$data .= substr($fullData, $offset, 8);\n\t\t\t\t\t$offset += 64;\n\t\t\t\t}\n\t\t\t\t$skyLight = \"\";\n\t\t\t\t$offset = ($y << 3);\n\t\t\t\tfor($i = 0; $i < 256; ++$i){\n\t\t\t\t\t$skyLight .= substr($fullSkyLight, $offset, 8);\n\t\t\t\t\t$offset += 64;\n\t\t\t\t}\n\t\t\t\t$blockLight = \"\";\n\t\t\t\t$offset = ($y << 3);\n\t\t\t\tfor($i = 0; $i < 256; ++$i){\n\t\t\t\t\t$blockLight .= substr($fullBlockLight, $offset, 8);\n\t\t\t\t\t$offset += 64;\n\t\t\t\t}\n\t\t\t\t$subChunks[$y] = new SubChunk($ids, $data, $skyLight, $blockLight);\n\t\t\t}\n\n\t\t\tif(isset($chunk->BiomeColors)){\n\t\t\t\t$biomeIds = ChunkUtils::convertBiomeColors($chunk->BiomeColors->getValue()); //Convert back to original format\n\t\t\t}elseif(isset($chunk->Biomes)){\n\t\t\t\t$biomeIds = $chunk->Biomes->getValue();\n\t\t\t}else{\n\t\t\t\t$biomeIds = \"\";\n\t\t\t}\n\n\t\t\t$heightMap = [];\n\t\t\tif(isset($chunk->HeightMap)){\n\t\t\t\tif($chunk->HeightMap instanceof ByteArrayTag){\n\t\t\t\t\t$heightMap = array_values(unpack(\"C*\", $chunk->HeightMap->getValue()));\n\t\t\t\t}elseif($chunk->HeightMap instanceof IntArrayTag){\n\t\t\t\t\t$heightMap = $chunk->HeightMap->getValue(); #blameshoghicp\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$result = new Chunk(\n\t\t\t\t$this,\n\t\t\t\t$chunk[\"xPos\"],\n\t\t\t\t$chunk[\"zPos\"],\n\t\t\t\t$subChunks,\n\t\t\t\tisset($chunk->Entities) ? $chunk->Entities->getValue() : [],\n\t\t\t\tisset($chunk->TileEntities) ? $chunk->TileEntities->getValue() : [],\n\t\t\t\t$biomeIds,\n\t\t\t\t$heightMap\n\t\t\t);\n\t\t\t$result->setLightPopulated(isset($chunk->LightPopulated) ? ((bool) $chunk->LightPopulated->getValue()) : false);\n\t\t\t$result->setPopulated(isset($chunk->TerrainPopulated) ? ((bool) $chunk->TerrainPopulated->getValue()) : false);\n\t\t\t$result->setGenerated(true);\n\t\t\treturn $result;\n\t\t}catch(\\Throwable $e){\n\t\t\tMainLogger::getLogger()->logException($e);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic static function getProviderName() : string{\n\t\treturn \"mcregion\";\n\t}\n\n\tpublic function getWorldHeight() : int{\n\t\t//TODO: add world height options\n\t\treturn 128;\n\t}\n\n\tpublic static function isValid(string $path) : bool{\n\t\t$isValid = (file_exists($path . \"/level.dat\") and is_dir($path . \"/region/\"));\n\n\t\tif($isValid){\n\t\t\t$files = glob($path . \"/region/*.mc*\");\n\t\t\tif(empty($files)){ //possible glob() issue on some systems\n\t\t\t\t$files = array_filter(scandir($path . \"/region/\"), function($file){\n\t\t\t\t\treturn substr($file, strrpos($file, \".\") + 1, 2) === \"mc\"; //region file\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tforeach($files as $f){\n\t\t\t\tif(substr($f, strrpos($f, \".\") + 1) !== static::REGION_FILE_EXTENSION){\n\t\t\t\t\t$isValid = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $isValid;\n\t}\n\n\tpublic static function generate(string $path, string $name, $seed, string $generator, array $options = []){\n\t\tif(!file_exists($path)){\n\t\t\tmkdir($path, 0777, true);\n\t\t}\n\n\t\tif(!file_exists($path . \"/region\")){\n\t\t\tmkdir($path . \"/region\", 0777);\n\t\t}\n\t\t//TODO, add extra details\n\t\t$levelData = new CompoundTag(\"Data\", [\n\t\t\t\"hardcore\" => new ByteTag(\"hardcore\", 0),\n\t\t\t\"initialized\" => new ByteTag(\"initialized\", 1),\n\t\t\t\"GameType\" => new IntTag(\"GameType\", 0),\n\t\t\t\"generatorVersion\" => new IntTag(\"generatorVersion\", 1), //2 in MCPE\n\t\t\t\"SpawnX\" => new IntTag(\"SpawnX\", 256),\n\t\t\t\"SpawnY\" => new IntTag(\"SpawnY\", 70),\n\t\t\t\"SpawnZ\" => new IntTag(\"SpawnZ\", 256),\n\t\t\t\"version\" => new IntTag(\"version\", 19133),\n\t\t\t\"DayTime\" => new IntTag(\"DayTime\", 0),\n\t\t\t\"LastPlayed\" => new LongTag(\"LastPlayed\", microtime(true) * 1000),\n\t\t\t\"RandomSeed\" => new LongTag(\"RandomSeed\", $seed),\n\t\t\t\"SizeOnDisk\" => new LongTag(\"SizeOnDisk\", 0),\n\t\t\t\"Time\" => new LongTag(\"Time\", 0),\n\t\t\t\"generatorName\" => new StringTag(\"generatorName\", Generator::getGeneratorName($generator)),\n\t\t\t\"generatorOptions\" => new StringTag(\"generatorOptions\", isset($options[\"preset\"]) ? $options[\"preset\"] : \"\"),\n\t\t\t\"LevelName\" => new StringTag(\"LevelName\", $name),\n\t\t\t\"GameRules\" => new CompoundTag(\"GameRules\", [])\n\t\t]);\n\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\t$nbt->setData(new CompoundTag(\"\", [\n\t\t\t\"Data\" => $levelData\n\t\t]));\n\t\t$buffer = $nbt->writeCompressed();\n\t\tfile_put_contents($path . \"level.dat\", $buffer);\n\t}\n\n\tpublic function getGenerator() : string{\n\t\treturn (string) $this->levelData[\"generatorName\"];\n\t}\n\n\tpublic function getGeneratorOptions() : array{\n\t\treturn [\"preset\" => $this->levelData[\"generatorOptions\"]];\n\t}\n\n\tpublic function getChunk(int $chunkX, int $chunkZ, bool $create = false){\n\t\t$index = Level::chunkHash($chunkX, $chunkZ);\n\t\tif(isset($this->chunks[$index])){\n\t\t\treturn $this->chunks[$index];\n\t\t}else{\n\t\t\t$this->loadChunk($chunkX, $chunkZ, $create);\n\n\t\t\treturn $this->chunks[$index] ?? null;\n\t\t}\n\t}\n\n\tpublic function setChunk(int $chunkX, int $chunkZ, Chunk $chunk){\n\n\t\t$chunk->setProvider($this);\n\n\t\tself::getRegionIndex($chunkX, $chunkZ, $regionX, $regionZ);\n\t\t$this->loadRegion($regionX, $regionZ);\n\n\t\t$chunk->setX($chunkX);\n\t\t$chunk->setZ($chunkZ);\n\n\n\t\tif(isset($this->chunks[$index = Level::chunkHash($chunkX, $chunkZ)]) and $this->chunks[$index] !== $chunk){\n\t\t\t$this->unloadChunk($chunkX, $chunkZ, false);\n\t\t}\n\n\t\t$this->chunks[$index] = $chunk;\n\t}\n\n\tpublic function saveChunk(int $chunkX, int $chunkZ) : bool{\n\t\tif($this->isChunkLoaded($chunkX, $chunkZ)){\n\t\t\t$this->getRegion($chunkX >> 5, $chunkZ >> 5)->writeChunk($this->getChunk($chunkX, $chunkZ));\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function saveChunks(){\n\t\tforeach($this->chunks as $chunk){\n\t\t\t$this->saveChunk($chunk->getX(), $chunk->getZ());\n\t\t}\n\t}\n\n\tpublic function loadChunk(int $chunkX, int $chunkZ, bool $create = false) : bool{\n\t\t$index = Level::chunkHash($chunkX, $chunkZ);\n\t\tif(isset($this->chunks[$index])){\n\t\t\treturn true;\n\t\t}\n\t\t$regionX = $regionZ = null;\n\t\tself::getRegionIndex($chunkX, $chunkZ, $regionX, $regionZ);\n\t\t/** @noinspection PhpStrictTypeCheckingInspection */\n\t\t$this->loadRegion($regionX, $regionZ);\n\t\t$this->level->timings->syncChunkLoadDataTimer->startTiming();\n\t\t/** @noinspection PhpStrictTypeCheckingInspection */\n\t\t$chunk = $this->getRegion($regionX, $regionZ)->readChunk($chunkX - $regionX * 32, $chunkZ - $regionZ * 32);\n\t\tif($chunk === null and $create){\n\t\t\t$chunk = $this->getEmptyChunk($chunkX, $chunkZ);\n\t\t}\n\t\t$this->level->timings->syncChunkLoadDataTimer->stopTiming();\n\n\t\tif($chunk !== null){\n\t\t\t$this->chunks[$index] = $chunk;\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic function unloadChunk(int $chunkX, int $chunkZ, bool $safe = true) : bool{\n\t\t$chunk = $this->chunks[$index = Level::chunkHash($chunkX, $chunkZ)] ?? null;\n\t\tif($chunk instanceof Chunk and $chunk->unload(false, $safe)){\n\t\t\tunset($this->chunks[$index]);\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function unloadChunks(){\n\t\tforeach($this->chunks as $chunk){\n\t\t\t$this->unloadChunk($chunk->getX(), $chunk->getZ(), false);\n\t\t}\n\t\t$this->chunks = [];\n\t}\n\n\tpublic function isChunkLoaded(int $chunkX, int $chunkZ) : bool{\n\t\treturn isset($this->chunks[Level::chunkHash($chunkX, $chunkZ)]);\n\t}\n\n\tpublic function isChunkGenerated(int $chunkX, int $chunkZ) : bool{\n\t\tif(($region = $this->getRegion($chunkX >> 5, $chunkZ >> 5)) !== null){\n\t\t\treturn $region->chunkExists($chunkX - $region->getX() * 32, $chunkZ - $region->getZ() * 32) and $this->getChunk($chunkX - $region->getX() * 32, $chunkZ - $region->getZ() * 32, true)->isGenerated();\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function isChunkPopulated(int $chunkX, int $chunkZ) : bool{\n\t\t$chunk = $this->getChunk($chunkX, $chunkZ);\n\t\tif($chunk !== null){\n\t\t\treturn $chunk->isPopulated();\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tpublic function getLoadedChunks() : array{\n\t\treturn $this->chunks;\n\t}\n\n\tpublic function doGarbageCollection(){\n\t\t$limit = time() - 300;\n\t\tforeach($this->regions as $index => $region){\n\t\t\tif($region->lastUsed <= $limit){\n\t\t\t\t$region->close();\n\t\t\t\tunset($this->regions[$index]);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t * @param int &$x\n\t * @param int &$z\n\t */\n\tpublic static function getRegionIndex(int $chunkX, int $chunkZ, &$x, &$z){\n\t\t$x = $chunkX >> 5;\n\t\t$z = $chunkZ >> 5;\n\t}\n\n\t/**\n\t * @param int $chunkX\n\t * @param int $chunkZ\n\t *\n\t * @return Chunk\n\t */\n\tpublic function getEmptyChunk(int $chunkX, int $chunkZ){\n\t\treturn Chunk::getEmptyChunk($chunkX, $chunkZ, $this);\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t *\n\t * @return RegionLoader\n\t */\n\tprotected function getRegion(int $x, int $z){\n\t\treturn $this->regions[Level::chunkHash($x, $z)] ?? null;\n\t}\n\n\t/**\n\t * @param int $x\n\t * @param int $z\n\t */\n\tprotected function loadRegion(int $x, int $z){\n\t\tif(!isset($this->regions[$index = Level::chunkHash($x, $z)])){\n\t\t\t$this->regions[$index] = new RegionLoader($this, $x, $z, static::REGION_FILE_EXTENSION);\n\t\t}\n\t}\n\n\tpublic function close(){\n\t\t$this->unloadChunks();\n\t\tforeach($this->regions as $index => $region){\n\t\t\t$region->close();\n\t\t\tunset($this->regions[$index]);\n\t\t}\n\t\t$this->level = null;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/format/io/region/PMAnvil.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format\\io\\region;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\format\\io\\ChunkException;\nuse pocketmine\\level\\format\\SubChunk;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\{\n\tByteArrayTag, ByteTag, CompoundTag, IntArrayTag, IntTag, ListTag, LongTag\n};\nuse pocketmine\\Player;\nuse pocketmine\\utils\\MainLogger;\n\n/**\n * This format is exactly the same as the PC Anvil format, with the only difference being that the stored data order\n * is XZY instead of YZX for more performance loading and saving worlds.\n */\nclass PMAnvil extends Anvil{\n\n\tconst REGION_FILE_EXTENSION = \"mcapm\";\n\n\tpublic function nbtSerialize(Chunk $chunk) : string{\n\t\t$nbt = new CompoundTag(\"Level\", []);\n\t\t$nbt->xPos = new IntTag(\"xPos\", $chunk->getX());\n\t\t$nbt->zPos = new IntTag(\"zPos\", $chunk->getZ());\n\n\t\t$nbt->V = new ByteTag(\"V\", 1);\n\t\t$nbt->LastUpdate = new LongTag(\"LastUpdate\", 0); //TODO\n\t\t$nbt->InhabitedTime = new LongTag(\"InhabitedTime\", 0); //TODO\n\t\t$nbt->TerrainPopulated = new ByteTag(\"TerrainPopulated\", $chunk->isPopulated());\n\t\t$nbt->LightPopulated = new ByteTag(\"LightPopulated\", $chunk->isLightPopulated());\n\n\t\t$nbt->Sections = new ListTag(\"Sections\", []);\n\t\t$nbt->Sections->setTagType(NBT::TAG_Compound);\n\t\t$subChunks = -1;\n\t\tforeach($chunk->getSubChunks() as $y => $subChunk){\n\t\t\tif($subChunk->isEmpty()){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$nbt->Sections[++$subChunks] = new CompoundTag(null, [\n\t\t\t\t\"Y\"          => new ByteTag(\"Y\", $y),\n\t\t\t\t\"Blocks\"     => new ByteArrayTag(\"Blocks\",     $subChunk->getBlockIdArray()),\n\t\t\t\t\"Data\"       => new ByteArrayTag(\"Data\",       $subChunk->getBlockDataArray()),\n\t\t\t\t\"SkyLight\"   => new ByteArrayTag(\"SkyLight\",   $subChunk->getSkyLightArray()),\n\t\t\t\t\"BlockLight\" => new ByteArrayTag(\"BlockLight\", $subChunk->getBlockLightArray())\n\t\t\t]);\n\t\t}\n\n\t\t$nbt->Biomes = new ByteArrayTag(\"Biomes\", $chunk->getBiomeIdArray());\n\t\t$nbt->HeightMap = new IntArrayTag(\"HeightMap\", $chunk->getHeightMapArray());\n\n\t\t$entities = [];\n\n\t\tforeach($chunk->getEntities() as $entity){\n\t\t\tif(!($entity instanceof Player) and !$entity->closed){\n\t\t\t\t$entity->saveNBT();\n\t\t\t\t$entities[] = $entity->namedtag;\n\t\t\t}\n\t\t}\n\n\t\t$nbt->Entities = new ListTag(\"Entities\", $entities);\n\t\t$nbt->Entities->setTagType(NBT::TAG_Compound);\n\n\t\t$tiles = [];\n\t\tforeach($chunk->getTiles() as $tile){\n\t\t\t$tile->saveNBT();\n\t\t\t$tiles[] = $tile->namedtag;\n\t\t}\n\n\t\t$nbt->TileEntities = new ListTag(\"TileEntities\", $tiles);\n\t\t$nbt->TileEntities->setTagType(NBT::TAG_Compound);\n\n\t\t//TODO: TileTicks\n\n\t\t$writer = new NBT(NBT::BIG_ENDIAN);\n\t\t$nbt->setName(\"Level\");\n\t\t$writer->setData(new CompoundTag(\"\", [\"Level\" => $nbt]));\n\n\t\treturn $writer->writeCompressed(ZLIB_ENCODING_DEFLATE, RegionLoader::$COMPRESSION_LEVEL);\n\t}\n\n\tpublic function nbtDeserialize(string $data){\n\t\t$nbt = new NBT(NBT::BIG_ENDIAN);\n\t\ttry{\n\t\t\t$nbt->readCompressed($data, ZLIB_ENCODING_DEFLATE);\n\n\t\t\t$chunk = $nbt->getData();\n\n\t\t\tif(!isset($chunk->Level) or !($chunk->Level instanceof CompoundTag)){\n\t\t\t\tthrow new ChunkException(\"Invalid NBT format\");\n\t\t\t}\n\n\t\t\t$chunk = $chunk->Level;\n\n\t\t\t$subChunks = [];\n\t\t\tif($chunk->Sections instanceof ListTag){\n\t\t\t\tforeach($chunk->Sections as $subChunk){\n\t\t\t\t\tif($subChunk instanceof CompoundTag){\n\t\t\t\t\t\t$subChunks[$subChunk->Y->getValue()] = new SubChunk(\n\t\t\t\t\t\t\t$subChunk->Blocks->getValue(),\n\t\t\t\t\t\t\t$subChunk->Data->getValue(),\n\t\t\t\t\t\t\t$subChunk->SkyLight->getValue(),\n\t\t\t\t\t\t\t$subChunk->BlockLight->getValue()\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$result = new Chunk(\n\t\t\t\t$this,\n\t\t\t\t$chunk[\"xPos\"],\n\t\t\t\t$chunk[\"zPos\"],\n\t\t\t\t$subChunks,\n\t\t\t\tisset($chunk->Entities) ? $chunk->Entities->getValue() : [],\n\t\t\t\tisset($chunk->TileEntities) ? $chunk->TileEntities->getValue() : [],\n\t\t\t\tisset($chunk->Biomes) ? $chunk->Biomes->getValue() : \"\",\n\t\t\t\tisset($chunk->HeightMap) ? $chunk->HeightMap->getValue() : []\n\t\t\t);\n\t\t\t$result->setLightPopulated(isset($chunk->LightPopulated) ? ((bool) $chunk->LightPopulated->getValue()) : false);\n\t\t\t$result->setPopulated(isset($chunk->TerrainPopulated) ? ((bool) $chunk->TerrainPopulated->getValue()) : false);\n\t\t\t$result->setGenerated(true);\n\t\t\treturn $result;\n\t\t}catch(\\Throwable $e){\n\t\t\tMainLogger::getLogger()->logException($e);\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic static function getProviderName() : string{\n\t\treturn \"pmanvil\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/format/io/region/RegionLoader.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\ndeclare(strict_types = 1);\n\nnamespace pocketmine\\level\\format\\io\\region;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\format\\io\\ChunkException;\nuse pocketmine\\utils\\Binary;\nuse pocketmine\\utils\\MainLogger;\n\nclass RegionLoader{\n\tconst VERSION = 1;\n\tconst COMPRESSION_GZIP = 1;\n\tconst COMPRESSION_ZLIB = 2;\n\tconst MAX_SECTOR_LENGTH = 256 << 12; //256 sectors, (1 MiB)\n\tpublic static $COMPRESSION_LEVEL = 7;\n\n\tprotected $x;\n\tprotected $z;\n\tprotected $filePath;\n\tprotected $filePointer;\n\tprotected $lastSector;\n\t/** @var LevelProvider */\n\tprotected $levelProvider;\n\tprotected $locationTable = [];\n\n\tpublic $lastUsed;\n\n\tpublic function __construct(McRegion $level, int $regionX, int $regionZ, string $fileExtension = McRegion::REGION_FILE_EXTENSION){\n\t\t$this->x = $regionX;\n\t\t$this->z = $regionZ;\n\t\t$this->levelProvider = $level;\n\t\t$this->filePath = $this->levelProvider->getPath() . \"region/r.$regionX.$regionZ.$fileExtension\";\n\t\t$exists = file_exists($this->filePath);\n\t\tif(!$exists){\n\t\t\ttouch($this->filePath);\n\t\t}\n\t\t$this->filePointer = fopen($this->filePath, \"r+b\");\n\t\tstream_set_read_buffer($this->filePointer, 1024 * 16); //16KB\n\t\tstream_set_write_buffer($this->filePointer, 1024 * 16); //16KB\n\t\tif(!$exists){\n\t\t\t$this->createBlank();\n\t\t}else{\n\t\t\t$this->loadLocationTable();\n\t\t}\n\n\t\t$this->lastUsed = time();\n\t}\n\n\tpublic function __destruct(){\n\t\tif(is_resource($this->filePointer)){\n\t\t\t$this->writeLocationTable();\n\t\t\tfclose($this->filePointer);\n\t\t}\n\t}\n\n\tprotected function isChunkGenerated(int $index) : bool{\n\t\treturn !($this->locationTable[$index][0] === 0 or $this->locationTable[$index][1] === 0);\n\t}\n\n\tpublic function readChunk(int $x, int $z){\n\t\t$index = self::getChunkOffset($x, $z);\n\t\tif($index < 0 or $index >= 4096){\n\t\t\treturn null;\n\t\t}\n\n\t\t$this->lastUsed = time();\n\n\t\tif(!$this->isChunkGenerated($index)){\n\t\t\treturn null;\n\t\t}\n\n\t\tfseek($this->filePointer, $this->locationTable[$index][0] << 12);\n\t\t$length = Binary::readInt(fread($this->filePointer, 4));\n\t\t$compression = ord(fgetc($this->filePointer));\n\n\t\tif($length <= 0 or $length > self::MAX_SECTOR_LENGTH){ //Not yet generated / corrupted\n\t\t\tif($length >= self::MAX_SECTOR_LENGTH){\n\t\t\t\t$this->locationTable[$index][0] = ++$this->lastSector;\n\t\t\t\t$this->locationTable[$index][1] = 1;\n\t\t\t\tMainLogger::getLogger()->error(\"Corrupted chunk header detected\");\n\t\t\t}\n\t\t\treturn null;\n\t\t}\n\n\t\tif($length > ($this->locationTable[$index][1] << 12)){ //Invalid chunk, bigger than defined number of sectors\n\t\t\tMainLogger::getLogger()->error(\"Corrupted bigger chunk detected\");\n\t\t\t$this->locationTable[$index][1] = $length >> 12;\n\t\t\t$this->writeLocationIndex($index);\n\t\t}elseif($compression !== self::COMPRESSION_ZLIB and $compression !== self::COMPRESSION_GZIP){\n\t\t\tMainLogger::getLogger()->error(\"Invalid compression type\");\n\t\t\treturn null;\n\t\t}\n\n\t\t$chunk = $this->levelProvider->nbtDeserialize(fread($this->filePointer, $length - 1));\n\t\tif($chunk instanceof Chunk){\n\t\t\treturn $chunk;\n\t\t}else{\n\t\t\tMainLogger::getLogger()->error(\"Corrupted chunk detected\");\n\t\t\treturn null;\n\t\t}\n\t}\n\n\tpublic function chunkExists(int $x, int $z) : bool{\n\t\treturn $this->isChunkGenerated(self::getChunkOffset($x, $z));\n\t}\n\n\tprotected function saveChunk(int $x, int $z, string $chunkData){\n\t\t$length = strlen($chunkData) + 1;\n\t\tif($length + 4 > self::MAX_SECTOR_LENGTH){\n\t\t\tthrow new ChunkException(\"Chunk is too big! \".($length + 4).\" > \".self::MAX_SECTOR_LENGTH);\n\t\t}\n\t\t$sectors = (int) ceil(($length + 4) / 4096);\n\t\t$index = self::getChunkOffset($x, $z);\n\t\t$indexChanged = false;\n\t\tif($this->locationTable[$index][1] < $sectors){\n\t\t\t$this->locationTable[$index][0] = $this->lastSector + 1;\n\t\t\t$this->lastSector += $sectors; //The GC will clean this shift \"later\"\n\t\t\t$indexChanged = true;\n\t\t}elseif($this->locationTable[$index][1] != $sectors){\n\t\t\t$indexChanged = true;\n\t\t}\n\n\t\t$this->locationTable[$index][1] = $sectors;\n\t\t$this->locationTable[$index][2] = time();\n\n\t\tfseek($this->filePointer, $this->locationTable[$index][0] << 12);\n\t\tfwrite($this->filePointer, str_pad(Binary::writeInt($length) . chr(self::COMPRESSION_ZLIB) . $chunkData, $sectors << 12, \"\\x00\", STR_PAD_RIGHT));\n\n\t\tif($indexChanged){\n\t\t\t$this->writeLocationIndex($index);\n\t\t}\n\t}\n\n\tpublic function removeChunk(int $x, int $z){\n\t\t$index = self::getChunkOffset($x, $z);\n\t\t$this->locationTable[$index][0] = 0;\n\t\t$this->locationTable[$index][1] = 0;\n\t}\n\n\tpublic function writeChunk(Chunk $chunk){\n\t\t$this->lastUsed = time();\n\t\t$chunkData = $this->levelProvider->nbtSerialize($chunk);\n\t\tif($chunkData !== false){\n\t\t\t$this->saveChunk($chunk->getX() - ($this->getX() * 32), $chunk->getZ() - ($this->getZ() * 32), $chunkData);\n\t\t}\n\t}\n\n\tprotected static function getChunkOffset(int $x, int $z) : int{\n\t\treturn $x + ($z << 5);\n\t}\n\n\tpublic function close(){\n\t\t$this->writeLocationTable();\n\t\tfclose($this->filePointer);\n\t\t$this->levelProvider = null;\n\t}\n\n\tpublic function doSlowCleanUp() : int{\n\t\tfor($i = 0; $i < 1024; ++$i){\n\t\t\tif($this->locationTable[$i][0] === 0 or $this->locationTable[$i][1] === 0){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfseek($this->filePointer, $this->locationTable[$i][0] << 12);\n\t\t\t$chunk = fread($this->filePointer, $this->locationTable[$i][1] << 12);\n\t\t\t$length = Binary::readInt(substr($chunk, 0, 4));\n\t\t\tif($length <= 1){\n\t\t\t\t$this->locationTable[$i] = [0, 0, 0]; //Non-generated chunk, remove it from index\n\t\t\t}\n\n\t\t\ttry{\n\t\t\t\t$chunk = zlib_decode(substr($chunk, 5));\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$this->locationTable[$i] = [0, 0, 0]; //Corrupted chunk, remove it\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$chunk = chr(self::COMPRESSION_ZLIB) . zlib_encode($chunk, ZLIB_ENCODING_DEFLATE, 9);\n\t\t\t$chunk = Binary::writeInt(strlen($chunk)) . $chunk;\n\t\t\t$sectors = (int) ceil(strlen($chunk) / 4096);\n\t\t\tif($sectors > $this->locationTable[$i][1]){\n\t\t\t\t$this->locationTable[$i][0] = $this->lastSector + 1;\n\t\t\t\t$this->lastSector += $sectors;\n\t\t\t}\n\t\t\tfseek($this->filePointer, $this->locationTable[$i][0] << 12);\n\t\t\tfwrite($this->filePointer, str_pad($chunk, $sectors << 12, \"\\x00\", STR_PAD_RIGHT));\n\t\t}\n\t\t$this->writeLocationTable();\n\t\t$n = $this->cleanGarbage();\n\t\t$this->writeLocationTable();\n\n\t\treturn $n;\n\t}\n\n\tprivate function cleanGarbage() : int{\n\t\t$sectors = [];\n\t\tforeach($this->locationTable as $index => $data){ //Calculate file usage\n\t\t\tif($data[0] === 0 or $data[1] === 0){\n\t\t\t\t$this->locationTable[$index] = [0, 0, 0];\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tfor($i = 0; $i < $data[1]; ++$i){\n\t\t\t\t$sectors[$data[0]] = $index;\n\t\t\t}\n\t\t}\n\n\t\tif(count($sectors) === ($this->lastSector - 2)){ //No collection needed\n\t\t\treturn 0;\n\t\t}\n\n\t\tksort($sectors);\n\t\t$shift = 0;\n\t\t$lastSector = 1; //First chunk - 1\n\n\t\tfseek($this->filePointer, 8192);\n\t\t$sector = 2;\n\t\tforeach($sectors as $sector => $index){\n\t\t\tif(($sector - $lastSector) > 1){\n\t\t\t\t$shift += $sector - $lastSector - 1;\n\t\t\t}\n\t\t\tif($shift > 0){\n\t\t\t\tfseek($this->filePointer, $sector << 12);\n\t\t\t\t$old = fread($this->filePointer, 4096);\n\t\t\t\tfseek($this->filePointer, ($sector - $shift) << 12);\n\t\t\t\tfwrite($this->filePointer, $old, 4096);\n\t\t\t}\n\t\t\t$this->locationTable[$index][0] -= $shift;\n\t\t\t$lastSector = $sector;\n\t\t}\n\t\tftruncate($this->filePointer, ($sector + 1) << 12); //Truncate to the end of file written\n\t\treturn $shift;\n\t}\n\n\tprotected function loadLocationTable(){\n\t\tfseek($this->filePointer, 0);\n\t\t$this->lastSector = 1;\n\n\t\t$data = unpack(\"N*\", fread($this->filePointer, 4 * 1024 * 2)); //1024 records * 4 bytes * 2 times\n\t\tfor($i = 0; $i < 1024; ++$i){\n\t\t\t$index = $data[$i + 1];\n\t\t\t$this->locationTable[$i] = [$index >> 8, $index & 0xff, $data[1024 + $i + 1]];\n\t\t\tif(($this->locationTable[$i][0] + $this->locationTable[$i][1] - 1) > $this->lastSector){\n\t\t\t\t$this->lastSector = $this->locationTable[$i][0] + $this->locationTable[$i][1] - 1;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function writeLocationTable(){\n\t\t$write = [];\n\n\t\tfor($i = 0; $i < 1024; ++$i){\n\t\t\t$write[] = (($this->locationTable[$i][0] << 8) | $this->locationTable[$i][1]);\n\t\t}\n\t\tfor($i = 0; $i < 1024; ++$i){\n\t\t\t$write[] = $this->locationTable[$i][2];\n\t\t}\n\t\tfseek($this->filePointer, 0);\n\t\tfwrite($this->filePointer, pack(\"N*\", ...$write), 4096 * 2);\n\t}\n\n\tprotected function writeLocationIndex($index){\n\t\tfseek($this->filePointer, $index << 2);\n\t\tfwrite($this->filePointer, Binary::writeInt(($this->locationTable[$index][0] << 8) | $this->locationTable[$index][1]), 4);\n\t\tfseek($this->filePointer, 4096 + ($index << 2));\n\t\tfwrite($this->filePointer, Binary::writeInt($this->locationTable[$index][2]), 4);\n\t}\n\n\tprotected function createBlank(){\n\t\tfseek($this->filePointer, 0);\n\t\tftruncate($this->filePointer, 0);\n\t\t$this->lastSector = 1;\n\t\t$table = \"\";\n\t\tfor($i = 0; $i < 1024; ++$i){\n\t\t\t$this->locationTable[$i] = [0, 0];\n\t\t\t$table .= Binary::writeInt(0);\n\t\t}\n\n\t\t$time = time();\n\t\tfor($i = 0; $i < 1024; ++$i){\n\t\t\t$this->locationTable[$i][2] = $time;\n\t\t\t$table .= Binary::writeInt($time);\n\t\t}\n\n\t\tfwrite($this->filePointer, $table, 4096 * 2);\n\t}\n\n\tpublic function getX() : int{\n\t\treturn $this->x;\n\t}\n\n\tpublic function getZ() : int{\n\t\treturn $this->z;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/Flat.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator;\n\nuse pocketmine\\block\\CoalOre;\nuse pocketmine\\block\\DiamondOre;\nuse pocketmine\\block\\Dirt;\nuse pocketmine\\block\\GoldOre;\nuse pocketmine\\block\\Gravel;\nuse pocketmine\\block\\IronOre;\nuse pocketmine\\block\\LapisOre;\nuse pocketmine\\block\\RedstoneOre;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\generator\\normal\\populator\\Ore;\nuse pocketmine\\level\\generator\\normal\\populator\\Populator;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\utils\\Random;\n\nclass Flat extends Generator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\t/** @var Chunk */\n\tprivate $chunk;\n\t/** @var Random */\n\tprivate $random;\n\t/** @var Populator[] */\n\tprivate $populators = [];\n\tprivate $structure, $chunks, $options, $floorLevel, $preset;\n\n\tpublic function getSettings(){\n\t\treturn $this->options;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"flat\";\n\t}\n\n\tpublic function __construct(array $options = []){\n\t\t$this->preset = \"2;7,2x3,2;1;\";\n\t\t$this->options = $options;\n\t\t$this->chunk = null;\n\n\t\tif(isset($this->options[\"decoration\"])){\n\t\t\t$ores = new Ore();\n\t\t\t$ores->setOreTypes([\n\t\t\t\tnew object\\OreType(new CoalOre(), 20, 16, 0, 128),\n\t\t\t\tnew object\\OreType(New IronOre(), 20, 8, 0, 64),\n\t\t\t\tnew object\\OreType(new RedstoneOre(), 8, 7, 0, 16),\n\t\t\t\tnew object\\OreType(new LapisOre(), 1, 6, 0, 32),\n\t\t\t\tnew object\\OreType(new GoldOre(), 2, 8, 0, 32),\n\t\t\t\tnew object\\OreType(new DiamondOre(), 1, 7, 0, 16),\n\t\t\t\tnew object\\OreType(new Dirt(), 20, 32, 0, 128),\n\t\t\t\tnew object\\OreType(new Gravel(), 10, 16, 0, 128),\n\t\t\t]);\n\t\t\t$this->populators[] = $ores;\n\t\t}\n\n\t}\n\n\tprotected function parsePreset($preset, $chunkX, $chunkZ){\n\t\t$this->preset = $preset;\n\t\t$preset = explode(\";\", $preset);\n\t\t$version = (int) $preset[0];\n\t\t$blocks = $preset[1] ?? \"\";\n\t\t$biome = $preset[2] ?? 1;\n\t\t$options = $preset[3] ?? \"\";\n\t\tpreg_match_all('#^(([0-9]*x|)([0-9]{1,3})(|:[0-9]{0,2}))$#m', str_replace(\",\", \"\\n\", $blocks), $matches);\n\t\t$y = 0;\n\t\t$this->structure = [];\n\t\t$this->chunks = [];\n\t\tforeach($matches[3] as $i => $b){\n\t\t\t$b = Item::fromString($b . $matches[4][$i]);\n\t\t\t$cnt = $matches[2][$i] === \"\" ? 1 : intval($matches[2][$i]);\n\t\t\tfor($cY = $y, $y += $cnt; $cY < $y; ++$cY){\n\t\t\t\t$this->structure[$cY] = [$b->getId(), $b->getDamage()];\n\t\t\t}\n\t\t}\n\n\t\t$this->floorLevel = $y;\n\n\t\tfor(; $y < 0xFF; ++$y){\n\t\t\t$this->structure[$y] = [0, 0];\n\t\t}\n\n\n\t\t$this->chunk = clone $this->level->getChunk($chunkX, $chunkZ);\n\t\t$this->chunk->setGenerated();\n\n\t\tfor($Z = 0; $Z < 16; ++$Z){\n\t\t\tfor($X = 0; $X < 16; ++$X){\n\t\t\t\t$this->chunk->setBiomeId($X, $Z, $biome);\n\t\t\t\tfor($y = 0; $y < 128; ++$y){\n\t\t\t\t\t$this->chunk->setBlock($X, $y, $Z, ...$this->structure[$y]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\tpreg_match_all('#(([0-9a-z_]{1,})\\(?([0-9a-z_ =:]{0,})\\)?),?#', $options, $matches);\n\t\tforeach($matches[2] as $i => $option){\n\t\t\t$params = true;\n\t\t\tif($matches[3][$i] !== \"\"){\n\t\t\t\t$params = [];\n\t\t\t\t$p = explode(\" \", $matches[3][$i]);\n\t\t\t\tforeach($p as $k){\n\t\t\t\t\t$k = explode(\"=\", $k);\n\t\t\t\t\tif(isset($k[1])){\n\t\t\t\t\t\t$params[$k[0]] = $k[1];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->options[$option] = $params;\n\t\t}\n\t}\n\n\tpublic function init(ChunkManager $level, Random $random){\n\t\t$this->level = $level;\n\t\t$this->random = $random;\n\n\t\t/*\n\t\t  // Commented out : We want to delay this\n\t\tif(isset($this->options[\"preset\"]) and $this->options[\"preset\"] != \"\"){\n\t\t\t$this->parsePreset($this->options[\"preset\"]);\n\t\t}else{\n\t\t\t$this->parsePreset($this->preset);\n\t\t}\n\t\t*/\n\t}\n\n\tpublic function generateChunk($chunkX, $chunkZ){\n\t\tif($this->chunk === null){\n\t\t\tif(isset($this->options[\"preset\"]) and $this->options[\"preset\"] != \"\"){\n\t\t\t\t$this->parsePreset($this->options[\"preset\"], $chunkX, $chunkZ);\n\t\t\t}else{\n\t\t\t\t$this->parsePreset($this->preset, $chunkX, $chunkZ);\n\t\t\t}\n\t\t}\n\t\t$chunk = clone $this->chunk;\n\t\t$chunk->setX($chunkX);\n\t\t$chunk->setZ($chunkZ);\n\t\t$this->level->setChunk($chunkX, $chunkZ, $chunk);\n\t}\n\n\tpublic function populateChunk($chunkX, $chunkZ){\n\t\t$this->random->setSeed(0xdeadbeef ^ ($chunkX << 8) ^ $chunkZ ^ $this->level->getSeed());\n\t\tforeach($this->populators as $populator){\n\t\t\t$populator->populate($this->level, $chunkX, $chunkZ, $this->random);\n\t\t}\n\n\t}\n\n\tpublic function getSpawn(){\n\t\treturn new Vector3(128, $this->floorLevel, 128);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/GenerationTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\SimpleChunkManager;\nuse pocketmine\\scheduler\\AsyncTask;\nuse pocketmine\\Server;\n\n\nclass GenerationTask extends AsyncTask{\n\n\tpublic $state;\n\tpublic $levelId;\n\tpublic $chunk;\n\n\tpublic function __construct(Level $level, Chunk $chunk){\n\t\t$this->state = true;\n\t\t$this->levelId = $level->getId();\n\t\t$this->chunk = $chunk->fastSerialize();\n\t}\n\n\tpublic function onRun(){\n\t\t/** @var SimpleChunkManager $manager */\n\t\t$manager = $this->getFromThreadStore(\"generation.level{$this->levelId}.manager\");\n\t\t/** @var Generator $generator */\n\t\t$generator = $this->getFromThreadStore(\"generation.level{$this->levelId}.generator\");\n\t\tif($manager === null or $generator === null){\n\t\t\t$this->state = false;\n\t\t\treturn;\n\t\t}\n\n\t\t/** @var Chunk $chunk */\n\t\t$chunk = Chunk::fastDeserialize($this->chunk);\n\t\tif($chunk === null){\n\t\t\t//TODO error\n\t\t\treturn;\n\t\t}\n\n\t\t$manager->setChunk($chunk->getX(), $chunk->getZ(), $chunk);\n\n\t\t$generator->generateChunk($chunk->getX(), $chunk->getZ());\n\n\t\t$chunk = $manager->getChunk($chunk->getX(), $chunk->getZ());\n\t\t$chunk->setGenerated();\n\t\t$this->chunk = $chunk->fastSerialize();\n\n\t\t$manager->setChunk($chunk->getX(), $chunk->getZ(), null);\n\t}\n\n\tpublic function onCompletion(Server $server){\n\t\t$level = $server->getLevel($this->levelId);\n\t\tif($level !== null){\n\t\t\tif($this->state === false){\n\t\t\t\t$level->registerGenerator();\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t/** @var Chunk $chunk */\n\t\t\t$chunk = Chunk::fastDeserialize($this->chunk, $level->getProvider());\n\t\t\tif($chunk === null){\n\t\t\t\t//TODO error\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$level->generateChunkCallback($chunk->getX(), $chunk->getZ(), $chunk);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/Generator.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Noise classes used in Levels\n */\nnamespace pocketmine\\level\\generator;\n\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\noise\\Noise;\nuse pocketmine\\level\\generator\\normal\\Normal;\nuse pocketmine\\utils\\Random;\n\nabstract class Generator{\n\tprivate static $list = [];\n\n\tpublic static function addGenerator($object, $name){\n\t\tif(is_subclass_of($object, Generator::class) and !isset(Generator::$list[$name = strtolower($name)])){\n\t\t\tGenerator::$list[$name] = $object;\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic static function getGeneratorList(){\n\t\treturn array_keys(Generator::$list);\n\t}\n\n\t/**\n\t * @param $name\n\t *\n\t * @return Generator\n\t */\n\tpublic static function getGenerator($name){\n\t\tif(isset(Generator::$list[$name = strtolower($name)])){\n\t\t\treturn Generator::$list[$name];\n\t\t}\n\n\t\treturn Normal::class;\n\t}\n\n\tpublic static function getGeneratorName($class){\n\t\tforeach(Generator::$list as $name => $c){\n\t\t\tif($c === $class){\n\t\t\t\treturn $name;\n\t\t\t}\n\t\t}\n\n\t\treturn \"unknown\";\n\t}\n\n\t/**\n\t * @param Noise $noise\n\t * @param int   $xSize\n\t * @param int   $samplingRate\n\t * @param int   $x\n\t * @param int   $y\n\t * @param int   $z\n\t *\n\t * @return \\SplFixedArray\n\t */\n\tpublic static function getFastNoise1D(Noise $noise, $xSize, $samplingRate, $x, $y, $z){\n\t\tif($samplingRate === 0){\n\t\t\tthrow new \\InvalidArgumentException(\"samplingRate cannot be 0\");\n\t\t}\n\t\tif ($xSize % $samplingRate !== 0) {\n\t\t\tthrow new \\InvalidArgumentCountException(\"xSize % samplingRate must return 0\");\n\t\t}\n\n\t\t$noiseArray = new \\SplFixedArray($xSize + 1);\n\n\t\tfor($xx = 0; $xx <= $xSize; $xx += $samplingRate){\n\t\t\t$noiseArray[$xx] = $noise->noise3D($xx + $x, $y, $z);\n\t\t}\n\n\t\tfor($xx = 0; $xx < $xSize; ++$xx){\n\t\t\tif($xx % $samplingRate !== 0){\n\t\t\t\t$nx = (int) ($xx / $samplingRate) * $samplingRate;\n\t\t\t\t$noiseArray[$xx] = Noise::linearLerp($xx, $nx, $nx + $samplingRate, $noiseArray[$nx], $noiseArray[$nx + $samplingRate]);\n\t\t\t}\n\t\t}\n\n\t\treturn $noiseArray;\n\t}\n\n\t/**\n\t * @param Noise $noise\n\t * @param int   $xSize\n\t * @param int   $zSize\n\t * @param int   $samplingRate\n\t * @param int   $x\n\t * @param int   $y\n\t * @param int   $z\n\t *\n\t * @return \\SplFixedArray\n\t */\n\tpublic static function getFastNoise2D(Noise $noise, $xSize, $zSize, $samplingRate, $x, $y, $z){\n\t\tif($samplingRate === 0){\n\t\t\tthrow new \\InvalidArgumentException(\"samplingRate cannot be 0\");\n\t\t}\n\t\tif ($xSize % $samplingRate !== 0) {\n\t\t\tthrow new \\InvalidArgumentCountException(\"xSize % samplingRate must return 0\");\n\t\t}\n\t\tif ($zSize % $samplingRate !== 0) {\n\t\t\tthrow new \\InvalidArgumentCountException(\"zSize % samplingRate must return 0\");\n\t\t}\n\n\t\t$noiseArray = new \\SplFixedArray($xSize + 1);\n\n\t\tfor($xx = 0; $xx <= $xSize; $xx += $samplingRate){\n\t\t\t$noiseArray[$xx] = new \\SplFixedArray($zSize + 1);\n\t\t\tfor($zz = 0; $zz <= $zSize; $zz += $samplingRate){\n\t\t\t\t$noiseArray[$xx][$zz] = $noise->noise3D($x + $xx, $y, $z + $zz);\n\t\t\t}\n\t\t}\n\n\t\tfor($xx = 0; $xx < $xSize; ++$xx){\n\t\t\tif($xx % $samplingRate !== 0){\n\t\t\t\t$noiseArray[$xx] = new \\SplFixedArray($zSize + 1);\n\t\t\t}\n\n\t\t\tfor($zz = 0; $zz < $zSize; ++$zz){\n\t\t\t\tif($xx % $samplingRate !== 0 or $zz % $samplingRate !== 0){\n\t\t\t\t\t$nx = (int) ($xx / $samplingRate) * $samplingRate;\n\t\t\t\t\t$nz = (int) ($zz / $samplingRate) * $samplingRate;\n\t\t\t\t\t$noiseArray[$xx][$zz] = Noise::bilinearLerp(\n\t\t\t\t\t\t$xx, $zz, $noiseArray[$nx][$nz], $noiseArray[$nx][$nz + $samplingRate],\n\t\t\t\t\t\t$noiseArray[$nx + $samplingRate][$nz], $noiseArray[$nx + $samplingRate][$nz + $samplingRate],\n\t\t\t\t\t\t$nx, $nx + $samplingRate, $nz, $nz + $samplingRate\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $noiseArray;\n\t}\n\n\t/**\n\t * @param Noise $noise\n\t * @param int   $xSize\n\t * @param int   $ySize\n\t * @param int   $zSize\n\t * @param int   $xSamplingRate\n\t * @param int   $ySamplingRate\n\t * @param int   $zSamplingRate\n\t * @param int   $x\n\t * @param int   $y\n\t * @param int   $z\n\t *\n\t * @return \\SplFixedArray\n\t */\n\tpublic static function getFastNoise3D(Noise $noise, $xSize, $ySize, $zSize, $xSamplingRate, $ySamplingRate, $zSamplingRate, $x, $y, $z){\n\t\tif($xSamplingRate === 0){\n\t\t\tthrow new \\InvalidArgumentException(\"xSamplingRate cannot be 0\");\n\t\t}\n\t\tif($zSamplingRate === 0){\n\t\t\tthrow new \\InvalidArgumentException(\"zSamplingRate cannot be 0\");\n\t\t}\n\t\tif($ySamplingRate === 0){\n\t\t\tthrow new \\InvalidArgumentException(\"ySamplingRate cannot be 0\");\n\t\t}\n\t\tif ($xSize % $xSamplingRate !== 0) {\n\t\t\tthrow new \\InvalidArgumentCountException(\"xSize % xSamplingRate must return 0\");\n\t\t}\n\t\tif ($zSize % $zSamplingRate !== 0) {\n\t\t\tthrow new \\InvalidArgumentCountException(\"zSize % zSamplingRate must return 0\");\n\t\t}\n\t\tif ($ySize % $ySamplingRate !== 0) {\n\t\t\tthrow new \\InvalidArgumentCountException(\"ySize % ySamplingRate must return 0\");\n\t\t}\n\n\t\t$noiseArray = array_fill(0, $xSize + 1, array_fill(0, $zSize + 1, []));\n\n\t\tfor($xx = 0; $xx <= $xSize; $xx += $xSamplingRate){\n\t\t\tfor($zz = 0; $zz <= $zSize; $zz += $zSamplingRate){\n\t\t\t\tfor($yy = 0; $yy <= $ySize; $yy += $ySamplingRate){\n\t\t\t\t\t$noiseArray[$xx][$zz][$yy] = $noise->noise3D($x + $xx, $y + $yy, $z + $zz, true);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor($xx = 0; $xx < $xSize; ++$xx){\n\t\t\tfor($zz = 0; $zz < $zSize; ++$zz){\n\t\t\t\tfor($yy = 0; $yy < $ySize; ++$yy){\n\t\t\t\t\tif($xx % $xSamplingRate !== 0 or $zz % $zSamplingRate !== 0 or $yy % $ySamplingRate !== 0){\n\t\t\t\t\t\t$nx = (int) ($xx / $xSamplingRate) * $xSamplingRate;\n\t\t\t\t\t\t$ny = (int) ($yy / $ySamplingRate) * $ySamplingRate;\n\t\t\t\t\t\t$nz = (int) ($zz / $zSamplingRate) * $zSamplingRate;\n\n\t\t\t\t\t\t$nnx = $nx + $xSamplingRate;\n\t\t\t\t\t\t$nny = $ny + $ySamplingRate;\n\t\t\t\t\t\t$nnz = $nz + $zSamplingRate;\n\n\t\t\t\t\t\t$dx1 = (($nnx - $xx) / ($nnx - $nx));\n\t\t\t\t\t\t$dx2 = (($xx - $nx) / ($nnx - $nx));\n\t\t\t\t\t\t$dy1 = (($nny - $yy) / ($nny - $ny));\n\t\t\t\t\t\t$dy2 = (($yy - $ny) / ($nny - $ny));\n\n\t\t\t\t\t\t$noiseArray[$xx][$zz][$yy] = (($nnz - $zz) / ($nnz - $nz)) * (\n\t\t\t\t\t\t\t$dy1 * (\n\t\t\t\t\t\t\t\t$dx1 * $noiseArray[$nx][$nz][$ny] + $dx2 * $noiseArray[$nnx][$nz][$ny]\n\t\t\t\t\t\t\t) + $dy2 * (\n\t\t\t\t\t\t\t\t$dx1 * $noiseArray[$nx][$nz][$nny] + $dx2 * $noiseArray[$nnx][$nz][$nny]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t) + (($zz - $nz) / ($nnz - $nz)) * (\n\t\t\t\t\t\t\t$dy1 * (\n\t\t\t\t\t\t\t\t$dx1 * $noiseArray[$nx][$nnz][$ny] + $dx2 * $noiseArray[$nnx][$nnz][$ny]\n\t\t\t\t\t\t\t) + $dy2 * (\n\t\t\t\t\t\t\t\t$dx1 * $noiseArray[$nx][$nnz][$nny] + $dx2 * $noiseArray[$nnx][$nnz][$nny]\n\t\t\t\t\t\t\t)\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $noiseArray;\n\t}\n\n\tpublic function getWaterHeight() : int{\n\t\treturn 0;\n\t}\n\n\tpublic abstract function __construct(array $settings = []);\n\n\tpublic abstract function init(ChunkManager $level, Random $random);\n\n\tpublic abstract function generateChunk($chunkX, $chunkZ);\n\n\tpublic abstract function populateChunk($chunkX, $chunkZ);\n\n\tpublic abstract function getSettings();\n\n\tpublic abstract function getName();\n\n\tpublic abstract function getSpawn();\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/GeneratorRegisterTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator;\n\nuse pocketmine\\block\\Block;\n\nuse pocketmine\\level\\generator\\biome\\Biome;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\SimpleChunkManager;\nuse pocketmine\\scheduler\\AsyncTask;\n\nuse pocketmine\\utils\\Random;\n\nclass GeneratorRegisterTask extends AsyncTask{\n\n\tpublic $generator;\n\tpublic $settings;\n\tpublic $seed;\n\tpublic $levelId;\n\tpublic $waterHeight;\n\n\tpublic function __construct(Level $level, Generator $generator){\n\t\t$this->generator = get_class($generator);\n\t\t$this->waterHeight = $generator->getWaterHeight();\n\t\t$this->settings = serialize($generator->getSettings());\n\t\t$this->seed = $level->getSeed();\n\t\t$this->levelId = $level->getId();\n\t}\n\n\tpublic function onRun(){\n\t\tBlock::init();\n\t\tBiome::init();\n\t\t$manager = new SimpleChunkManager($this->seed, $this->waterHeight);\n\t\t$this->saveToThreadStore(\"generation.level{$this->levelId}.manager\", $manager);\n\t\t/** @var Generator $generator */\n\t\t$generator = $this->generator;\n\t\t$generator = new $generator(unserialize($this->settings));\n\t\t$generator->init($manager, new Random($manager->getSeed()));\n\t\t$this->saveToThreadStore(\"generation.level{$this->levelId}.generator\", $generator);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/GeneratorUnregisterTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator;\n\n\nuse pocketmine\\level\\Level;\n\nuse pocketmine\\scheduler\\AsyncTask;\n\n\nclass GeneratorUnregisterTask extends AsyncTask{\n\n\tpublic $levelId;\n\n\tpublic function __construct(Level $level){\n\t\t$this->levelId = $level->getId();\n\t}\n\n\tpublic function onRun(){\n\t\t$this->saveToThreadStore(\"generation.level{$this->levelId}.manager\", null);\n\t\t$this->saveToThreadStore(\"generation.level{$this->levelId}.generator\", null);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/LightPopulationTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\n\nuse pocketmine\\scheduler\\AsyncTask;\nuse pocketmine\\Server;\n\n\nclass LightPopulationTask extends AsyncTask{\n\n\tpublic $levelId;\n\tpublic $chunk;\n\n\tpublic function __construct(Level $level, Chunk $chunk){\n\t\t$this->levelId = $level->getId();\n\t\t$this->chunk = $chunk->fastSerialize();\n\t}\n\n\tpublic function onRun(){\n\t\t/** @var Chunk $chunk */\n\t\t$chunk = Chunk::fastDeserialize($this->chunk);\n\t\tif($chunk === null){\n\t\t\t//TODO error\n\t\t\treturn;\n\t\t}\n\n\t\t$chunk->recalculateHeightMap();\n\t\t$chunk->populateSkyLight();\n\t\t$chunk->setLightPopulated();\n\n\t\t$this->chunk = $chunk->fastSerialize();\n\t}\n\n\tpublic function onCompletion(Server $server){\n\t\t$level = $server->getLevel($this->levelId);\n\t\tif($level !== null){\n\t\t\t/** @var Chunk $chunk */\n\t\t\t$chunk = Chunk::fastDeserialize($this->chunk, $level->getProvider());\n\t\t\tif($chunk === null){\n\t\t\t\t//TODO error\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$level->generateChunkCallback($chunk->getX(), $chunk->getZ(), $chunk);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/PopulationTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\SimpleChunkManager;\nuse pocketmine\\scheduler\\AsyncTask;\nuse pocketmine\\Server;\n\n\nclass PopulationTask extends AsyncTask{\n\n\tpublic $state;\n\tpublic $levelId;\n\tpublic $chunk;\n\n\tpublic $chunk0;\n\tpublic $chunk1;\n\tpublic $chunk2;\n\tpublic $chunk3;\n\t//center chunk\n\tpublic $chunk5;\n\tpublic $chunk6;\n\tpublic $chunk7;\n\tpublic $chunk8;\n\n\tpublic function __construct(Level $level, Chunk $chunk){\n\t\t$this->state = true;\n\t\t$this->levelId = $level->getId();\n\t\t$this->chunk = $chunk->fastSerialize();\n\n\t\tfor($i = 0; $i < 9; ++$i){\n\t\t\tif($i === 4){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$xx = -1 + $i % 3;\n\t\t\t$zz = -1 + (int) ($i / 3);\n\t\t\t$ck = $level->getChunk($chunk->getX() + $xx, $chunk->getZ() + $zz, false);\n\t\t\t$this->{\"chunk$i\"} = $ck !== null ? $ck->fastSerialize() : null;\n\t\t}\n\t}\n\n\tpublic function onRun(){\n\t\t/** @var SimpleChunkManager $manager */\n\t\t$manager = $this->getFromThreadStore(\"generation.level{$this->levelId}.manager\");\n\t\t/** @var Generator $generator */\n\t\t$generator = $this->getFromThreadStore(\"generation.level{$this->levelId}.generator\");\n\t\tif($manager === null or $generator === null){\n\t\t\t$this->state = false;\n\t\t\treturn;\n\t\t}\n\n\t\t/** @var Chunk[] $chunks */\n\t\t$chunks = [];\n\n\t\t$chunk = Chunk::fastDeserialize($this->chunk);\n\n\t\tfor($i = 0; $i < 9; ++$i){\n\t\t\tif($i === 4){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$xx = -1 + $i % 3;\n\t\t\t$zz = -1 + (int) ($i / 3);\n\t\t\t$ck = $this->{\"chunk$i\"};\n\t\t\tif($ck === null){\n\t\t\t\t$chunks[$i] = Chunk::getEmptyChunk($chunk->getX() + $xx, $chunk->getZ() + $zz);\n\t\t\t}else{\n\t\t\t\t$chunks[$i] = Chunk::fastDeserialize($ck);\n\t\t\t}\n\t\t}\n\n\t\tif($chunk === null){\n\t\t\t//TODO error\n\t\t\treturn;\n\t\t}\n\n\t\t$manager->setChunk($chunk->getX(), $chunk->getZ(), $chunk);\n\t\tif(!$chunk->isGenerated()){\n\t\t\t$generator->generateChunk($chunk->getX(), $chunk->getZ());\n\t\t\t$chunk->setGenerated();\n\t\t}\n\n\t\tforeach($chunks as $c){\n\t\t\tif($c !== null){\n\t\t\t\t$manager->setChunk($c->getX(), $c->getZ(), $c);\n\t\t\t\tif(!$c->isGenerated()){\n\t\t\t\t\t$generator->generateChunk($c->getX(), $c->getZ());\n\t\t\t\t\t$c = $manager->getChunk($c->getX(), $c->getZ());\n\t\t\t\t\t$c->setGenerated();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$generator->populateChunk($chunk->getX(), $chunk->getZ());\n\n\t\t$chunk = $manager->getChunk($chunk->getX(), $chunk->getZ());\n\t\t$chunk->recalculateHeightMap();\n\t\t$chunk->populateSkyLight();\n\t\t$chunk->setLightPopulated();\n\t\t$chunk->setPopulated();\n\t\t$this->chunk = $chunk->fastSerialize();\n\n\t\t$manager->setChunk($chunk->getX(), $chunk->getZ(), null);\n\n\t\tforeach($chunks as $i => $c){\n\t\t\tif($c !== null){\n\t\t\t\t$c = $chunks[$i] = $manager->getChunk($c->getX(), $c->getZ());\n\t\t\t\tif(!$c->hasChanged()){\n\t\t\t\t\t$chunks[$i] = null;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t//This way non-changed chunks are not set\n\t\t\t\t$chunks[$i] = null;\n\t\t\t}\n\t\t}\n\n\t\t$manager->cleanChunks();\n\n\t\tfor($i = 0; $i < 9; ++$i){\n\t\t\tif($i === 4){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$this->{\"chunk$i\"} = $chunks[$i] !== null ? $chunks[$i]->fastSerialize() : null;\n\t\t}\n\t}\n\n\tpublic function onCompletion(Server $server){\n\t\t$level = $server->getLevel($this->levelId);\n\t\tif($level !== null){\n\t\t\tif($this->state === false){\n\t\t\t\t$level->registerGenerator();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t$chunk = Chunk::fastDeserialize($this->chunk, $level->getProvider());\n\n\t\t\tif($chunk === null){\n\t\t\t\t//TODO error\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tfor($i = 0; $i < 9; ++$i){\n\t\t\t\tif($i === 4){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$c = $this->{\"chunk$i\"};\n\t\t\t\tif($c !== null){\n\t\t\t\t\t$c = Chunk::fastDeserialize($c, $level->getProvider());\n\t\t\t\t\t$level->generateChunkCallback($c->getX(), $c->getZ(), $c);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$level->generateChunkCallback($chunk->getX(), $chunk->getZ(), $chunk);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/Void.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\level\\format\\Chunk;\n\nclass Void extends Generator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\t/** @var Chunk */\n\tprivate $chunk;\n\t/** @var Random */\n\tprivate $random;\n\tprivate $options;\n\t/** @var Chunk */\n\tprivate $emptyChunk = null;\n\n\tpublic function getSettings(){\n\t\treturn [];\n\t}\n\n\tpublic function getName(){\n\t\treturn \"Void\";\n\t}\n\n\tpublic function __construct(array $settings = []){\n\t\t$this->options = $settings;\n\t}\n\n\tpublic function init(ChunkManager $level, Random $random){\n\t\t$this->level = $level;\n\t\t$this->random = $random;\n\t}\n\n\tpublic function generateChunk($chunkX, $chunkZ){\n\t\tif($this->emptyChunk === null){\n\t\t\t$this->chunk = clone $this->level->getChunk($chunkX, $chunkZ);\n\t\t\t$this->chunk->setGenerated();\n\n\t\t\tfor($Z = 0; $Z < 16; ++$Z){\n\t\t\t\tfor($X = 0; $X < 16; ++$X){\n\t\t\t\t\t$this->chunk->setBiomeId($X, $Z, 1);\n\t\t\t\t\tfor($y = 0; $y < 128; ++$y){\n\t\t\t\t\t\t$this->chunk->setBlockId($X, $y, $Z, Block::AIR);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$spawn = $this->getSpawn();\n\t\t\tif($spawn->getX() >> 4 === $chunkX and $spawn->getZ() >> 4 === $chunkZ){\n\t\t\t\t$this->chunk->setBlockId(0, 64, 0, Block::GRASS);\n\t\t\t}else{\n\t\t\t\t$this->emptyChunk = clone $this->chunk;\n\t\t\t}\n\t\t}else{\n\t\t\t$this->chunk = clone $this->emptyChunk;\n\t\t}\n\n\t\t$chunk = clone $this->chunk;\n\t\t$chunk->setX($chunkX);\n\t\t$chunk->setZ($chunkZ);\n\t\t$this->level->setChunk($chunkX, $chunkZ, $chunk);\n\t}\n\n\tpublic function populateChunk($chunkX, $chunkZ){\n\n\t}\n\n\tpublic function getSpawn(){\n\t\treturn new Vector3(128, 72, 128);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/biome/Biome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\biome;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\normal\\biome\\MesaBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\BeachBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\SwampBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\DesertBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\ForestBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\IcePlainsBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\MountainsBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\OceanBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\PlainBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\RiverBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\SmallMountainsBiome;\nuse pocketmine\\level\\generator\\normal\\biome\\TaigaBiome;\nuse pocketmine\\level\\generator\\nether\\biome\\HellBiome;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\utils\\Random;\n\nuse pocketmine\\level\\generator\\normal\\populator\\Flower;\n\nabstract class Biome{\n\n\tconst OCEAN = 0;\n\tconst PLAINS = 1;\n\tconst DESERT = 2;\n\tconst MOUNTAINS = 3;\n\tconst FOREST = 4;\n\tconst TAIGA = 5;\n\tconst SWAMP = 6;\n\tconst RIVER = 7;\n\tconst HELL = 8;\n\tconst END = 9;\n\tconst FROZEN_OCEAN = 10;\n\tconst FROZEN_RIVER = 11;\n\tconst ICE_PLAINS = 12;\n\tconst ICE_MOUNTAINS = 13;\n\tconst MUSHROOM_ISLAND = 14;\n\tconst MUSHROOM_ISLAND_SHORE = 15;\n\tconst BEACH = 16;\n\tconst DESERT_HILLS = 17;\n\tconst FOREST_HILLS = 18;\n\tconst TAIGA_HILLS = 19;\n\tconst SMALL_MOUNTAINS = 20;\n\tconst BIRCH_FOREST = 27;\n\tconst BIRCH_FOREST_HILLS = 28;\n\tconst ROOFED_FOREST = 29;\t\n\tconst COLD_TAIGA = 30;\n\tconst COLD_TAIGA_HILLS = 31;\n\tconst MEGA_TAIGA = 32;\n\tconst MEGA_TAIGA_HILLS = 33;\n\tconst EXTREME_HILLS_PLUS = 34;\n\tconst SAVANNA = 35;\n\tconst SAVANNA_PLATEAU = 36;\n\tconst MESA = 37;\n\tconst MESA_PLATEAU_F = 38;\n\tconst MESA_PLATEAU = 39;\n\t\n\tconst VOID = 127;\n\n\tconst MAX_BIOMES = 256;\n\n\t/** @var Biome[] */\n\tprivate static $biomes = [];\n\n\tprivate $id;\n\tprivate $registered = false;\n\t/** @var Populator[] */\n\tprivate $populators = [];\n\n\tprivate $minElevation;\n\tprivate $maxElevation;\n\n\tprivate $groundCover = [];\n\n\tprotected $rainfall = 0.5;\n\tprotected $temperature = 0.5;\n\n\tprotected static function register($id, Biome $biome){\n\t\tself::$biomes[(int) $id] = $biome;\n\t\t$biome->setId((int) $id);\n\n\t\t$flowerPopFound = false;\n\n\t\tforeach($biome->getPopulators() as $populator){\n\t\t\tif($populator instanceof Flower){\n\t\t\t\t$flowerPopFound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif($flowerPopFound === false){\n\t\t\t$flower = new Flower();\n\t\t\t$biome->addPopulator($flower);\n\t\t}\n\t}\n\n\tpublic static function init(){\n\t\tself::register(self::OCEAN, new OceanBiome());\n\t\tself::register(self::PLAINS, new PlainBiome());\n\t\tself::register(self::DESERT, new DesertBiome());\n\t\tself::register(self::MOUNTAINS, new MountainsBiome());\n\t\tself::register(self::FOREST, new ForestBiome());\n\t\tself::register(self::TAIGA, new TaigaBiome());\n\t\tself::register(self::SWAMP, new SwampBiome());\n\t\tself::register(self::RIVER, new RiverBiome());\n\t\t\n\t\tself::register(self::BEACH, new BeachBiome());\n\t\tself::register(self::MESA, new MesaBiome());\n\n\t\tself::register(self::ICE_PLAINS, new IcePlainsBiome());\n\n\n\t\tself::register(self::SMALL_MOUNTAINS, new SmallMountainsBiome());\n\t\tself::register(self::HELL, new HellBiome());\n\n\t\tself::register(self::BIRCH_FOREST, new ForestBiome(ForestBiome::TYPE_BIRCH));\n\t}\n\n\t/**\n\t * @param $id\n\t *\n\t * @return Biome\n\t */\n\tpublic static function getBiome($id){\n\t\treturn isset(self::$biomes[$id]) ? self::$biomes[$id] : self::$biomes[self::OCEAN];\n\t}\n\n\tpublic function clearPopulators(){\n\t\t$this->populators = [];\n\t}\n\n\tpublic function addPopulator(Populator $populator){\n\t\t$this->populators[get_class($populator)] = $populator;\n\t}\n\n\tpublic function removePopulator($class){\n\t\tif(isset($this->populators[$class])){\n\t\t\tunset($this->populators[$class]);\n\t\t}\n\t}\n\n\tpublic function populateChunk(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\tforeach($this->populators as $populator){\n\t\t\t$populator->populate($level, $chunkX, $chunkZ, $random);\n\t\t}\n\t}\n\n\tpublic function getPopulators(){\n\t\treturn $this->populators;\n\t}\n\n\tpublic function setId($id){\n\t\tif(!$this->registered){\n\t\t\t$this->registered = true;\n\t\t\t$this->id = $id;\n\t\t}\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic abstract function getName();\n\n\tpublic function getMinElevation(){\n\t\treturn $this->minElevation;\n\t}\n\n\tpublic function getMaxElevation(){\n\t\treturn $this->maxElevation;\n\t}\n\n\tpublic function setElevation($min, $max){\n\t\t$this->minElevation = $min;\n\t\t$this->maxElevation = $max;\n\t}\n\n\t/**\n\t * @return Block[]\n\t */\n\tpublic function getGroundCover(){\n\t\treturn $this->groundCover;\n\t}\n\n\t/**\n\t * @param Block[] $covers\n\t */\n\tpublic function setGroundCover(array $covers){\n\t\t$this->groundCover = $covers;\n\t}\n\n\tpublic function getTemperature(){\n\t\treturn $this->temperature;\n\t}\n\n\tpublic function getRainfall(){\n\t\treturn $this->rainfall;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/biome/BiomeSelector.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\biome;\n\nuse pocketmine\\level\\generator\\noise\\Simplex;\nuse pocketmine\\utils\\Random;\n\nclass BiomeSelector{\n\n\t/** @var Biome */\n\tprivate $fallback;\n\n\t/** @var Simplex */\n\tprivate $temperature;\n\t/** @var Simplex */\n\tprivate $rainfall;\n\n\t/** @var Biome[] */\n\tprivate $biomes = [];\n\n\tprivate $map = [];\n\n\n\tpublic function __construct(Random $random, Biome $fallback){\n\t\t$this->fallback = $fallback;\n\t\t$this->temperature = new Simplex($random, 2, 1 / 16, 1 / 512);\n\t\t$this->rainfall = new Simplex($random, 2, 1 / 16, 1 / 512);\n\t}\n\t\n\tpublic function lookup($temperature, $rainfall){\n\t\tif($rainfall < 0.25){\n\t\t\tif($temperature < 0.7){\n\t\t\t\treturn Biome::OCEAN;\n\t\t\t}elseif($temperature < 0.85){\n\t\t\t\treturn Biome::RIVER;\n\t\t\t}else{\n\t\t\t\treturn Biome::SWAMP;\n\t\t\t}\n\t\t}elseif($rainfall < 0.60){\n\t\t\tif($temperature < 0.25){\n\t\t\t\treturn Biome::ICE_PLAINS;\n\t\t\t}elseif($temperature < 0.75){\n\t\t\t\treturn Biome::PLAINS;\n\t\t\t}else{\n\t\t\t\treturn Biome::DESERT;\n\t\t\t}\n\t\t}elseif($rainfall < 0.80){\n\t\t\tif($temperature < 0.25){\n\t\t\t\treturn Biome::TAIGA;\n\t\t\t}elseif($temperature < 0.75){\n\t\t\t\treturn Biome::FOREST;\n\t\t\t}else{\n\t\t\t\treturn Biome::BIRCH_FOREST;\n\t\t\t}\n\t\t}else{\n\t\t\tif($temperature < 0.25){\n\t\t\t\treturn Biome::MOUNTAINS;\n\t\t\t}elseif($temperature < 0.70){\n\t\t\t\treturn Biome::SMALL_MOUNTAINS;\n\t\t\t}elseif($temperature <= 2.0){\n\t\t\t\treturn Biome::MESA;\n\t\t\t}else{\n\t\t\t\treturn Biome::RIVER;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function recalculate(){\n\t\t$this->map = new \\SplFixedArray(64 * 64);\n\n\t\tfor($i = 0; $i < 64; ++$i){\n\t\t\tfor($j = 0; $j < 64; ++$j){\n\t\t\t\t$this->map[$i + ($j << 6)] = $this->lookup($i / 63, $j / 63);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function addBiome(Biome $biome){\n\t\t$this->biomes[$biome->getId()] = $biome;\n\t}\n\n\tpublic function getTemperature($x, $z){\n\t\treturn ($this->temperature->noise2D($x, $z, true) + 1) / 2;\n\t}\n\n\tpublic function getRainfall($x, $z){\n\t\treturn ($this->rainfall->noise2D($x, $z, true) + 1) / 2;\n\t}\n\n\t/**\n\t * @param $x\n\t * @param $z\n\t *\n\t * @return Biome\n\t */\n\tpublic function pickBiome($x, $z){\n\t\t$temperature = (int) ($this->getTemperature($x, $z) * 63);\n\t\t$rainfall = (int) ($this->getRainfall($x, $z) * 63);\n\n\t\t$biomeId = $this->map[$temperature + ($rainfall << 6)];\n\t\treturn isset($this->biomes[$biomeId]) ? $this->biomes[$biomeId] : $this->fallback;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/nether/Nether.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\nether;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Gravel;\nuse pocketmine\\block\\Lava;\nuse pocketmine\\block\\NetherQuartzOre;\nuse pocketmine\\block\\SoulSand;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\biome\\Biome;\nuse pocketmine\\level\\generator\\Generator;\n\nuse pocketmine\\level\\generator\\noise\\Simplex;\n\nuse pocketmine\\level\\generator\\normal\\object\\OreType;\nuse pocketmine\\level\\generator\\nether\\populator\\GroundFire;\nuse pocketmine\\level\\generator\\nether\\populator\\NetherGlowStone;\nuse pocketmine\\level\\generator\\nether\\populator\\NetherLava;\nuse pocketmine\\level\\generator\\nether\\populator\\NetherOre;\nuse pocketmine\\level\\generator\\populator\\Populator;\n\nuse pocketmine\\math\\Vector3 as Vector3;\nuse pocketmine\\utils\\Random;\n\nclass Nether extends Generator{\n\n\t/** @var Populator[] */\n\tprivate $populators = [];\n\t/** @var ChunkManager */\n\tprivate $level;\n\t/** @var Random */\n\tprivate $random;\n\tprivate $waterHeight = 32;\n\tprivate $emptyHeight = 64;\n\tprivate $emptyAmplitude = 1;\n\tprivate $density = 0.5;\n\tprivate $bedrockDepth = 5;\n\n\t/** @var Populator[] */\n\tprivate $generationPopulators = [];\n\t/** @var Simplex */\n\tprivate $noiseBase;\n\n\tprivate static $GAUSSIAN_KERNEL = null;\n\tprivate static $SMOOTH_SIZE = 2;\n\n\tpublic function __construct(array $options = []){\n\t\tif(self::$GAUSSIAN_KERNEL === null){\n\t\t\tself::generateKernel();\n\t\t}\n\t}\n\n\tprivate static function generateKernel(){\n\t\tself::$GAUSSIAN_KERNEL = [];\n\n\t\t$bellSize = 1 / self::$SMOOTH_SIZE;\n\t\t$bellHeight = 2 * self::$SMOOTH_SIZE;\n\n\t\tfor($sx = -self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; ++$sx){\n\t\t\tself::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] = [];\n\n\t\t\tfor($sz = -self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; ++$sz){\n\t\t\t\t$bx = $bellSize * $sx;\n\t\t\t\t$bz = $bellSize * $sz;\n\t\t\t\tself::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE][$sz + self::$SMOOTH_SIZE] = $bellHeight * exp(-($bx * $bx + $bz * $bz) / 2);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Nether\";\n\t}\n\n\tpublic function getWaterHeight() : int{\n\t\treturn $this->waterHeight;\n\t}\n\n\tpublic function getSettings(){\n\t\treturn [];\n\t}\n\n\tpublic function init(ChunkManager $level, Random $random){\n\t\t$this->level = $level;\n\t\t$this->random = $random;\n\t\t$this->random->setSeed($this->level->getSeed());\n\t\t$this->noiseBase = new Simplex($this->random, 8, 2 / 8, 2 / 128);\n\t\t$this->random->setSeed($this->level->getSeed());\n\n\t\t$ores = new NetherOre();\n\t\t$ores->setOreTypes([\n\t\t\tnew OreType(new NetherQuartzOre(), 20, 16, 0, 126),\n\t\t\tnew OreType(new SoulSand(), 5, 64, 0, 126),\n\t\t\tnew OreType(new Gravel(), 8, 33, 0, 126),\n\t\t\tnew OreType(new Lava(), 1, 16, 0, $this->waterHeight),\n\t\t]);\n\t\t$this->populators[] = $ores;\n\t\t$this->populators[] = new NetherGlowStone();\n\t\t$groundFire = new GroundFire();\n\t\t$groundFire->setBaseAmount(1);\n\t\t$groundFire->setRandomAmount(1);\n\t\t$this->populators[] = $groundFire;\n\t\t$lava = new NetherLava();\n\t\t$lava->setBaseAmount(0);\n\t\t$lava->setRandomAmount(0);\n\t\t$this->populators[] = $lava;\n\t}\n\n\tpublic function generateChunk($chunkX, $chunkZ){\n\t\t$this->random->setSeed(0xdeadbeef ^ $chunkX ^ $chunkZ ^ $this->level->getSeed());\n\n\t\t$noise = Generator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 8, 4, $chunkX * 16, 0, $chunkZ * 16);\n\n\t\t$chunk = $this->level->getChunk($chunkX, $chunkZ);\n\n\t\tfor($x = 0; $x < 16; ++$x){\n\t\t\tfor($z = 0; $z < 16; ++$z){\n\n\t\t\t\t$biome = Biome::getBiome(Biome::HELL);\n\t\t\t\t$chunk->setBiomeId($x, $z, $biome->getId());\n\n\t\t\t\tfor($y = 0; $y < 128; ++$y){//The nether is still 128 blocks, #BlameMojang\n\t\t\t\t\tif($y === 0 or $y === 127){\n\t\t\t\t\t\t$chunk->setBlockId($x, $y, $z, Block::BEDROCK);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$noiseValue = (abs($this->emptyHeight - $y) / $this->emptyHeight) * $this->emptyAmplitude - $noise[$x][$z][$y];\n\t\t\t\t\t$noiseValue -= 1 - $this->density;\n\n\t\t\t\t\tif($noiseValue > 0){\n\t\t\t\t\t\t$chunk->setBlockId($x, $y, $z, Block::NETHERRACK);\n\t\t\t\t\t}elseif($y <= $this->waterHeight){\n\t\t\t\t\t\t$chunk->setBlockId($x, $y, $z, Block::STILL_LAVA);\n\t\t\t\t\t\t$chunk->setBlockLight($x, $y + 1, $z, 15);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->generationPopulators as $populator){\n\t\t\t$populator->populate($this->level, $chunkX, $chunkZ, $this->random);\n\t\t}\n\t}\n\n\tpublic function populateChunk($chunkX, $chunkZ){\n\t\t$this->random->setSeed(0xdeadbeef ^ $chunkX ^ $chunkZ ^ $this->level->getSeed());\n\t\tforeach($this->populators as $populator){\n\t\t\t$populator->populate($this->level, $chunkX, $chunkZ, $this->random);\n\t\t}\n\n\t\t$chunk = $this->level->getChunk($chunkX, $chunkZ);\n\t\t$biome = Biome::getBiome($chunk->getBiomeId(7, 7)); // If implement more biomes and stronghold, please add here.\n\t\t$biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random);\n\t}\n\n\tpublic function getSpawn(){\n\t\treturn new Vector3(127.5, 128, 127.5);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/nether/biome/HellBiome.php",
    "content": "<?php\n\n\n\nnamespace pocketmine\\level\\generator\\nether\\biome;\n\nuse pocketmine\\level\\generator\\biome\\Biome;\n\nclass HellBiome extends Biome{\n\t\n\tpublic function __construct(){\n\t\t//TODO: Populators\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"HellBiome\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/nether/object/NetherOre.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\nether\\object;\n\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\math\\VectorMath;\nuse pocketmine\\level\\generator\\normal\\object\\OreType;\nuse pocketmine\\level\\generator\\object\\Object;\nuse pocketmine\\utils\\Random;\n\nclass NetherOre extends Object{\n\tprivate $random;\n\tpublic $type;\n\n\tpublic function __construct(Random $random, OreType $type){\n\t\t$this->type = $type;\n\t\t$this->random = $random;\n\t}\n\n\tpublic function getType(){\n\t\treturn $this->type;\n\t}\n\n\tpublic function canPlaceObject(ChunkManager $level, $x, $y, $z){\n\t\treturn ($level->getBlockIdAt($x, $y, $z) === 87);\n\t}\n\n\tpublic function placeObject(ChunkManager $level, $x, $y, $z){\n\t\t$clusterSize = (int) $this->type->clusterSize;\n\t\t$angle = $this->random->nextFloat() * M_PI;\n\t\t$offset = VectorMath::getDirection2D($angle)->multiply($clusterSize)->divide(8);\n\t\t$x1 = $x + 8 + $offset->x;\n\t\t$x2 = $x + 8 - $offset->x;\n\t\t$z1 = $z + 8 + $offset->y;\n\t\t$z2 = $z + 8 - $offset->y;\n\t\t$y1 = $y + $this->random->nextBoundedInt(3) + 2;\n\t\t$y2 = $y + $this->random->nextBoundedInt(3) + 2;\n\n\t\tfor($count = 0; $count <= $clusterSize; ++$count){\n\t\t\t$seedX = $x1 + ($x2 - $x1) * $count / $clusterSize;\n\t\t\t$seedY = $y1 + ($y2 - $y1) * $count / $clusterSize;\n\t\t\t$seedZ = $z1 + ($z2 - $z1) * $count / $clusterSize;\n\t\t\t$size = ((sin($count * (M_PI / $clusterSize)) + 1) * $this->random->nextFloat() * $clusterSize / 16 + 1) / 2;\n\n\t\t\t$startX = (int) ($seedX - $size);\n\t\t\t$startY = (int) ($seedY - $size);\n\t\t\t$startZ = (int) ($seedZ - $size);\n\t\t\t$endX = (int) ($seedX + $size);\n\t\t\t$endY = (int) ($seedY + $size);\n\t\t\t$endZ = (int) ($seedZ + $size);\n\t\t\t//echo \"ORE: $startX, $startY, $startZ,, $endX, $endY, $endZ\\n\";\n\t\t\tfor($x = $startX; $x <= $endX; ++$x){\n\t\t\t\t$sizeX = ($x + 0.5 - $seedX) / $size;\n\t\t\t\t$sizeX *= $sizeX;\n\n\t\t\t\tif($sizeX < 1){\n\t\t\t\t\tfor($y = $startY; $y <= $endY; ++$y){\n\t\t\t\t\t\t$sizeY = ($y + 0.5 - $seedY) / $size;\n\t\t\t\t\t\t$sizeY *= $sizeY;\n\n\t\t\t\t\t\tif($y > 0 and ($sizeX + $sizeY) < 1){\n\t\t\t\t\t\t\tfor($z = $startZ; $z <= $endZ; ++$z){\n\t\t\t\t\t\t\t\t$sizeZ = ($z + 0.5 - $seedZ) / $size;\n\t\t\t\t\t\t\t\t$sizeZ *= $sizeZ;\n\n\t\t\t\t\t\t\t\tif(($sizeX + $sizeY + $sizeZ) < 1 and $level->getBlockIdAt($x, $y, $z) === 87){\n\t\t\t\t\t\t\t\t\t$level->setBlockIdAt($x, $y, $z, $this->type->material->getId());\n\t\t\t\t\t\t\t\t\tif($this->type->material->getDamage() !== 0){\n\t\t\t\t\t\t\t\t\t\t$level->setBlockDataAt($x, $y, $z, $this->type->material->getDamage());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t//echo \"Placed to $x, $y, $z\\n\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/nether/populator/GroundFire.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\nether\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass GroundFire extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\t\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\t\t\tif($y !== -1 and $this->canGroundFireStay($x, $y, $z)){\n\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::FIRE);\n\t\t\t\t$this->level->updateBlockLight($x, $y, $z);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canGroundFireStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn ($b === Block::AIR or $b === Block::SNOW_LAYER) and $this->level->getBlockIdAt($x, $y - 1, $z) === 87;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 0; $y <= 127; ++$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b == Block::AIR){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : $y;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/nether/populator/NetherGlowStone.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\nether\\populator;\n\nuse pocketmine\\block\\Glowstone;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\normal\\object\\NetherOreTop as ObjectOre;\nuse pocketmine\\level\\generator\\normal\\object\\OreType;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\utils\\Random;\n\nclass NetherGlowStone extends Populator{\n\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$type = new OreType(new Glowstone(), 1, 20, 128, 10);\n\t\t$ore = new ObjectOre($random, $type);\n\t\tfor($i = 0; $i < $ore->type->clusterCount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);\n\t\t\t$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\t\t\t$ore->placeObject($level, $x, $y, $z);\n\t\t}\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b == 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/nether/populator/NetherLava.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\nether\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass NetherLava extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\tif(mt_rand(0, 100) < 5){\n\t\t\t$this->level = $level;\n\t\t\t$amount = $this->getAmount($random);\n\t\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\t\t\t\tif($y !== -1 and $this->canNetherLavaStay($x, $y, $z)){\n\t\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::LAVA);\n\t\t\t\t\t$this->level->updateBlockLight($x, $y, $z);\n\t\t\t\t\t$this->lavaSpread($x, $y, $z);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function getFlowDecay($x1, $y1, $z1, $x2, $y2, $z2){\n\t\tif($this->level->getBlockIdAt($x1, $y1, $z1) !== $this->level->getBlockIdAt($x2, $y2, $z2)){\n\t\t\treturn -1;\n\t\t}else{\n\t\t\treturn $this->level->getBlockDataAt($x2, $y2, $z2);\n\t\t}\n\t}\n\n\tprivate function lavaSpread($x, $y, $z){\n\t\tif($this->level->getChunk($x >> 4, $z >> 4) == null){\n\t\t\treturn;\n\t\t}\n\t\t$decay = $this->getFlowDecay($x, $y, $z, $x, $y, $z);\n\t\t$multiplier = 2;\n\n\t\tif($decay > 0){\n\t\t\t$smallestFlowDecay = -100;\n\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($x, $y, $z, $x, $y, $z - 1, $smallestFlowDecay);\n\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($x, $y, $z, $x, $y, $z + 1, $smallestFlowDecay);\n\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($x, $y, $z, $x - 1, $y, $z, $smallestFlowDecay);\n\t\t\t$smallestFlowDecay = $this->getSmallestFlowDecay($x, $y, $z, $x + 1, $y, $z, $smallestFlowDecay);\n\n\t\t\t$k = $smallestFlowDecay + $multiplier;\n\n\t\t\tif($k >= 8 or $smallestFlowDecay < 0){\n\t\t\t\t$k = -1;\n\t\t\t}\n\n\t\t\tif(($topFlowDecay = $this->getFlowDecay($x, $y, $z, $x, $y + 1, $z)) >= 0){\n\t\t\t\tif($topFlowDecay >= 8){\n\t\t\t\t\t$k = $topFlowDecay;\n\t\t\t\t}else{\n\t\t\t\t\t$k = $topFlowDecay | 0x08;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($decay < 8 and $k < 8 and $k > 1 and mt_rand(0, 4) !== 0){\n\t\t\t\t$k = $decay;\n\t\t\t}\n\n\t\t\tif($k !== $decay){\n\t\t\t\t$decay = $k;\n\t\t\t\tif($decay < 0){\n\t\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, 0);\n\t\t\t\t}else{\n\t\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::LAVA);\n\t\t\t\t\t$this->level->setBlockDataAt($x, $y, $z, $decay);\n\t\t\t\t\t$this->level->updateBlockLight($x, $y, $z);\n\t\t\t\t\t$this->lavaSpread($x, $y, $z);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif($this->canFlowInto($x, $y - 1, $z)){\n\t\t\tif($decay >= 8){\n\t\t\t\t$this->flowIntoBlock($x, $y - 1, $z, $decay);\n\t\t\t}else{\n\t\t\t\t$this->flowIntoBlock($x, $y - 1, $z, $decay | 0x08);\n\t\t\t}\n\t\t}elseif($decay >= 0 and ($decay === 0 or !$this->canFlowInto($x, $y - 1, $z))){\n\t\t\t$flags = $this->getOptimalFlowDirections($x, $y, $z);\n\n\t\t\t$l = $decay + $multiplier;\n\n\t\t\tif($decay >= 8){\n\t\t\t\t$l = 1;\n\t\t\t}\n\n\t\t\tif($l >= 8){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif($flags[0]){\n\t\t\t\t$this->flowIntoBlock($x - 1, $y, $z, $l);\n\t\t\t}\n\n\t\t\tif($flags[1]){\n\t\t\t\t$this->flowIntoBlock($x + 1, $y, $z, $l);\n\t\t\t}\n\n\t\t\tif($flags[2]){\n\t\t\t\t$this->flowIntoBlock($x, $y, $z - 1, $l);\n\t\t\t}\n\n\t\t\tif($flags[3]){\n\t\t\t\t$this->flowIntoBlock($x, $y, $z + 1, $l);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function flowIntoBlock($x, $y, $z, $newFlowDecay){\n\t\tif($this->level->getBlockIdAt($x, $y, $z) === Block::AIR){\n\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::LAVA);\n\t\t\t$this->level->setBlockDataAt($x, $y, $z, $newFlowDecay);\n\t\t\t$this->level->updateBlockLight($x, $y, $z);\n\t\t\t$this->lavaSpread($x, $y, $z);\n\t\t}\n\t}\n\n\tprivate function canFlowInto($x, $y, $z){\n\t\t$id = $this->level->getBlockIdAt($x, $y, $z);\n\t\tif($id === Block::AIR or $id === Block::LAVA or $id === Block::STILL_LAVA){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tprivate function calculateFlowCost($xx, $yy, $zz, $accumulatedCost, $previousDirection){\n\t\t$cost = 1000;\n\n\t\tfor($j = 0; $j < 4; ++$j){\n\t\t\tif(\n\t\t\t\t($j === 0 and $previousDirection === 1) or\n\t\t\t\t($j === 1 and $previousDirection === 0) or\n\t\t\t\t($j === 2 and $previousDirection === 3) or\n\t\t\t\t($j === 3 and $previousDirection === 2)\n\t\t\t){\n\t\t\t\t$x = $xx;\n\t\t\t\t$y = $yy;\n\t\t\t\t$z = $zz;\n\n\t\t\t\tif($j === 0){\n\t\t\t\t\t--$x;\n\t\t\t\t}elseif($j === 1){\n\t\t\t\t\t++$x;\n\t\t\t\t}elseif($j === 2){\n\t\t\t\t\t--$z;\n\t\t\t\t}elseif($j === 3){\n\t\t\t\t\t++$z;\n\t\t\t\t}\n\n\t\t\t\tif(!$this->canFlowInto($x, $y, $z)){\n\t\t\t\t\tcontinue;\n\t\t\t\t}elseif($this->canFlowInto($x, $y, $z) and $this->level->getBlockDataAt($x, $y, $z) === 0){\n\t\t\t\t\tcontinue;\n\t\t\t\t}elseif($this->canFlowInto($x, $y - 1, $z)){\n\t\t\t\t\treturn $accumulatedCost;\n\t\t\t\t}\n\n\t\t\t\tif($accumulatedCost >= 4){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\t$realCost = $this->calculateFlowCost($x, $y, $z, $accumulatedCost + 1, $j);\n\n\t\t\t\tif($realCost < $cost){\n\t\t\t\t\t$cost = $realCost;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $cost;\n\t}\n\n\tprivate function getOptimalFlowDirections($xx, $yy, $zz){\n\t\t$flowCost = [0, 0, 0, 0];\n\t\t$isOptimalFlowDirection = [0, 0, 0, 0];\n\t\tfor($j = 0; $j < 4; ++$j){\n\t\t\t$flowCost[$j] = 1000;\n\n\t\t\t$x = $xx;\n\t\t\t$y = $yy;\n\t\t\t$z = $zz;\n\n\t\t\tif($j === 0){\n\t\t\t\t--$x;\n\t\t\t}elseif($j === 1){\n\t\t\t\t++$x;\n\t\t\t}elseif($j === 2){\n\t\t\t\t--$z;\n\t\t\t}elseif($j === 3){\n\t\t\t\t++$z;\n\t\t\t}\n\n\t\t\tif(!$this->canFlowInto($x, $y, $z)){\n\t\t\t\tcontinue;\n\t\t\t}elseif($this->canFlowInto($x, $y, $z) and $this->level->getBlockDataAt($x, $y, $z) === 0){\n\t\t\t\tcontinue;\n\t\t\t}elseif($this->canFlowInto($x, $y - 1, $z)){\n\t\t\t\t$flowCost[$j] = 0;\n\t\t\t}else{\n\t\t\t\t$flowCost[$j] = $this->calculateFlowCost($x, $y, $z, 1, $j);\n\t\t\t}\n\t\t}\n\n\t\t$minCost = $flowCost[0];\n\n\t\tfor($i = 1; $i < 4; ++$i){\n\t\t\tif($flowCost[$i] < $minCost){\n\t\t\t\t$minCost = $flowCost[$i];\n\t\t\t}\n\t\t}\n\n\t\tfor($i = 0; $i < 4; ++$i){\n\t\t\t$isOptimalFlowDirection[$i] = ($flowCost[$i] === $minCost);\n\t\t}\n\n\t\treturn $isOptimalFlowDirection;\n\t}\n\n\tprivate function getSmallestFlowDecay($x1, $y1, $z1, $x2, $y2, $z2, $decay){\n\t\t$blockDecay = $this->getFlowDecay($x1, $y1, $z1, $x2, $y2, $z2);\n\n\t\tif($blockDecay < 0){\n\t\t\treturn $decay;\n\t\t}elseif($blockDecay === 0){\n\t\t\t//Nothing to do!\n\t\t}elseif($blockDecay >= 8){\n\t\t\t$blockDecay = 0;\n\t\t}\n\n\t\treturn ($decay >= 0 && $blockDecay >= $decay) ? $decay : $blockDecay;\n\t}\n\n\n\tprivate function canNetherLavaStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn $b === Block::AIR;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b == Block::AIR){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : $y;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/nether/populator/NetherOre.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\nether\\populator;\n\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\nether\\object\\NetherOre as ObjectOre;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\utils\\Random;\n\nclass NetherOre extends Populator{\n\tprivate $oreTypes = [];\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\tforeach($this->oreTypes as $type){\n\t\t\t$ore = new ObjectOre($random, $type);\n\t\t\tfor($i = 0; $i < $ore->type->clusterCount; ++$i){\n\t\t\t\t$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);\n\t\t\t\t$y = $random->nextRange($ore->type->minHeight, $ore->type->maxHeight);\n\t\t\t\t$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);\n\t\t\t\tif($ore->canPlaceObject($level, $x, $y, $z)){\n\t\t\t\t\t$ore->placeObject($level, $x, $y, $z);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function setOreTypes(array $types){\n\t\t$this->oreTypes = $types;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/noise/Noise.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Different noise generators for level generation\n */\nnamespace pocketmine\\level\\generator\\noise;\n\n\nabstract class Noise{\n\tprotected $perm = [];\n\tprotected $offsetX = 0;\n\tprotected $offsetY = 0;\n\tprotected $offsetZ = 0;\n\tprotected $octaves = 8;\n\tprotected $persistence;\n\tprotected $expansion;\n\n\tpublic static function floor($x){\n\t\treturn $x >= 0 ? (int) $x : (int) ($x - 1);\n\t}\n\n\tpublic static function fade($x){\n\t\treturn $x * $x * $x * ($x * ($x * 6 - 15) + 10);\n\t}\n\n\tpublic static function lerp($x, $y, $z){\n\t\treturn $y + $x * ($z - $y);\n\t}\n\n\tpublic static function linearLerp($x, $x1, $x2, $q0, $q1){\n\t\treturn (($x2 - $x) / ($x2 - $x1)) * $q0 + (($x - $x1) / ($x2 - $x1)) * $q1;\n\t}\n\n\tpublic static function bilinearLerp($x, $y, $q00, $q01, $q10, $q11, $x1, $x2, $y1, $y2){\n\t\t$dx1 = (($x2 - $x) / ($x2 - $x1));\n\t\t$dx2 = (($x - $x1) / ($x2 - $x1));\n\n\t\treturn (($y2 - $y) / ($y2 - $y1)) * (\n\t\t\t$dx1 * $q00 + $dx2 * $q10\n\t\t) + (($y - $y1) / ($y2 - $y1)) * (\n\t\t\t$dx1 * $q01 + $dx2 * $q11\n\t\t);\n\t}\n\n\tpublic static function trilinearLerp($x, $y, $z, $q000, $q001, $q010, $q011, $q100, $q101, $q110, $q111, $x1, $x2, $y1, $y2, $z1, $z2) {\n\t\t$dx1 = (($x2 - $x) / ($x2 - $x1));\n\t\t$dx2 = (($x - $x1) / ($x2 - $x1));\n\t\t$dy1 = (($y2 - $y) / ($y2 - $y1));\n\t\t$dy2 = (($y - $y1) / ($y2 - $y1));\n\n\t\treturn (($z2 - $z) / ($z2 - $z1)) * (\n\t\t\t$dy1 * (\n\t\t\t\t$dx1 * $q000 + $dx2 * $q100\n\t\t\t) + $dy2 * (\n\t\t\t\t$dx1 * $q001 + $dx2 * $q101\n\t\t\t)\n\t\t) + (($z - $z1) / ($z2 - $z1)) * (\n\t\t\t$dy1 * (\n\t\t\t\t$dx1 * $q010 + $dx2 * $q110\n\t\t\t) + $dy2 * (\n\t\t\t\t$dx1 * $q011 + $dx2 * $q111\n\t\t\t)\n\t\t);\n\t}\n\n\tpublic static function grad($hash, $x, $y, $z){\n\t\t$hash &= 15;\n\t\t$u = $hash < 8 ? $x : $y;\n\t\t$v = $hash < 4 ? $y : (($hash === 12 or $hash === 14) ? $x : $z);\n\n\t\treturn (($hash & 1) === 0 ? $u : -$u) + (($hash & 2) === 0 ? $v : -$v);\n\t}\n\n\tabstract public function getNoise2D($x, $z);\n\n\tabstract public function getNoise3D($x, $y, $z);\n\n\tpublic function noise2D($x, $z, $normalized = false){\n\t\t$result = 0;\n\t\t$amp = 1;\n\t\t$freq = 1;\n\t\t$max = 0;\n\n\t\t$x *= $this->expansion;\n\t\t$z *= $this->expansion;\n\n\t\tfor($i = 0; $i < $this->octaves; ++$i){\n\t\t\t$result += $this->getNoise2D($x * $freq, $z * $freq) * $amp;\n\t\t\t$max += $amp;\n\t\t\t$freq *= 2;\n\t\t\t$amp *= $this->persistence;\n\t\t}\n\n\t\tif($normalized === true){\n\t\t\t$result /= $max;\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\tpublic function noise3D($x, $y, $z, $normalized = false){\n\t\t$result = 0;\n\t\t$amp = 1;\n\t\t$freq = 1;\n\t\t$max = 0;\n\n\t\t$x *= $this->expansion;\n\t\t$y *= $this->expansion;\n\t\t$z *= $this->expansion;\n\n\t\tfor($i = 0; $i < $this->octaves; ++$i){\n\t\t\t$result += $this->getNoise3D($x * $freq, $y * $freq, $z * $freq) * $amp;\n\t\t\t$max += $amp;\n\t\t\t$freq *= 2;\n\t\t\t$amp *= $this->persistence;\n\t\t}\n\n\t\tif($normalized === true){\n\t\t\t$result /= $max;\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\tpublic function setOffset($x, $y, $z){\n\t\t$this->offsetX = $x;\n\t\t$this->offsetY = $y;\n\t\t$this->offsetZ = $z;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/noise/Perlin.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\noise;\n\nuse pocketmine\\utils\\Random;\n\nclass Perlin extends Noise{\n\tpublic static $grad3 = [\n\t\t[1, 1, 0], [-1, 1, 0], [1, -1, 0], [-1, -1, 0],\n\t\t[1, 0, 1], [-1, 0, 1], [1, 0, -1], [-1, 0, -1],\n\t\t[0, 1, 1], [0, -1, 1], [0, 1, -1], [0, -1, -1]\n\t];\n\n\n\tpublic function __construct(Random $random, $octaves, $persistence, $expansion = 1){\n\t\t$this->octaves = $octaves;\n\t\t$this->persistence = $persistence;\n\t\t$this->expansion = $expansion;\n\t\t$this->offsetX = $random->nextFloat() * 256;\n\t\t$this->offsetY = $random->nextFloat() * 256;\n\t\t$this->offsetZ = $random->nextFloat() * 256;\n\n\t\tfor($i = 0; $i < 512; ++$i){\n\t\t\t$this->perm[$i] = 0;\n\t\t}\n\n\t\tfor($i = 0; $i < 256; ++$i){\n\t\t\t$this->perm[$i] = $random->nextBoundedInt(256);\n\t\t}\n\n\t\tfor($i = 0; $i < 256; ++$i){\n\t\t\t$pos = $random->nextBoundedInt(256 - $i) + $i;\n\t\t\t$old = $this->perm[$i];\n\n\t\t\t$this->perm[$i] = $this->perm[$pos];\n\t\t\t$this->perm[$pos] = $old;\n\t\t\t$this->perm[$i + 256] = $this->perm[$i];\n\t\t}\n\n\t}\n\n\tpublic function getNoise3D($x, $y, $z){\n\t\t$x += $this->offsetX;\n\t\t$y += $this->offsetY;\n\t\t$z += $this->offsetZ;\n\n\t\t$floorX = (int) $x;\n\t\t$floorY = (int) $y;\n\t\t$floorZ = (int) $z;\n\n\t\t$X = $floorX & 0xFF;\n\t\t$Y = $floorY & 0xFF;\n\t\t$Z = $floorZ & 0xFF;\n\n\t\t$x -= $floorX;\n\t\t$y -= $floorY;\n\t\t$z -= $floorZ;\n\n\t\t//Fade curves\n\t\t//$fX = self::fade($x);\n\t\t//$fY = self::fade($y);\n\t\t//$fZ = self::fade($z);\n\t\t$fX = $x * $x * $x * ($x * ($x * 6 - 15) + 10);\n\t\t$fY = $y * $y * $y * ($y * ($y * 6 - 15) + 10);\n\t\t$fZ = $z * $z * $z * ($z * ($z * 6 - 15) + 10);\n\n\t\t//Cube corners\n\t\t$A = $this->perm[$X] + $Y;\n\t\t$B = $this->perm[$X + 1] + $Y;\n\n\t\t$AA = $this->perm[$A] + $Z;\n\t\t$AB = $this->perm[$A + 1] + $Z;\n\t\t$BA = $this->perm[$B] + $Z;\n\t\t$BB = $this->perm[$B + 1] + $Z;\n\n\t\t$AA1 = self::grad($this->perm[$AA], $x, $y, $z);\n\t\t$BA1 = self::grad($this->perm[$BA], $x - 1, $y, $z);\n\t\t$AB1 = self::grad($this->perm[$AB], $x, $y - 1, $z);\n\t\t$BB1 = self::grad($this->perm[$BB], $x - 1, $y - 1, $z);\n\t\t$AA2 = self::grad($this->perm[$AA + 1], $x, $y, $z - 1);\n\t\t$BA2 = self::grad($this->perm[$BA + 1], $x - 1, $y, $z - 1);\n\t\t$AB2 = self::grad($this->perm[$AB + 1], $x, $y - 1, $z - 1);\n\t\t$BB2 = self::grad($this->perm[$BB + 1], $x - 1, $y - 1, $z - 1);\n\n\t\t$xLerp11 = $AA1 + $fX * ($BA1 - $AA1);\n\n\t\t$zLerp1 = $xLerp11 + $fY * ($AB1 + $fX * ($BB1 - $AB1) - $xLerp11);\n\n\t\t$xLerp21 = $AA2 + $fX * ($BA2 - $AA2);\n\n\t\treturn $zLerp1 + $fZ * ($xLerp21 + $fY * ($AB2 + $fX * ($BB2 - $AB2) - $xLerp21) - $zLerp1);\n\n\t\t/*\n\t\treturn self::lerp(\n\t\t\t$fZ,\n\t\t\tself::lerp(\n\t\t\t\t$fY,\n\t\t\t\tself::lerp(\n\t\t\t\t\t$fX,\n\t\t\t\t\tself::grad($this->perm[$AA], $x, $y, $z),\n\t\t\t\t\tself::grad($this->perm[$BA], $x - 1, $y, $z)\n\t\t\t\t),\n\t\t\t\tself::lerp(\n\t\t\t\t\t$fX,\n\t\t\t\t\tself::grad($this->perm[$AB], $x, $y - 1, $z),\n\t\t\t\t\tself::grad($this->perm[$BB], $x - 1, $y - 1, $z)\n\t\t\t\t)\n\t\t\t),\n\t\t\tself::lerp(\n\t\t\t\t$fY,\n\t\t\t\tself::lerp(\n\t\t\t\t\t$fX,\n\t\t\t\t\tself::grad($this->perm[$AA + 1], $x, $y, $z - 1),\n\t\t\t\t\tself::grad($this->perm[$BA + 1], $x - 1, $y, $z - 1)\n\t\t\t\t),\n\t\t\t\tself::lerp(\n\t\t\t\t\t$fX,\n\t\t\t\t\tself::grad($this->perm[$AB + 1], $x, $y - 1, $z - 1),\n\t\t\t\t\tself::grad($this->perm[$BB + 1], $x - 1, $y - 1, $z - 1)\n\t\t\t\t)\n\t\t\t)\n\t\t);\n\t\t*/\n\t}\n\n\tpublic function getNoise2D($x, $y){\n\t\treturn $this->getNoise3D($x, $y, 0);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/noise/Simplex.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\noise;\n\nuse pocketmine\\utils\\Random;\n\n/**\n * Generates simplex-based noise.\n *\n * This is a modified version of the freely published version in the paper by\n * Stefan Gustavson at\n * http://staffwww.itn.liu.se/~stegu/simplexnoise/simplexnoise.pdf\n */\nclass Simplex extends Perlin{\n\tprotected static $SQRT_3;\n\tprotected static $SQRT_5;\n\tprotected static $F2;\n\tprotected static $G2;\n\tprotected static $G22;\n\tprotected static $F3;\n\tprotected static $G3;\n\tprotected static $F4;\n\tprotected static $G4;\n\tprotected static $G42;\n\tprotected static $G43;\n\tprotected static $G44;\n\tprotected static $grad4 = [[0, 1, 1, 1], [0, 1, 1, -1], [0, 1, -1, 1], [0, 1, -1, -1],\n\t\t[0, -1, 1, 1], [0, -1, 1, -1], [0, -1, -1, 1], [0, -1, -1, -1],\n\t\t[1, 0, 1, 1], [1, 0, 1, -1], [1, 0, -1, 1], [1, 0, -1, -1],\n\t\t[-1, 0, 1, 1], [-1, 0, 1, -1], [-1, 0, -1, 1], [-1, 0, -1, -1],\n\t\t[1, 1, 0, 1], [1, 1, 0, -1], [1, -1, 0, 1], [1, -1, 0, -1],\n\t\t[-1, 1, 0, 1], [-1, 1, 0, -1], [-1, -1, 0, 1], [-1, -1, 0, -1],\n\t\t[1, 1, 1, 0], [1, 1, -1, 0], [1, -1, 1, 0], [1, -1, -1, 0],\n\t\t[-1, 1, 1, 0], [-1, 1, -1, 0], [-1, -1, 1, 0], [-1, -1, -1, 0]];\n\tprotected static $simplex = [\n\t\t[0, 1, 2, 3], [0, 1, 3, 2], [0, 0, 0, 0], [0, 2, 3, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [1, 2, 3, 0],\n\t\t[0, 2, 1, 3], [0, 0, 0, 0], [0, 3, 1, 2], [0, 3, 2, 1], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [1, 3, 2, 0],\n\t\t[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],\n\t\t[1, 2, 0, 3], [0, 0, 0, 0], [1, 3, 0, 2], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [2, 3, 0, 1], [2, 3, 1, 0],\n\t\t[1, 0, 2, 3], [1, 0, 3, 2], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [2, 0, 3, 1], [0, 0, 0, 0], [2, 1, 3, 0],\n\t\t[0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0],\n\t\t[2, 0, 1, 3], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [3, 0, 1, 2], [3, 0, 2, 1], [0, 0, 0, 0], [3, 1, 2, 0],\n\t\t[2, 1, 0, 3], [0, 0, 0, 0], [0, 0, 0, 0], [0, 0, 0, 0], [3, 1, 0, 2], [0, 0, 0, 0], [3, 2, 0, 1], [3, 2, 1, 0]];\n\tprotected $offsetW;\n\n\n\tpublic function __construct(Random $random, $octaves, $persistence, $expansion = 1){\n\t\tparent::__construct($random, $octaves, $persistence, $expansion);\n\t\t$this->offsetW = $random->nextFloat() * 256;\n\t\tself::$SQRT_3 = sqrt(3);\n\t\tself::$SQRT_5 = sqrt(5);\n\t\tself::$F2 = 0.5 * (self::$SQRT_3 - 1);\n\t\tself::$G2 = (3 - self::$SQRT_3) / 6;\n\t\tself::$G22 = self::$G2 * 2.0 - 1;\n\t\tself::$F3 = 1.0 / 3.0;\n\t\tself::$G3 = 1.0 / 6.0;\n\t\tself::$F4 = (self::$SQRT_5 - 1.0) / 4.0;\n\t\tself::$G4 = (5.0 - self::$SQRT_5) / 20.0;\n\t\tself::$G42 = self::$G4 * 2.0;\n\t\tself::$G43 = self::$G4 * 3.0;\n\t\tself::$G44 = self::$G4 * 4.0 - 1.0;\n\t}\n\n\tprotected static function dot2D($g, $x, $y){\n\t\treturn $g[0] * $x + $g[1] * $y;\n\t}\n\n\tprotected static function dot3D($g, $x, $y, $z){\n\t\treturn $g[0] * $x + $g[1] * $y + $g[2] * $z;\n\t}\n\n\tprotected static function dot4D($g, $x, $y, $z, $w){\n\t\treturn $g[0] * $x + $g[1] * $y + $g[2] * $z + $g[3] * $w;\n\t}\n\n\tpublic function getNoise3D($x, $y, $z){\n\t\t$x += $this->offsetX;\n\t\t$y += $this->offsetY;\n\t\t$z += $this->offsetZ;\n\n\t\t// Skew the input space to determine which simplex cell we're in\n\t\t$s = ($x + $y + $z) * self::$F3; // Very nice and simple skew factor for 3D\n\t\t$i = (int) ($x + $s);\n\t\t$j = (int) ($y + $s);\n\t\t$k = (int) ($z + $s);\n\t\t$t = ($i + $j + $k) * self::$G3;\n\t\t// Unskew the cell origin back to (x,y,z) space\n\t\t$x0 = $x - ($i - $t); // The x,y,z distances from the cell origin\n\t\t$y0 = $y - ($j - $t);\n\t\t$z0 = $z - ($k - $t);\n\n\t\t// For the 3D case, the simplex shape is a slightly irregular tetrahedron.\n\n\t\t// Determine which simplex we are in.\n\t\tif($x0 >= $y0){\n\t\t\tif($y0 >= $z0){\n\t\t\t\t$i1 = 1;\n\t\t\t\t$j1 = 0;\n\t\t\t\t$k1 = 0;\n\t\t\t\t$i2 = 1;\n\t\t\t\t$j2 = 1;\n\t\t\t\t$k2 = 0;\n\t\t\t} // X Y Z order\n\t\t\telseif($x0 >= $z0){\n\t\t\t\t$i1 = 1;\n\t\t\t\t$j1 = 0;\n\t\t\t\t$k1 = 0;\n\t\t\t\t$i2 = 1;\n\t\t\t\t$j2 = 0;\n\t\t\t\t$k2 = 1;\n\t\t\t} // X Z Y order\n\t\t\telse{\n\t\t\t\t$i1 = 0;\n\t\t\t\t$j1 = 0;\n\t\t\t\t$k1 = 1;\n\t\t\t\t$i2 = 1;\n\t\t\t\t$j2 = 0;\n\t\t\t\t$k2 = 1;\n\t\t\t}\n\t\t\t// Z X Y order\n\t\t}else{ // x0<y0\n\t\t\tif($y0 < $z0){\n\t\t\t\t$i1 = 0;\n\t\t\t\t$j1 = 0;\n\t\t\t\t$k1 = 1;\n\t\t\t\t$i2 = 0;\n\t\t\t\t$j2 = 1;\n\t\t\t\t$k2 = 1;\n\t\t\t} // Z Y X order\n\t\t\telseif($x0 < $z0){\n\t\t\t\t$i1 = 0;\n\t\t\t\t$j1 = 1;\n\t\t\t\t$k1 = 0;\n\t\t\t\t$i2 = 0;\n\t\t\t\t$j2 = 1;\n\t\t\t\t$k2 = 1;\n\t\t\t} // Y Z X order\n\t\t\telse{\n\t\t\t\t$i1 = 0;\n\t\t\t\t$j1 = 1;\n\t\t\t\t$k1 = 0;\n\t\t\t\t$i2 = 1;\n\t\t\t\t$j2 = 1;\n\t\t\t\t$k2 = 0;\n\t\t\t}\n\t\t\t// Y X Z order\n\t\t}\n\n\t\t// A step of (1,0,0) in (i,j,k) means a step of (1-c,-c,-c) in (x,y,z),\n\t\t// a step of (0,1,0) in (i,j,k) means a step of (-c,1-c,-c) in (x,y,z), and\n\t\t// a step of (0,0,1) in (i,j,k) means a step of (-c,-c,1-c) in (x,y,z), where\n\t\t// c = 1/6.\n\t\t$x1 = $x0 - $i1 + self::$G3; // Offsets for second corner in (x,y,z) coords\n\t\t$y1 = $y0 - $j1 + self::$G3;\n\t\t$z1 = $z0 - $k1 + self::$G3;\n\t\t$x2 = $x0 - $i2 + 2.0 * self::$G3; // Offsets for third corner in (x,y,z) coords\n\t\t$y2 = $y0 - $j2 + 2.0 * self::$G3;\n\t\t$z2 = $z0 - $k2 + 2.0 * self::$G3;\n\t\t$x3 = $x0 - 1.0 + 3.0 * self::$G3; // Offsets for last corner in (x,y,z) coords\n\t\t$y3 = $y0 - 1.0 + 3.0 * self::$G3;\n\t\t$z3 = $z0 - 1.0 + 3.0 * self::$G3;\n\n\t\t// Work out the hashed gradient indices of the four simplex corners\n\t\t$ii = $i & 255;\n\t\t$jj = $j & 255;\n\t\t$kk = $k & 255;\n\n\t\t$n = 0;\n\n\t\t// Calculate the contribution from the four corners\n\t\t$t0 = 0.6 - $x0 * $x0 - $y0 * $y0 - $z0 * $z0;\n\t\tif($t0 > 0){\n\t\t\t$gi0 = self::$grad3[$this->perm[$ii + $this->perm[$jj + $this->perm[$kk]]] % 12];\n\t\t\t$n += $t0 * $t0 * $t0 * $t0 * ($gi0[0] * $x0 + $gi0[1] * $y0 + $gi0[2] * $z0);\n\t\t}\n\n\t\t$t1 = 0.6 - $x1 * $x1 - $y1 * $y1 - $z1 * $z1;\n\t\tif($t1 > 0){\n\t\t\t$gi1 = self::$grad3[$this->perm[$ii + $i1 + $this->perm[$jj + $j1 + $this->perm[$kk + $k1]]] % 12];\n\t\t\t$n += $t1 * $t1 * $t1 * $t1 * ($gi1[0] * $x1 + $gi1[1] * $y1 + $gi1[2] * $z1);\n\t\t}\n\n\t\t$t2 = 0.6 - $x2 * $x2 - $y2 * $y2 - $z2 * $z2;\n\t\tif($t2 > 0){\n\t\t\t$gi2 = self::$grad3[$this->perm[$ii + $i2 + $this->perm[$jj + $j2 + $this->perm[$kk + $k2]]] % 12];\n\t\t\t$n += $t2 * $t2 * $t2 * $t2 * ($gi2[0] * $x2 + $gi2[1] * $y2 + $gi2[2] * $z2);\n\t\t}\n\n\t\t$t3 = 0.6 - $x3 * $x3 - $y3 * $y3 - $z3 * $z3;\n\t\tif($t3 > 0){\n\t\t\t$gi3 = self::$grad3[$this->perm[$ii + 1 + $this->perm[$jj + 1 + $this->perm[$kk + 1]]] % 12];\n\t\t\t$n += $t3 * $t3 * $t3 * $t3 * ($gi3[0] * $x3 + $gi3[1] * $y3 + $gi3[2] * $z3);\n\t\t}\n\n\t\t// Add contributions from each corner to get the noise value.\n\t\t// The result is scaled to stay just inside [-1,1]\n\t\treturn 32.0 * $n;\n\t}\n\n\tpublic function getNoise2D($x, $y){\n\t\t$x += $this->offsetX;\n\t\t$y += $this->offsetY;\n\n\t\t// Skew the input space to determine which simplex cell we're in\n\t\t$s = ($x + $y) * self::$F2; // Hairy factor for 2D\n\t\t$i = (int) ($x + $s);\n\t\t$j = (int) ($y + $s);\n\t\t$t = ($i + $j) * self::$G2;\n\t\t// Unskew the cell origin back to (x,y) space\n\t\t$x0 = $x - ($i - $t); // The x,y distances from the cell origin\n\t\t$y0 = $y - ($j - $t);\n\n\t\t// For the 2D case, the simplex shape is an equilateral triangle.\n\n\t\t// Determine which simplex we are in.\n\t\tif($x0 > $y0){\n\t\t\t$i1 = 1;\n\t\t\t$j1 = 0;\n\t\t} // lower triangle, XY order: (0,0)->(1,0)->(1,1)\n\t\telse{\n\t\t\t$i1 = 0;\n\t\t\t$j1 = 1;\n\t\t}\n\t\t// upper triangle, YX order: (0,0)->(0,1)->(1,1)\n\n\t\t// A step of (1,0) in (i,j) means a step of (1-c,-c) in (x,y), and\n\t\t// a step of (0,1) in (i,j) means a step of (-c,1-c) in (x,y), where\n\t\t// c = (3-sqrt(3))/6\n\n\t\t$x1 = $x0 - $i1 + self::$G2; // Offsets for middle corner in (x,y) unskewed coords\n\t\t$y1 = $y0 - $j1 + self::$G2;\n\t\t$x2 = $x0 + self::$G22; // Offsets for last corner in (x,y) unskewed coords\n\t\t$y2 = $y0 + self::$G22;\n\n\t\t// Work out the hashed gradient indices of the three simplex corners\n\t\t$ii = $i & 255;\n\t\t$jj = $j & 255;\n\n\t\t$n = 0;\n\n\t\t// Calculate the contribution from the three corners\n\t\t$t0 = 0.5 - $x0 * $x0 - $y0 * $y0;\n\t\tif($t0 > 0){\n\t\t\t$gi0 = self::$grad3[$this->perm[$ii + $this->perm[$jj]] % 12];\n\t\t\t$n += $t0 * $t0 * $t0 * $t0 * ($gi0[0] * $x0 + $gi0[1] * $y0); // (x,y) of grad3 used for 2D gradient\n\t\t}\n\n\t\t$t1 = 0.5 - $x1 * $x1 - $y1 * $y1;\n\t\tif($t1 > 0){\n\t\t\t$gi1 = self::$grad3[$this->perm[$ii + $i1 + $this->perm[$jj + $j1]] % 12];\n\t\t\t$n += $t1 * $t1 * $t1 * $t1 * ($gi1[0] * $x1 + $gi1[1] * $y1);\n\t\t}\n\n\t\t$t2 = 0.5 - $x2 * $x2 - $y2 * $y2;\n\t\tif($t2 > 0){\n\t\t\t$gi2 = self::$grad3[$this->perm[$ii + 1 + $this->perm[$jj + 1]] % 12];\n\t\t\t$n += $t2 * $t2 * $t2 * $t2 * ($gi2[0] * $x2 + $gi2[1] * $y2);\n\t\t}\n\n\t\t// Add contributions from each corner to get the noise value.\n\t\t// The result is scaled to return values in the interval [-1,1].\n\t\treturn 70.0 * $n;\n\t}\n\n\t/**\n\t * Computes and returns the 4D simplex noise for the given coordinates in\n\t * 4D space\n\t *\n\t * @param float $x X coordinate\n\t * @param float $y Y coordinate\n\t * @param float $z Z coordinate\n\t * @param float $w W coordinate\n\t *\n\t * @return float Noise at given location, from range -1 to 1\n\t */\n\t/*public function getNoise4D($x, $y, $z, $w){\n\t\tx += offsetX;\n\t\ty += offsetY;\n\t\tz += offsetZ;\n\t\tw += offsetW;\n\n\t\tn0, n1, n2, n3, n4; // Noise contributions from the five corners\n\n\t\t// Skew the (x,y,z,w) space to determine which cell of 24 simplices we're in\n\t\ts = (x + y + z + w) * self::$F4; // Factor for 4D skewing\n\t\ti = floor(x + s);\n\t\tj = floor(y + s);\n\t\tk = floor(z + s);\n\t\tl = floor(w + s);\n\n\t\tt = (i + j + k + l) * self::$G4; // Factor for 4D unskewing\n\t\tX0 = i - t; // Unskew the cell origin back to (x,y,z,w) space\n\t\tY0 = j - t;\n\t\tZ0 = k - t;\n\t\tW0 = l - t;\n\t\tx0 = x - X0; // The x,y,z,w distances from the cell origin\n\t\ty0 = y - Y0;\n\t\tz0 = z - Z0;\n\t\tw0 = w - W0;\n\n\t\t// For the 4D case, the simplex is a 4D shape I won't even try to describe.\n\t\t// To find out which of the 24 possible simplices we're in, we need to\n\t\t// determine the magnitude ordering of x0, y0, z0 and w0.\n\t\t// The method below is a good way of finding the ordering of x,y,z,w and\n\t\t// then find the correct traversal order for the simplex we’re in.\n\t\t// First, six pair-wise comparisons are performed between each possible pair\n\t\t// of the four coordinates, and the results are used to add up binary bits\n\t\t// for an integer index.\n\t\tc1 = (x0 > y0) ? 32 : 0;\n\t\tc2 = (x0 > z0) ? 16 : 0;\n\t\tc3 = (y0 > z0) ? 8 : 0;\n\t\tc4 = (x0 > w0) ? 4 : 0;\n\t\tc5 = (y0 > w0) ? 2 : 0;\n\t\tc6 = (z0 > w0) ? 1 : 0;\n\t\tc = c1 + c2 + c3 + c4 + c5 + c6;\n\t\ti1, j1, k1, l1; // The integer offsets for the second simplex corner\n\t\ti2, j2, k2, l2; // The integer offsets for the third simplex corner\n\t\ti3, j3, k3, l3; // The integer offsets for the fourth simplex corner\n\n\t\t// simplex[c] is a 4-vector with the numbers 0, 1, 2 and 3 in some order.\n\t\t// Many values of c will never occur, since e.g. x>y>z>w makes x<z, y<w and x<w\n\t\t// impossible. Only the 24 indices which have non-zero entries make any sense.\n\t\t// We use a thresholding to set the coordinates in turn from the largest magnitude.\n\n\t\t// The number 3 in the \"simplex\" array is at the position of the largest coordinate.\n\t\ti1 = simplex[c][0] >= 3 ? 1 : 0;\n\t\tj1 = simplex[c][1] >= 3 ? 1 : 0;\n\t\tk1 = simplex[c][2] >= 3 ? 1 : 0;\n\t\tl1 = simplex[c][3] >= 3 ? 1 : 0;\n\n\t\t// The number 2 in the \"simplex\" array is at the second largest coordinate.\n\t\ti2 = simplex[c][0] >= 2 ? 1 : 0;\n\t\tj2 = simplex[c][1] >= 2 ? 1 : 0;\n\t\tk2 = simplex[c][2] >= 2 ? 1 : 0;\n\t\tl2 = simplex[c][3] >= 2 ? 1 : 0;\n\n\t\t// The number 1 in the \"simplex\" array is at the second smallest coordinate.\n\t\ti3 = simplex[c][0] >= 1 ? 1 : 0;\n\t\tj3 = simplex[c][1] >= 1 ? 1 : 0;\n\t\tk3 = simplex[c][2] >= 1 ? 1 : 0;\n\t\tl3 = simplex[c][3] >= 1 ? 1 : 0;\n\n\t\t// The fifth corner has all coordinate offsets = 1, so no need to look that up.\n\n\t\tx1 = x0 - i1 + self::$G4; // Offsets for second corner in (x,y,z,w) coords\n\t\ty1 = y0 - j1 + self::$G4;\n\t\tz1 = z0 - k1 + self::$G4;\n\t\tw1 = w0 - l1 + self::$G4;\n\n\t\tx2 = x0 - i2 + self::$G42; // Offsets for third corner in (x,y,z,w) coords\n\t\ty2 = y0 - j2 + self::$G42;\n\t\tz2 = z0 - k2 + self::$G42;\n\t\tw2 = w0 - l2 + self::$G42;\n\n\t\tx3 = x0 - i3 + self::$G43; // Offsets for fourth corner in (x,y,z,w) coords\n\t\ty3 = y0 - j3 + self::$G43;\n\t\tz3 = z0 - k3 + self::$G43;\n\t\tw3 = w0 - l3 + self::$G43;\n\n\t\tx4 = x0 + self::$G44; // Offsets for last corner in (x,y,z,w) coords\n\t\ty4 = y0 + self::$G44;\n\t\tz4 = z0 + self::$G44;\n\t\tw4 = w0 + self::$G44;\n\n\t\t// Work out the hashed gradient indices of the five simplex corners\n\t\tii = i & 255;\n\t\tjj = j & 255;\n\t\tkk = k & 255;\n\t\tll = l & 255;\n\n\t\tgi0 = $this->perm[ii + $this->perm[jj + $this->perm[kk + $this->perm[ll]]]] % 32;\n\t\tgi1 = $this->perm[ii + i1 + $this->perm[jj + j1 + $this->perm[kk + k1 + $this->perm[ll + l1]]]] % 32;\n\t\tgi2 = $this->perm[ii + i2 + $this->perm[jj + j2 + $this->perm[kk + k2 + $this->perm[ll + l2]]]] % 32;\n\t\tgi3 = $this->perm[ii + i3 + $this->perm[jj + j3 + $this->perm[kk + k3 + $this->perm[ll + l3]]]] % 32;\n\t\tgi4 = $this->perm[ii + 1 + $this->perm[jj + 1 + $this->perm[kk + 1 + $this->perm[ll + 1]]]] % 32;\n\n\t\t// Calculate the contribution from the five corners\n\t\tt0 = 0.6 - x0 * x0 - y0 * y0 - z0 * z0 - w0 * w0;\n\t\tif(t0 < 0){\n\t\t\tn0 = 0.0;\n\t\t}else{\n\t\t\tt0 *= t0;\n\t\t\tn0 = t0 * t0 * dot(grad4[gi0], x0, y0, z0, w0);\n\t\t}\n\n\t\tt1 = 0.6 - x1 * x1 - y1 * y1 - z1 * z1 - w1 * w1;\n\t\tif(t1 < 0){\n\t\t\tn1 = 0.0;\n\t\t}else{\n\t\t\tt1 *= t1;\n\t\t\tn1 = t1 * t1 * dot(grad4[gi1], x1, y1, z1, w1);\n\t\t}\n\n\t\tt2 = 0.6 - x2 * x2 - y2 * y2 - z2 * z2 - w2 * w2;\n\t\tif(t2 < 0){\n\t\t\tn2 = 0.0;\n\t\t}else{\n\t\t\tt2 *= t2;\n\t\t\tn2 = t2 * t2 * dot(grad4[gi2], x2, y2, z2, w2);\n\t\t}\n\n\t\tt3 = 0.6 - x3 * x3 - y3 * y3 - z3 * z3 - w3 * w3;\n\t\tif(t3 < 0){\n\t\t\tn3 = 0.0;\n\t\t}else{\n\t\t\tt3 *= t3;\n\t\t\tn3 = t3 * t3 * dot(grad4[gi3], x3, y3, z3, w3);\n\t\t}\n\n\t\tt4 = 0.6 - x4 * x4 - y4 * y4 - z4 * z4 - w4 * w4;\n\t\tif(t4 < 0){\n\t\t\tn4 = 0.0;\n\t\t}else{\n\t\t\tt4 *= t4;\n\t\t\tn4 = t4 * t4 * dot(grad4[gi4], x4, y4, z4, w4);\n\t\t}\n\n\t\t// Sum up and scale the result to cover the range [-1,1]\n\t\treturn 27.0 * (n0 + n1 + n2 + n3 + n4);\n\t}*/\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/Normal.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\CoalOre;\nuse pocketmine\\block\\DiamondOre;\nuse pocketmine\\block\\Dirt;\nuse pocketmine\\block\\GoldOre;\nuse pocketmine\\block\\Gravel;\nuse pocketmine\\block\\IronOre;\nuse pocketmine\\block\\LapisOre;\nuse pocketmine\\block\\RedstoneOre;\nuse pocketmine\\block\\Stone;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\biome\\Biome;\nuse pocketmine\\level\\generator\\biome\\BiomeSelector;\nuse pocketmine\\level\\generator\\Generator;\nuse pocketmine\\level\\generator\\noise\\Simplex;\nuse pocketmine\\level\\generator\\normal\\object\\OreType;\nuse pocketmine\\level\\generator\\normal\\populator\\GroundCover;\nuse pocketmine\\level\\generator\\normal\\populator\\Ore;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3 as Vector3;\nuse pocketmine\\utils\\Random;\n\nclass Normal extends Generator{\n\n\t/** @var Populator[] */\n\tprivate $populators = [];\n\t/** @var ChunkManager */\n\tprivate $level;\n\t/** @var Random */\n\tprivate $random;\n\tprivate $waterHeight = 62;\n\tprivate $bedrockDepth = 5;\n\n\t/** @var Populator[] */\n\tprivate $generationPopulators = [];\n\t/** @var Simplex */\n\tprivate $noiseBase;\n\n\t/** @var BiomeSelector */\n\tprivate $selector;\n\n\tprivate static $GAUSSIAN_KERNEL = null;\n\tprivate static $SMOOTH_SIZE = 2;\n\n\tpublic function __construct(array $options = []){\n\t\tif(self::$GAUSSIAN_KERNEL === null){\n\t\t\tself::generateKernel();\n\t\t}\n\t}\n\n\tprivate static function generateKernel(){\n\t\tself::$GAUSSIAN_KERNEL = [];\n\n\t\t$bellSize = 1 / self::$SMOOTH_SIZE;\n\t\t$bellHeight = 2 * self::$SMOOTH_SIZE;\n\n\t\tfor($sx = -self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; ++$sx){\n\t\t\tself::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE] = [];\n\n\t\t\tfor($sz = -self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; ++$sz){\n\t\t\t\t$bx = $bellSize * $sx;\n\t\t\t\t$bz = $bellSize * $sz;\n\t\t\t\tself::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE][$sz + self::$SMOOTH_SIZE] = $bellHeight * exp(-($bx * $bx + $bz * $bz) / 2);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getName(){\n\t\treturn \"normal\";\n\t}\n\n\tpublic function getSettings(){\n\t\treturn [];\n\t}\n\n\tpublic function pickBiome($x, $z){\n\t\t$hash = $x * 2345803 ^ $z * 9236449 ^ $this->level->getSeed();\n\t\t$hash *= $hash + 223;\n\t\t$xNoise = $hash >> 20 & 3;\n\t\t$zNoise = $hash >> 22 & 3;\n\t\tif($xNoise == 3){\n\t\t\t$xNoise = 1;\n\t\t}\n\t\tif($zNoise == 3){\n\t\t\t$zNoise = 1;\n\t\t}\n\n\t\treturn $this->selector->pickBiome($x + $xNoise - 1, $z + $zNoise - 1);\n\t}\n\n\tpublic function init(ChunkManager $level, Random $random){\n\t\t$this->level = $level;\n\t\t$this->random = $random;\n\t\t$this->random->setSeed($this->level->getSeed());\n\t\t$this->noiseBase = new Simplex($this->random, 4, 1 / 4, 1 / 32);\n\t\t$this->random->setSeed($this->level->getSeed());\n\t\t$this->selector = new BiomeSelector($this->random, Biome::getBiome(Biome::OCEAN));\n\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::OCEAN));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::PLAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::DESERT));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::MOUNTAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::FOREST));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::TAIGA));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::SWAMP));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::RIVER));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::ICE_PLAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::SMALL_MOUNTAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::BIRCH_FOREST));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::BEACH));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::MESA));\n\n\t\t$this->selector->recalculate();\n\n\t\t$cover = new GroundCover();\n\t\t$this->generationPopulators[] = $cover;\n\n\t\t$ores = new Ore();\n\t\t$ores->setOreTypes([\n\t\t\tnew OreType(new CoalOre(), 20, 17, 0, 128),\n\t\t\tnew OreType(new IronOre(), 20, 9, 0, 64),\n\t\t\tnew OreType(new RedstoneOre(), 8, 8, 0, 16),\n\t\t\tnew OreType(new LapisOre(), 1, 7, 0, 16),\n\t\t\tnew OreType(new GoldOre(), 2, 9, 0, 32),\n\t\t\tnew OreType(new DiamondOre(), 1, 8, 0, 16),\n\t\t\tnew OreType(new Dirt(), 10, 33, 0, 128),\n\t\t\tnew OreType(new Gravel(), 8, 33, 0, 128),\n\t\t\tnew OreType(new Stone(Stone::GRANITE), 10, 33, 0, 80),\n\t\t\tnew OreType(new Stone(Stone::DIORITE), 10, 33, 0, 80),\n\t\t\tnew OreType(new Stone(Stone::ANDESITE), 10, 33, 0, 80)\n\t\t]);\n\t\t$this->populators[] = $ores;\n\t}\n\n\tpublic function generateChunk($chunkX, $chunkZ){\n\t\t$this->random->setSeed(0xdeadbeef ^ $chunkX ^ $chunkZ ^ $this->level->getSeed());\n\n\t\t$noise = Generator::getFastNoise3D($this->noiseBase, 16, 128, 16, 4, 8, 4, $chunkX * 16, 0, $chunkZ * 16);\n\n\t\t$chunk = $this->level->getChunk($chunkX, $chunkZ);\n\n\t\t$biomeCache = [];\n\n\t\tfor($x = 0; $x < 16; ++$x){\n\t\t\tfor($z = 0; $z < 16; ++$z){\n\t\t\t\t$minSum = 0;\n\t\t\t\t$maxSum = 0;\n\t\t\t\t$weightSum = 0;\n\n\t\t\t\t$biome = $this->pickBiome($chunkX * 16 + $x, $chunkZ * 16 + $z);\n\t\t\t\t$chunk->setBiomeId($x, $z, $biome->getId());\n\n\t\t\t\tfor($sx = -self::$SMOOTH_SIZE; $sx <= self::$SMOOTH_SIZE; ++$sx){\n\t\t\t\t\tfor($sz = -self::$SMOOTH_SIZE; $sz <= self::$SMOOTH_SIZE; ++$sz){\n\n\t\t\t\t\t\t$weight = self::$GAUSSIAN_KERNEL[$sx + self::$SMOOTH_SIZE][$sz + self::$SMOOTH_SIZE];\n\n\t\t\t\t\t\tif($sx === 0 and $sz === 0){\n\t\t\t\t\t\t\t$adjacent = $biome;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$index = Level::chunkHash($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz);\n\t\t\t\t\t\t\tif(isset($biomeCache[$index])){\n\t\t\t\t\t\t\t\t$adjacent = $biomeCache[$index];\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$biomeCache[$index] = $adjacent = $this->pickBiome($chunkX * 16 + $x + $sx, $chunkZ * 16 + $z + $sz);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$minSum += ($adjacent->getMinElevation() - 1) * $weight;\n\t\t\t\t\t\t$maxSum += $adjacent->getMaxElevation() * $weight;\n\n\t\t\t\t\t\t$weightSum += $weight;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$minSum /= $weightSum;\n\t\t\t\t$maxSum /= $weightSum;\n\n\t\t\t\t$smoothHeight = ($maxSum - $minSum) / 2;\n\n\t\t\t\tfor($y = 0; $y < 128; ++$y){\n\t\t\t\t\tif($y === 0){\n\t\t\t\t\t\t$chunk->setBlockId($x, $y, $z, Block::BEDROCK);\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$noiseValue = $noise[$x][$z][$y] - 1 / $smoothHeight * ($y - $smoothHeight - $minSum);\n\n\t\t\t\t\tif($noiseValue > 0){\n\t\t\t\t\t\t$chunk->setBlockId($x, $y, $z, Block::STONE);\n\t\t\t\t\t}elseif($y <= $this->waterHeight){\n\t\t\t\t\t\t$chunk->setBlockId($x, $y, $z, Block::STILL_WATER);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->generationPopulators as $populator){\n\t\t\t$populator->populate($this->level, $chunkX, $chunkZ, $this->random);\n\t\t}\n\t}\n\n\tpublic function populateChunk($chunkX, $chunkZ){\n\t\t$this->random->setSeed(0xdeadbeef ^ ($chunkX << 16) ^ ($chunkZ << 16) ^ $this->level->getSeed());\n\t\tforeach($this->populators as $populator){\n\t\t\t$populator->populate($this->level, ($chunkX << 16), ($chunkZ << 16), $this->random);\n\t\t}\n\n\t\t$chunk = $this->level->getChunk($chunkX, $chunkZ);\n\t\t$biome = Biome::getBiome($chunk->getBiomeId(7, 7)); // This is incorrect. Here need add one mt_rand with all biomes and delete temperature & rainfall method.\n\t\t$biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random);\n\t}\n\n\tpublic function getSpawn(){\n\t\treturn new Vector3(127.5, 128, 127.5);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/Normal2.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\CoalOre;\nuse pocketmine\\block\\DiamondOre;\nuse pocketmine\\block\\Dirt;\nuse pocketmine\\block\\GoldOre;\nuse pocketmine\\block\\Gravel;\nuse pocketmine\\block\\IronOre;\nuse pocketmine\\block\\LapisOre;\nuse pocketmine\\block\\RedstoneOre;\nuse pocketmine\\block\\Stone;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\biome\\Biome;\nuse pocketmine\\level\\generator\\biome\\BiomeSelector;\nuse pocketmine\\level\\generator\\Generator;\nuse pocketmine\\level\\generator\\noise\\Simplex;\nuse pocketmine\\level\\generator\\normal\\object\\OreType;\nuse pocketmine\\level\\generator\\normal\\populator\\Cave;\nuse pocketmine\\level\\generator\\normal\\populator\\GroundCover;\nuse pocketmine\\level\\generator\\normal\\populator\\Ore;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\utils\\Random;\n\nclass Normal2 extends Normal{\n\tconst NAME = \"Normal2\";\n\t/** @var Simplex */\n\tprivate $noiseSeaFloor;\n\t/** @var Simplex */\n\tprivate $noiseLand;\n\t/** @var Simplex */\n\tprivate $noiseMountains;\n\t/** @var Simplex */\n\tprivate $noiseBaseGround;\n\t/** @var Simplex */\n\tprivate $noiseRiver;\n\n\tprivate $heightOffset;\n\n    /** @var Random */\n    private $random;\n    /** @var Populator[] */\n    private $generationPopulators = [];\n    /** @var Populator[] */\n    private $populators = [];\n    /** @var BiomeSelector */\n    private $selector;\n\tprivate $level;\n\n\tprivate $seaHeight = 62;\n\tprivate $seaFloorHeight = 48;\n\tprivate $beathStartHeight = 60;\n\tprivate $beathStopHeight = 64;\n\tprotected $bedrockDepth = 5;\n\tprivate $seaFloorGenerateRange = 5;\n\tprivate $landHeightRange = 18; // 36 / 2\n\tprivate $mountainHeight = 13; // 26 / 2\n\tprivate $basegroundHeight = 3;\n\n\tpublic function pickBiome($x, $z) : Biome{\n\t\t$hash = $x * 2345803 ^ $z * 9236449 ^ $this->level->getSeed();\n\t\t$hash *= $hash + 223;\n\n\t\t$xNoise = $hash >> 20 & 3;\n\t\t$zNoise = $hash >> 22 & 3;\n\n\t\tif($xNoise == 3){\n\t\t\t$xNoise = 1;\n\t\t}\n\t\tif($zNoise == 3){\n\t\t\t$zNoise = 1;\n\t\t}\n\n\t\treturn $this->selector->pickBiome($x + $xNoise - 1, $z + $zNoise - 1);\n\t}\n\n\n\tpublic function init(ChunkManager $level, Random $random){\n\t\t$this->level = $level;\n\t\t$this->random = $random;\n\t\t$this->random->setSeed($this->level->getSeed());\n\t\t$this->noiseSeaFloor = new Simplex($this->random, 1, 1 / 8, 1 / 64);\n\t\t$this->noiseLand = new Simplex($this->random, 2, 1 / 8, 1 / 512);\n\t\t$this->noiseMountains = new Simplex($this->random, 4, 1, 1 / 500);\n\t\t$this->noiseBaseGround = new Simplex($this->random, 4, 1 / 4, 1 / 64);\n\t\t$this->noiseRiver = new Simplex($this->random, 2, 1, 1 / 512);\n\t\t$this->random->setSeed($this->level->getSeed());\n\t\t$this->selector = new BiomeSelector($this->random, Biome::getBiome(Biome::OCEAN));\n\n\t\t$this->heightOffset = $random->nextRange(-5, 3);\n\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::OCEAN));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::PLAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::DESERT));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::MOUNTAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::FOREST));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::TAIGA));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::SWAMP));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::RIVER));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::ICE_PLAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::SMALL_MOUNTAINS));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::BIRCH_FOREST));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::BEACH));\n\t\t$this->selector->addBiome(Biome::getBiome(Biome::MESA));\n\n\t\t$this->selector->recalculate();\n\n\t\t$cover = new GroundCover();\n\t\t$this->generationPopulators[] = $cover;\n\n\t\t$cave = new Cave();\n\t\t$this->populators[] = $cave;\n\n\t\t$ores = new Ore();\n\t\t$ores->setOreTypes([\n\t\t\tnew OreType(new CoalOre(), 20, 17, 0, 128),\n\t\t\tnew OreType(new IronOre(), 20, 9, 0, 64),\n\t\t\tnew OreType(new RedstoneOre(), 8, 8, 0, 16),\n\t\t\tnew OreType(new LapisOre(), 1, 7, 0, 16),\n\t\t\tnew OreType(new GoldOre(), 2, 9, 0, 32),\n\t\t\tnew OreType(new DiamondOre(), 1, 8, 0, 16),\n\t\t\tnew OreType(new Dirt(), 10, 33, 0, 128),\n\t\t\tnew OreType(new Gravel(), 8, 33, 0, 128),\n\t\t\tnew OreType(new Stone(Stone::GRANITE), 10, 33, 0, 80),\n\t\t\tnew OreType(new Stone(Stone::DIORITE), 10, 33, 0, 80),\n\t\t\tnew OreType(new Stone(Stone::ANDESITE), 10, 33, 0, 80)\n\t\t]);\n\t\t$this->populators[] = $ores;\n\t}\n\n\n\tpublic function generateChunk($chunkX, $chunkZ){\n\t\t$this->random->setSeed(0xdeadbeef ^ $chunkX ^ $chunkZ ^ $this->level->getSeed());\n\n\t\t$seaFloorNoise = Generator::getFastNoise2D($this->noiseSeaFloor, 16, 16, 4, $chunkX * 16, 0, $chunkZ * 16);\n\t\t$landNoise = Generator::getFastNoise2D($this->noiseLand, 16, 16, 4, $chunkX * 16, 0, $chunkZ * 16);\n\t\t$mountainNoise = Generator::getFastNoise2D($this->noiseMountains, 16, 16, 4, $chunkX * 16, 0, $chunkZ * 16);\n\t\t$baseNoise = Generator::getFastNoise2D($this->noiseBaseGround, 16, 16, 4, $chunkX * 16, 0, $chunkZ * 16);\n\t\t$riverNoise = Generator::getFastNoise2D($this->noiseRiver, 16, 16, 4, $chunkX * 16, 0, $chunkZ * 16);\n\n\t\t$chunk = $this->level->getChunk($chunkX, $chunkZ);\n\n\t\tfor($genx = 0; $genx < 16; $genx++){\n\t\t\tfor($genz = 0; $genz < 16; $genz++){\n\t\t\t\t$canBaseGround = false;\n\t\t\t\t$canRiver = true;\n\n\t\t\t\t//using a quadratic function which smooth the world\n\t\t\t\t//y = (2.956x)^2 - 0.6,  (0 <= x <= 2)\n\t\t\t\t$landHeightNoise = $landNoise[$genx][$genz] + 1;\n\t\t\t\t$landHeightNoise *= 2.956;\n\t\t\t\t$landHeightNoise = $landHeightNoise * $landHeightNoise;\n\t\t\t\t$landHeightNoise = $landHeightNoise - 0.6;\n\t\t\t\t$landHeightNoise = $landHeightNoise > 0 ? $landHeightNoise : 0;\n\n\t\t\t\t//generate mountains\n\t\t\t\t$mountainHeightGenerate = $mountainNoise[$genx][$genz] - 0.2;\n\t\t\t\t$mountainHeightGenerate = $mountainHeightGenerate > 0 ? $mountainHeightGenerate : 0;\n\t\t\t\t$mountainGenerate = (int) ($this->mountainHeight * $mountainHeightGenerate);\n\n\t\t\t\t$landHeightGenerate = (int) ($this->landHeightRange * $landHeightNoise);\n\t\t\t\tif($landHeightGenerate > $this->landHeightRange){\n\t\t\t\t\tif($landHeightGenerate > $this->landHeightRange){\n\t\t\t\t\t\t$canBaseGround = true;\n\t\t\t\t\t}\n\t\t\t\t\t$landHeightGenerate = $this->landHeightRange;\n\t\t\t\t}\n\n\t\t\t\t$genyHeight = $this->seaFloorHeight + $landHeightGenerate;\n\t\t\t\t$genyHeight += $mountainGenerate;\n\n\t\t\t\t//prepare for generate ocean, desert, and land\n\t\t\t\tif($genyHeight < $this->beathStartHeight){\n\t\t\t\t\tif($genyHeight < $this->beathStartHeight - 5){\n\t\t\t\t\t\t$genyHeight += (int) ($this->seaFloorGenerateRange * $seaFloorNoise[$genx][$genz]);\n\t\t\t\t\t}\n\t\t\t\t\t$biome = Biome::getBiome(Biome::OCEAN);\n\t\t\t\t\tif($genyHeight < $this->seaFloorHeight - $this->seaFloorGenerateRange){\n\t\t\t\t\t\t$genyHeight = $this->seaFloorHeight;\n\t\t\t\t\t}\n\t\t\t\t\t$canRiver = false;\n\t\t\t\t}else if($genyHeight <= $this->beathStopHeight && $genyHeight >= $this->beathStartHeight){\n\t\t\t\t\t$biome = Biome::getBiome(Biome::BEACH);\n\t\t\t\t}else{\n\t\t\t\t\t$biome = $this->pickBiome($chunkX * 16 + $genx, $chunkZ * 16 + $genz);\n\t\t\t\t\tif($canBaseGround){\n\t\t\t\t\t\t$baseGroundHeight = (int) ($this->landHeightRange * $landHeightNoise) - $this->landHeightRange;\n\t\t\t\t\t\t$baseGroundHeight2 = (int) ($this->basegroundHeight * ($baseNoise[$genx][$genz] + 1));\n\t\t\t\t\t\tif($baseGroundHeight2 > $baseGroundHeight) $baseGroundHeight2 = $baseGroundHeight;\n\t\t\t\t\t\tif($baseGroundHeight2 > $mountainGenerate)\n\t\t\t\t\t\t\t$baseGroundHeight2 = $baseGroundHeight2 - $mountainGenerate;\n\t\t\t\t\t\telse $baseGroundHeight2 = 0;\n\t\t\t\t\t\t$genyHeight += $baseGroundHeight2;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($canRiver && $genyHeight <= $this->seaHeight - 5){\n\t\t\t\t\t$canRiver = false;\n\t\t\t\t}\n\t\t\t\t//generate river\n\t\t\t\tif($canRiver){\n\t\t\t\t\t$riverGenerate = $riverNoise[$genx][$genz];\n\t\t\t\t\tif($riverGenerate > -0.25 && $riverGenerate < 0.25){\n\t\t\t\t\t\t$riverGenerate = $riverGenerate > 0 ? $riverGenerate : -$riverGenerate;\n\t\t\t\t\t\t$riverGenerate = 0.25 - $riverGenerate;\n\t\t\t\t\t\t//y=x^2 * 4 - 0.0000001\n\t\t\t\t\t\t$riverGenerate = $riverGenerate * $riverGenerate * 4;\n\t\t\t\t\t\t//smooth again\n\t\t\t\t\t\t$riverGenerate = $riverGenerate - 0.0000001;\n\t\t\t\t\t\t$riverGenerate = $riverGenerate > 0 ? $riverGenerate : 0;\n\t\t\t\t\t\t$genyHeight -= $riverGenerate * 64;\n\t\t\t\t\t\tif($genyHeight < $this->seaHeight){\n\t\t\t\t\t\t\t$biome = Biome::getBiome(Biome::RIVER);\n\t\t\t\t\t\t\t//to generate river floor\n\t\t\t\t\t\t\tif($genyHeight <= $this->seaHeight - 8){\n\t\t\t\t\t\t\t\t$genyHeight1 = $this->seaHeight - 9 + (int) ($this->basegroundHeight * ($baseNoise[$genx][$genz] + 1));\n\t\t\t\t\t\t\t\t$genyHeight2 = $genyHeight < $this->seaHeight - 7 ? $this->seaHeight - 7 : $genyHeight;\n\t\t\t\t\t\t\t\t$genyHeight = $genyHeight1 > $genyHeight2 ? $genyHeight1 : $genyHeight2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$chunk->setBiomeId($genx, $genz, $biome->getId());\n\t\t\t\t//generating\n\t\t\t\t$generateHeight = $genyHeight > $this->seaHeight ? $genyHeight : $this->seaHeight;\n\t\t\t\tfor($geny = 0; $geny <= $generateHeight; $geny++){\n\t\t\t\t\tif($geny <= $this->bedrockDepth && ($geny == 0 or $this->random->nextRange(1, 5) == 1)){\n\t\t\t\t\t\t$chunk->setBlockId($genx, $geny, $genz, Block::BEDROCK);\n\t\t\t\t\t}elseif($geny > $genyHeight){\n\t\t\t\t\t\tif(($biome->getId() == Biome::ICE_PLAINS or $biome->getId() == Biome::TAIGA) and $geny == $this->seaHeight){\n\t\t\t\t\t\t\t$chunk->setBlockId($genx, $geny, $genz, Block::ICE);\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$chunk->setBlockId($genx, $geny, $genz, Block::STILL_WATER);\n\t\t\t\t\t\t}\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$chunk->setBlockId($genx, $geny, $genz, Block::STONE);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t//populator chunk\n\t\tforeach($this->generationPopulators as $populator){\n\t\t\t$populator->populate($this->level, ($chunkX << 16), ($chunkZ << 16), $this->random);\n\t\t}\n\n\t}\n\n\n\tpublic function populateChunk($chunkX, $chunkZ){\n\t\t$this->random->setSeed(0xdeadbeef ^ $chunkX ^ $chunkZ ^ $this->level->getSeed());\n\t\tforeach($this->populators as $populator){\n\t\t\t$populator->populate($this->level, $chunkX, $chunkZ, $this->random);\n\t\t}\n\n\t\t$chunk = $this->level->getChunk($chunkX, $chunkZ);\n\t\t$biome = Biome::getBiome($chunk->getBiomeId(7, 7)); // same as Normal Generator.\n\t\t$biome->populateChunk($this->level, $chunkX, $chunkZ, $this->random);\n\t}\n\n\tpublic function getSpawn(){\n\t\treturn new Vector3(127.5, 128, 127.5);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/BeachBiome.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\level\\generator\\normal\\populator\\Cactus;\nuse pocketmine\\level\\generator\\normal\\populator\\DeadBush;\n\nclass BeachBiome extends SandyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$this->removePopulator(Cactus::class);\n\t\t$this->removePopulator(DeadBush::class);\n\t\t\n\t\t$this->setElevation(62, 65);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Beach\";\n\t}\n} "
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/DesertBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\generator\\normal\\populator\\DeadBush;\nuse pocketmine\\level\\generator\\normal\\populator\\Mushroom;\nuse pocketmine\\level\\generator\\normal\\populator\\SugarCane;\n\nclass DesertBiome extends SandyBiome{\n\n\tpublic function __construct(){\n\t\t$deadBush = new DeadBush();\n\t\t$deadBush->setBaseAmount(1);\n\t\t$deadBush->setRandomAmount(4);\n\n\t\t$sugarCane = new SugarCane();\n\t\t$sugarCane->setRandomAmount(20);\n\t\t$sugarCane->setBaseAmount(3);\n\n\t\t$mushroom = new Mushroom();\n\n\t\t$this->addPopulator($mushroom);\n\t\t$this->addPopulator($deadBush);\n\t\t$this->addPopulator($sugarCane);\n\t\t\n\t\t$this->setElevation(63, 74);\n\n\t\t$this->temperature = 2;\n\t\t$this->rainfall = 0;\n\t\t$this->setGroundCover([\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t]);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Desert\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/ForestBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\block\\Sapling;\nuse pocketmine\\level\\generator\\normal\\populator\\Mushroom;\nuse pocketmine\\level\\generator\\normal\\populator\\TallGrass;\nuse pocketmine\\level\\generator\\normal\\populator\\Tree;\n\nclass ForestBiome extends GrassyBiome{\n\n\tconst TYPE_NORMAL = 0;\n\tconst TYPE_BIRCH = 1;\n\n\tpublic $type;\n\n\tpublic function __construct($type = self::TYPE_NORMAL){\n\t\tparent::__construct();\n\n\t\t$this->type = $type;\n\n\t\t$trees = new Tree($type === self::TYPE_BIRCH ? Sapling::BIRCH : Sapling::OAK);\n\t\t$trees->setBaseAmount(5);\n\t\t$this->addPopulator($trees);\n\n\t\t$tallGrass = new TallGrass();\n\t\t$tallGrass->setBaseAmount(3);\n\n\t\t$this->addPopulator($tallGrass);\n\t\t\n\t\t$mushroom = new Mushroom();\n\t\t$this->addPopulator($mushroom);\n\n\t\t$this->setElevation(63, 81);\n\n\t\tif($type === self::TYPE_BIRCH){\n\t\t\t$this->temperature = 0.5;\n\t\t\t$this->rainfall = 0.5;\n\t\t}else{\n\t\t\t$this->temperature = 0.7;\n\t\t\t$this->temperature = 0.8;\n\t\t}\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->type === self::TYPE_BIRCH ? \"Birch Forest\" : \"Forest\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/GrassyBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\block\\Block;\n\nabstract class GrassyBiome extends NormalBiome{\n\n\tpublic function __construct(){\n\t\t$this->setGroundCover([\n\t\t\tBlock::get(Block::GRASS, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t]);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/IcePlainsBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\level\\generator\\normal\\populator\\TallGrass;\n\nclass IcePlainsBiome extends SnowyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$tallGrass = new TallGrass();\n\t\t$tallGrass->setBaseAmount(5);\n\n\t\t$this->addPopulator($tallGrass);\n\n\t\t$this->setElevation(63, 74);\n\n\t\t$this->temperature = 0.05;\n\t\t$this->rainfall = 0.8;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Ice Plains\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/MesaBiome.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\StainedClay;\nuse pocketmine\\level\\generator\\normal\\populator\\Cactus;\nuse pocketmine\\level\\generator\\normal\\populator\\DeadBush;\n\nclass MesaBiome extends SandyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$cactus = new Cactus();\n\t\t$cactus->setBaseAmount(0);\n\t\t$cactus->setRandomAmount(5);\n\t\t$deadBush = new DeadBush();\n\t\t$cactus->setBaseAmount(2);\n\t\t$deadBush->setRandomAmount(10);\n\n\t\t$this->addPopulator($cactus);\n\t\t$this->addPopulator($deadBush);\n\n\t\t$this->setElevation(63, 81);\n\n\t\t$this->temperature = 2.0;\n\t\t$this->rainfall = 0.8;\n\t\t$this->setGroundCover([\n\t\t\tBlock::get(Block::HARDENED_CLAY, 0),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_PINK),\n\t\t\tBlock::get(Block::HARDENED_CLAY, 0),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_ORANGE),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_BLACK),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_GRAY),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_WHITE),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_ORANGE),\n\t\t\tBlock::get(Block::HARDENED_CLAY, 0),\n\t\t\tBlock::get(Block::HARDENED_CLAY, 0),\n\t\t\tBlock::get(Block::HARDENED_CLAY, 0),\n\t\t\tBlock::get(Block::HARDENED_CLAY, 0),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_YELLOW),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_BLACK),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_PINK),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_PINK),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::STAINED_CLAY, StainedClay::CLAY_WHITE),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t\tBlock::get(Block::RED_SANDSTONE, 0),\n\t\t]);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Mesa\";\n\t}\n} "
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/MountainsBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\n\nuse pocketmine\\level\\generator\\normal\\populator\\TallGrass;\nuse pocketmine\\level\\generator\\normal\\populator\\Tree;\n\nclass MountainsBiome extends GrassyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$trees = new Tree();\n\t\t$trees->setBaseAmount(1);\n\t\t$this->addPopulator($trees);\n\n\t\t$tallGrass = new TallGrass();\n\t\t$tallGrass->setBaseAmount(6);\n\n\t\t$this->addPopulator($tallGrass);\n\n\t\t//TODO: add emerald\n\n\t\t$this->setElevation(63, 127);\n\n\t\t$this->temperature = 0.4;\n\t\t$this->rainfall = 0.5;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Mountains\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/NormalBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\level\\generator\\biome\\Biome;\n\nabstract class NormalBiome extends Biome{\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/OceanBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\level\\generator\\normal\\populator\\Mushroom;\nuse pocketmine\\level\\generator\\normal\\populator\\SugarCane;\nuse pocketmine\\level\\generator\\normal\\populator\\TallGrass;\n\nclass OceanBiome extends WateryBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$sugarcane = new SugarCane();\n\t\t$sugarcane->setBaseAmount(6);\n\t\t$tallGrass = new TallGrass();\n\t\t$tallGrass->setBaseAmount(5);\n\t\t$mushroom = new Mushroom();\n\n\t\t$this->addPopulator($mushroom);\n\t\t$this->addPopulator($sugarcane);\n\t\t$this->addPopulator($tallGrass);\n\n\t\t$this->setElevation(46, 68);\n\n\t\t$this->temperature = 0.5;\n\t\t$this->rainfall = 0.5;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Ocean\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/PlainBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\level\\generator\\normal\\populator\\Mushroom;\nuse pocketmine\\level\\generator\\normal\\populator\\TallGrass;\nuse pocketmine\\level\\generator\\normal\\populator\\LilyPad;\nuse pocketmine\\level\\generator\\normal\\populator\\WaterPit;\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Flower as FlowerBlock;\nuse pocketmine\\level\\generator\\normal\\populator\\Flower;\nuse pocketmine\\level\\generator\\normal\\populator\\SugarCane;\n\nclass PlainBiome extends GrassyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$sugarcane = new SugarCane();\n\t\t$sugarcane->setBaseAmount(6);\n\t\t$tallGrass = new TallGrass();\n\t\t$tallGrass->setBaseAmount(25);\n\t\t$waterPit = new WaterPit();\n\t\t$waterPit->setBaseAmount(9999);\n\t\t$lilyPad = new LilyPad();\n\t\t$lilyPad->setBaseAmount(8);\n\t\t$mushroom = new Mushroom();\n\n\t\t$flower = new Flower();\n\t\t$flower->setBaseAmount(2);\n\t\t$flower->addType([Block::DANDELION, 0]);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_POPPY]);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_AZURE_BLUET]);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_RED_TULIP]);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_ORANGE_TULIP]);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_WHITE_TULIP]);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_PINK_TULIP]);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_OXEYE_DAISY]);\n\n\t\t$this->addPopulator($mushroom);\n\t\t$this->addPopulator($sugarcane);\n\t\t$this->addPopulator($tallGrass);\n\t\t$this->addPopulator($flower);\n\t\t$this->addPopulator($waterPit);\n\t\t$this->addPopulator($lilyPad);\n\n\t\t$this->setElevation(61, 68);\n\n\t\t$this->temperature = 0.8;\n\t\t$this->rainfall = 0.4;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Plains\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/RiverBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\level\\generator\\normal\\populator\\Mushroom;\nuse pocketmine\\level\\generator\\normal\\populator\\SugarCane;\nuse pocketmine\\level\\generator\\normal\\populator\\TallGrass;\n\nclass RiverBiome extends WateryBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$sugarcane = new SugarCane();\n\t\t$sugarcane->setBaseAmount(6);\n\t\t$tallGrass = new TallGrass();\n\t\t$tallGrass->setBaseAmount(5);\n\t\t$mushroom = new Mushroom();\n \n\t\t$this->addPopulator($mushroom);\n\n\t\t$this->addPopulator($sugarcane);\n\t\t$this->addPopulator($tallGrass);\n\n\t\t$this->setElevation(58, 62);\n\n\t\t$this->temperature = 0.5;\n\t\t$this->rainfall = 0.7;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"River\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/SandyBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\generator\\normal\\populator\\Cactus;\nuse pocketmine\\level\\generator\\normal\\populator\\DeadBush;\n\nclass SandyBiome extends GrassyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$cactus = new Cactus();\n\t\t$cactus->setBaseAmount(2);\n\t\t$cactus->setRandomAmount(1);\n\t\t$deadBush = new DeadBush();\n\t\t$deadBush->setBaseAmount(2);\n\n\t\t$this->addPopulator($cactus);\n\t\t$this->addPopulator($deadBush);\n\n\t\t$this->setElevation(63, 81);\n\n\t\t$this->temperature = 0.05;\n\t\t$this->rainfall = 0.8;\n\t\t$this->setGroundCover([\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SAND, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t\tBlock::get(Block::SANDSTONE, 0),\n\t\t]);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Sandy\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/SmallMountainsBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\n\nclass SmallMountainsBiome extends MountainsBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$this->setElevation(63, 97);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Small Mountains\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/SnowyBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\block\\Block;\n\nabstract class SnowyBiome extends NormalBiome{\n\n\tpublic function __construct(){\n\t\t$this->setGroundCover([\n\t\t\tBlock::get(Block::SNOW_LAYER, 0),\n\t\t\tBlock::get(Block::GRASS, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t]);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/SwampBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Flower as FlowerBlock;\nuse pocketmine\\level\\generator\\normal\\populator\\Flower;\nuse pocketmine\\level\\generator\\normal\\populator\\LilyPad;\nuse pocketmine\\level\\generator\\normal\\populator\\Mushroom;\nuse pocketmine\\level\\generator\\normal\\populator\\SugarCane;\nuse pocketmine\\level\\generator\\normal\\populator\\TallGrass;\n\nclass SwampBiome extends GrassyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$flower = new Flower();\n\t\t$flower->setBaseAmount(8);\n\t\t$flower->addType([Block::RED_FLOWER, FlowerBlock::TYPE_BLUE_ORCHID]);\n\n\t\t$lilyPad = new LilyPad();\n\t\t$lilyPad->setBaseAmount(4);\n\n\t\t$tallGrass = new TallGrass();\n\t\t$tallGrass->setBaseAmount(1);\n\n\t\t$mushroom = new Mushroom();\n\t\t$sugarCane = new SugarCane();\n\t\t$sugarCane->setBaseAmount(2);\n\t\t$sugarCane->setRandomAmount(15);\n\n\t\t$this->addPopulator($mushroom);\n\t\t$this->addPopulator($lilyPad);\n\t\t$this->addPopulator($flower);\n\t\t$this->addPopulator($tallGrass);\n\t\t$this->addPopulator($sugarCane);\n\t\t$this->setElevation(60, 66);\n\n\t\t$this->temperature = 0.8;\n\t\t$this->rainfall = 0.9;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Swamp\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/TaigaBiome.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nuse pocketmine\\block\\Sapling;\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\generator\\normal\\populator\\MossStone;\nuse pocketmine\\level\\generator\\normal\\populator\\Mushroom;\nuse pocketmine\\level\\generator\\normal\\populator\\Tree;\n\nclass TaigaBiome extends SnowyBiome{\n\n\tpublic function __construct(){\n\t\tparent::__construct();\n\n\t\t$trees = new Tree(Sapling::SPRUCE);\n\t\t$trees->setBaseAmount(10);\n\t\t$this->addPopulator($trees);\n\t\t$mossStone = new MossStone();\n\t\t$mossStone->setBaseAmount(1);\n\n\t\t$this->addPopulator($mossStone);\n\n\t\t$mushroom = new Mushroom();\n\t\t$this->addPopulator($mushroom);\n\n\t\t$this->setElevation(63, 83);\n\n\t\t$this->temperature = 0.05;\n\t\t$this->rainfall = 0.8;\n\n\t\t$this->setGroundCover([\n\t\t\tBlock::get(Block::PODZOL, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t\tBlock::get(Block::DIRT, 0),\n\t\t\tBlock::get(Block::DIRT, 0)\n\t\t]);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Taiga\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/biome/WateryBiome.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\biome;\n\nabstract class WateryBiome extends GrassyBiome{\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/AcaciaTree.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Leaves2;\nuse pocketmine\\block\\Wood2;\n\nclass AcaciaTree extends Tree{\n\tpublic function __construct(){\n\t\t$this->trunkBlock = Block::WOOD2;\n\t\t$this->leafBlock = Block::LEAVES2;\n\t\t$this->leafType = Leaves2::ACACIA;\n\t\t$this->type = Wood2::ACACIA;\n\t\t$this->treeHeight = 8;\n\t}\n\n\t/*public function placeObject(ChunkManager $level, $x, $y, $z, Random $random){\n\t}*/\n\t//TODO: rewrite\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/BigTree.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\math\\Vector2;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\utils\\VectorIterator;\nuse pocketmine\\utils\\Random;\n\nclass BigTree extends Tree{\n\tpublic $overridable = [\n\t\tBlock::AIR => true,\n\t\tBlock::LEAVES => true,\n\t\tBlock::SAPLING => true\n\t];\n\n\t/** @var Random */\n\tprivate $random;\n\tprivate $trunkHeightMultiplier = 0.618;\n\tprivate $trunkHeight;\n\tprivate $leafAmount = 1;\n\tprivate $leafDistanceLimit = 5;\n\tprivate $widthScale = 1;\n\tprivate $branchSlope = 0.381;\n\n\tprivate $totalHeight;\n\tprivate $baseHeight = 5;\n\n\tpublic function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random){\n\t\tif(!parent::canPlaceObject($level, $x, $y, $z, $random) or $level->getBlockIdAt($x, $y, $z) == Block::WATER or $level->getBlockIdAt($x, $y, $z) == Block::STILL_WATER){\n\t\t\treturn false;\n\t\t}\n\t\t$base = new Vector3($x, $y, $z);\n\t\t$this->totalHeight = $this->baseHeight + $random->nextBoundedInt(12);\n\t\t$availableSpace = $this->getAvailableBlockSpace($level, $base, $base->add(0, $this->totalHeight - 1, 0));\n\t\tif($availableSpace > $this->baseHeight or $availableSpace == -1){\n\t\t\tif($availableSpace != -1){\n\t\t\t\t$this->totalHeight = $availableSpace;\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function placeObject(ChunkManager $level, $x, $y, $z, Random $random){\n\t\t$this->random = $random;\n\t\t$this->trunkHeight = (int) ($this->totalHeight * $this->trunkHeightMultiplier);\n\t\t$leaves = $this->getLeafGroupPoints($level, $x, $y, $z);\n\t\tforeach($leaves as $leaf){\n\t\t\t/** @var Vector3 $leafGroup */\n\t\t\t$leafGroup = $leaf[0];\n\t\t\t$groupX = $leafGroup->getX();\n\t\t\t$groupY = $leafGroup->getY();\n\t\t\t$groupZ = $leafGroup->getZ();\n\t\t\tfor($yy = $groupY; $yy < $groupY + $this->leafDistanceLimit; ++$yy){\n\t\t\t\t$this->generateGroupLayer($level, $groupX, $yy, $groupZ, $this->getLeafGroupLayerSize($yy - $groupY));\n\t\t\t}\n\t\t}\n\t\t$trunk = new VectorIterator($level, new Vector3($x, $y -1, $z), new Vector3($x, $y + $this->trunkHeight, $z));\n\t\twhile($trunk->valid()){\n\t\t\t$trunk->next();\n\t\t\t$pos = $trunk->current();\n\t\t\t$level->setBlockIdAt($pos->x, $pos->y, $pos->z, Block::LOG);\n\t\t}\n\t\t$this->generateBranches($level, $x, $y, $z, $leaves);\n\t}\n\n\tprivate function getLeafGroupPoints(ChunkManager $level, $x, $y, $z){\n\t\t$amount = $this->leafAmount * $this->totalHeight / 13;\n\t\t$groupsPerLayer = (int) (1.382 + $amount * $amount);\n\n\t\tif($groupsPerLayer == 0){\n\t\t\t$groupsPerLayer = 1;\n\t\t}\n\n\t\t$trunkTopY = $y + $this->trunkHeight;\n\t\t$groups = [];\n\t\t$groupY = $y + $this->totalHeight - $this->leafDistanceLimit;\n\t\t$groups[] = [new Vector3($x, $groupY, $z), $trunkTopY];\n\n\t\tfor($currentLayer = (int) ($this->totalHeight - $this->leafDistanceLimit); $currentLayer >= 0; $currentLayer--){\n\t\t\t$layerSize = $this->getRoughLayerSize($currentLayer);\n\n\t\t\tif($layerSize < 0){\n\t\t\t\t$groupY--;\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tfor($count = 0; $count < $groupsPerLayer; $count++){\n\t\t\t\t$scale = $this->widthScale * $layerSize * ($this->random->nextFloat() + 0.328);\n\t\t\t\t$randomOffset = Vector2::createRandomDirection($this->random)->multiply($scale);\n\t\t\t\t$groupX = (int) ($randomOffset->getX() + $x + 0.5);\n\t\t\t\t$groupZ = (int) ($randomOffset->getY() + $z + 0.5);\n\t\t\t\t$group = new Vector3($groupX, $groupY, $groupZ);\n\t\t\t\tif($this->getAvailableBlockSpace($level, $group, $group->add(0, $this->leafDistanceLimit, 0)) != -1){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\t$xOff = (int) ($x - $groupX);\n\t\t\t\t$zOff = (int) ($z - $groupZ);\n\t\t\t\t$horizontalDistanceToTrunk = sqrt($xOff * $xOff + $zOff * $zOff);\n\t\t\t\t$verticalDistanceToTrunk = $horizontalDistanceToTrunk * $this->branchSlope;\n\t\t\t\t$yDiff = (int) ($groupY - $verticalDistanceToTrunk);\n\t\t\t\tif($yDiff > $trunkTopY){\n\t\t\t\t\t$base = $trunkTopY;\n\t\t\t\t}else{\n\t\t\t\t\t$base = $yDiff;\n\t\t\t\t}\n\t\t\t\tif($this->getAvailableBlockSpace($level, new Vector3($x, $base, $z), $group) == -1){\n\t\t\t\t\t$groups[] = [$group, $base];\n\t\t\t\t}\n\t\t\t}\n\t\t\t$groupY--;\n\t\t}\n\t\treturn $groups;\n\t}\n\n\tprivate function getLeafGroupLayerSize(int $y){\n\t\tif($y >= 0 and $y < $this->leafDistanceLimit){\n\t\t\treturn (int) (($y != ($this->leafDistanceLimit - 1)) ? 3 : 2);\n\t\t}\n\t\treturn -1;\n\t}\n\n\tprivate function generateGroupLayer(ChunkManager $level, int $x, int $y, int $z, int $size){\n\t\tfor($xx = $x - $size; $xx <= $x + $size; $xx++){\n\t\t\tfor($zz = $z - $size; $zz <= $z + $size; $zz++){\n\t\t\t\t$sizeX = abs($x - $xx) + 0.5;\n\t\t\t\t$sizeZ = abs($z - $zz) + 0.5;\n\t\t\t\tif(($sizeX * $sizeX + $sizeZ * $sizeZ) <= ($size * $size)){\n\t\t\t\t\tif(isset($this->overridable[$level->getBlockIdAt($xx, $y, $zz)])){\n\t\t\t\t\t\t$level->setBlockIdAt($xx, $y, $zz, Block::LEAVES);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function getRoughLayerSize(int $layer) : float {\n\t\t$halfHeight = $this->totalHeight / 2;\n\t\tif($layer < ($this->totalHeight / 3)){\n\t\t\treturn -1;\n\t\t}elseif($layer == $halfHeight){\n\t\t\treturn $halfHeight / 4;\n\t\t}elseif($layer >= $this->totalHeight or $layer <= 0){\n\t\t\treturn 0;\n\t\t}else{\n\t\t\treturn sqrt($halfHeight * $halfHeight - ($layer - $halfHeight) * ($layer - $halfHeight)) / 2;\n\t\t}\n\t}\n\n\tprivate function generateBranches(ChunkManager $level, int $x, int $y, int $z, array $groups){\n\t\tforeach($groups as $group){\n\t\t\t$baseY = $group[1];\n\t\t\tif(($baseY - $y) >= ($this->totalHeight * 0.2)){\n\t\t\t\t$base = new Vector3($x, $baseY, $z);\n\t\t\t\t$branch = new VectorIterator($level, $base, $group[0]);\n\t\t\t\twhile($branch->valid()){\n\t\t\t\t\t$branch->next();\n\t\t\t\t\t$pos = $branch->current();\n\t\t\t\t\t$level->setBlockIdAt((int) $pos->x, (int) $pos->y, (int) $pos->z, Block::LOG);\n\t\t\t\t\t$level->updateBlockLight((int) $pos->x, (int) $pos->y, (int) $pos->z);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function getAvailableBlockSpace(ChunkManager $level, Vector3 $from, Vector3 $to){\n\t\t$count = 0;\n\t\t$iter = new VectorIterator($level, $from, $to);\n\t\twhile($iter->valid()){\n\t\t\t$iter->next();\n\t\t\t$pos = $iter->current();\n\t\t\tif(!isset($this->overridable[$level->getBlockIdAt($pos->x, $pos->y, $pos->z)])){\n\t\t\t\treturn $count;\n\t\t\t}\n\t\t\t$count++;\n\t\t}\n\t\treturn -1;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/BirchTree.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Leaves;\nuse pocketmine\\block\\Wood;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\n\nclass BirchTree extends Tree{\n\n\tprotected $superBirch = false;\n\n\tpublic function __construct($superBirch = false){\n\t\t$this->trunkBlock = Block::LOG;\n\t\t$this->leafBlock = Block::LEAVES;\n\t\t$this->leafType = Leaves::BIRCH;\n\t\t$this->type = Wood::BIRCH;\n\t\t$this->superBirch = (bool) $superBirch;\n\t}\n\n\tpublic function placeObject(ChunkManager $level, $x, $y, $z, Random $random){\n\t\t$this->treeHeight = $random->nextBoundedInt(3) + 5;\n\t\tif($this->superBirch){\n\t\t\t$this->treeHeight += 5;\n\t\t}\n\t\tparent::placeObject($level, $x, $y, $z, $random);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/CactusStack.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\object\\Object;\nuse pocketmine\\utils\\Random;\n\nclass CactusStack extends Object{\n\t/** @var Random */\n\tprivate $random;\n\tprivate $baseHeight = 1;\n\tprivate $randomHeight = 3;\n\tprivate $totalHeight;\n\n\tpublic function __construct(Random $random){\n\t\t$this->random = $random;\n\t\t$this->randomize();\n\t}\n\n\tpublic function randomize(){\n\t\t$this->totalHeight = $this->baseHeight + $this->random->nextBoundedInt($this->randomHeight);\n\t}\n\n\tpublic function canPlaceObject(ChunkManager $level, int $x, int $y, int $z) : bool{\n\t\t$below = $level->getBlockIdAt($x, $y - 1, $z);\n\t\tif($level->getBlockIdAt($x, $y, $z) == Block::AIR and\n\t\t\t($below == Block::SAND or $below == Block::CACTUS) and (\n\t\t\t\t$level->getBlockIdAt($x - 1, $y - 1 , $z) == Block::AIR and\n\t\t\t\t$level->getBlockIdAt($x + 1, $y - 1, $z) == Block::AIR and\n\t\t\t\t$level->getBlockIdAt($x, $y - 1, $z - 1) == Block::AIR and\n\t\t\t\t$level->getBlockIdAt($x, $y - 1, $z + 1) == Block::AIR\n\t\t\t)\n\t\t){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function placeObject(ChunkManager $level, int $x, int $y, int $z){\n\t\tfor($yy = 0; $yy < $this->totalHeight; $yy++){\n\t\t\tif($level->getBlockIdAt($x, $y + $yy, $z) != Block::AIR){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$level->setBlockIdAt($x, $y + $yy, $z, Block::CACTUS);\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/DarkOakTree.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Leaves2;\nuse pocketmine\\block\\Wood2;\n\nclass DarkOakTree extends Tree{\n\tpublic function __construct(){\n\t\t$this->trunkBlock = Block::WOOD2;\n\t\t$this->leafBlock = Block::LEAVES2;\n\t\t$this->leafType = Leaves2::DARK_OAK;\n\t\t$this->type = Wood2::DARK_OAK;\n\t\t$this->treeHeight = 8;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/JungleTree.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Leaves;\nuse pocketmine\\block\\Wood;\n\nclass JungleTree extends Tree{\n\n\tpublic function __construct(){\n\t\t$this->trunkBlock = Block::LOG;\n\t\t$this->leafBlock = Block::LEAVES;\n\t\t$this->leafType = Leaves::JUNGLE;\n\t\t$this->type = Wood::JUNGLE;\n\t\t$this->treeHeight = 8;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/OakTree.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Leaves;\nuse pocketmine\\block\\Wood;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\n\nclass OakTree extends Tree{\n\n\tpublic function __construct(){\n\t\t$this->trunkBlock = Block::LOG;\n\t\t$this->leafBlock = Block::LEAVES;\n\t\t$this->leafType = Leaves::OAK;\n\t\t$this->type = Wood::OAK;\n\t}\n\n\tpublic function placeObject(ChunkManager $level, $x, $y, $z, Random $random){\n\t\t$this->treeHeight = $random->nextBoundedInt(3) + 4;\n\t\tparent::placeObject($level, $x, $y, $z, $random);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/Ore.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\math\\VectorMath;\nuse pocketmine\\utils\\Random;\n\nclass Ore{\n\tprivate $random;\n\tpublic $type;\n\n\tpublic function __construct(Random $random, OreType $type){\n\t\t$this->type = $type;\n\t\t$this->random = $random;\n\t}\n\n\tpublic function getType(){\n\t\treturn $this->type;\n\t}\n\n\tpublic function canPlaceObject(ChunkManager $level, $x, $y, $z){\n\t\treturn (($level->getBlockIdAt($x, $y, $z) === 1) or ($level->getBlockIdAt($x, $y, $z) === 87));\n\t}\n\n\tpublic function placeObject(ChunkManager $level, $x, $y, $z){\n\t\t$clusterSize = (int) $this->type->clusterSize;\n\t\t$angle = $this->random->nextFloat() * M_PI;\n\t\t$offset = VectorMath::getDirection2D($angle)->multiply($clusterSize)->divide(8);\n\t\t$x1 = $x + 8 + $offset->x;\n\t\t$x2 = $x + 8 - $offset->x;\n\t\t$z1 = $z + 8 + $offset->y;\n\t\t$z2 = $z + 8 - $offset->y;\n\t\t$y1 = $y + $this->random->nextBoundedInt(3) + 2;\n\t\t$y2 = $y + $this->random->nextBoundedInt(3) + 2;\n\t\tfor($count = 0; $count <= $clusterSize; ++$count){\n\t\t\t$seedX = $x1 + ($x2 - $x1) * $count / $clusterSize;\n\t\t\t$seedY = $y1 + ($y2 - $y1) * $count / $clusterSize;\n\t\t\t$seedZ = $z1 + ($z2 - $z1) * $count / $clusterSize;\n\t\t\t$size = ((sin($count * (M_PI / $clusterSize)) + 1) * $this->random->nextFloat() * $clusterSize / 16 + 1) / 2;\n\n\t\t\t$startX = (int) ($seedX - $size);\n\t\t\t$startY = (int) ($seedY - $size);\n\t\t\t$startZ = (int) ($seedZ - $size);\n\t\t\t$endX = (int) ($seedX + $size);\n\t\t\t$endY = (int) ($seedY + $size);\n\t\t\t$endZ = (int) ($seedZ + $size);\n\n\t\t\tfor($x = $startX; $x <= $endX; ++$x){\n\t\t\t\t$sizeX = ($x + 0.5 - $seedX) / $size;\n\t\t\t\t$sizeX *= $sizeX;\n\n\t\t\t\tif($sizeX < 1){\n\t\t\t\t\tfor($y = $startY; $y <= $endY; ++$y){\n\t\t\t\t\t\t$sizeY = ($y + 0.5 - $seedY) / $size;\n\t\t\t\t\t\t$sizeY *= $sizeY;\n\n\t\t\t\t\t\tif($y > 0 and ($sizeX + $sizeY) < 1){\n\t\t\t\t\t\t\tfor($z = $startZ; $z <= $endZ; ++$z){\n\t\t\t\t\t\t\t\t$sizeZ = ($z + 0.5 - $seedZ) / $size;\n\t\t\t\t\t\t\t\t$sizeZ *= $sizeZ;\n\n\t\t\t\t\t\t\t\tif(($sizeX + $sizeY + $sizeZ) < 1 and (($level->getBlockIdAt($x, $y, $z) === 1) or ($level->getBlockIdAt($x, $y, $z) === 87)) ){\n\t\t\t\t\t\t\t\t\t$level->setBlockIdAt($x, $y, $z, $this->type->material->getId());\n\t\t\t\t\t\t\t\t\tif($this->type->material->getDamage() !== 0){\n\t\t\t\t\t\t\t\t\t\t$level->setBlockDataAt($x, $y, $z, $this->type->material->getDamage());\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/OreType.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\n\nclass OreType{\n\tpublic $material, $clusterCount, $clusterSize, $maxHeight, $minHeight;\n\n\tpublic function __construct(Block $material, $clusterCount, $clusterSize, $minHeight, $maxHeight){\n\t\t$this->material = $material;\n\t\t$this->clusterCount = (int) $clusterCount;\n\t\t$this->clusterSize = (int) $clusterSize;\n\t\t$this->maxHeight = (int) $maxHeight;\n\t\t$this->minHeight = (int) $minHeight;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/Pond.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\math\\Vector3 as Vector3;\nuse pocketmine\\utils\\Random;\n\nclass Pond{\n\tprivate $random;\n\tpublic $type;\n\n\tpublic function __construct(Random $random, Block $type){\n\t\t$this->type = $type;\n\t\t$this->random = $random;\n\t}\n\n\tpublic function canPlaceObject(ChunkManager $level, Vector3 $pos){\n\t}\n\n\tpublic function placeObject(ChunkManager $level, Vector3 $pos){\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/SpruceTree.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Leaves;\nuse pocketmine\\block\\Wood;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\n\nclass SpruceTree extends Tree{\n\n\tpublic function __construct(){\n\t\t$this->trunkBlock = Block::LOG;\n\t\t$this->leafBlock = Block::LEAVES;\n\t\t$this->leafType = Leaves::SPRUCE;\n\t\t$this->type = Wood::SPRUCE;\n\t\t$this->treeHeight = 10;\n\t}\n\n\tpublic function placeObject(ChunkManager $level, $x, $y, $z, Random $random){\n\t\t$this->treeHeight = $random->nextBoundedInt(4) + 6;\n\n\t\t$topSize = $this->treeHeight - (1 + $random->nextBoundedInt(2));\n        $lRadius = 2 + $random->nextBoundedInt(2);\n\n\t\t$this->placeTrunk($level, $x, $y, $z, $random, $this->treeHeight - $random->nextBoundedInt(3));\n\n\t\t$radius = $random->nextBoundedInt(2);\n\t\t$maxR = 1;\n\t\t$minR = 0;\n\n\t\tfor($yy = 0; $yy <= $topSize; ++$yy){\n\t\t\t$yyy = $y + $this->treeHeight - $yy;\n\n\t\t\tfor($xx = $x - $radius; $xx <= $x + $radius; ++$xx){\n\t\t\t\t$xOff = abs($xx - $x);\n\t\t\t\tfor($zz = $z - $radius; $zz <= $z + $radius; ++$zz){\n\t\t\t\t\t$zOff = abs($zz - $z);\n                    if($xOff === $radius and $zOff === $radius and $radius > 0){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!Block::$solid[$level->getBlockIdAt($xx, $yyy, $zz)]){\n\t\t\t\t\t\t$level->setBlockIdAt($xx, $yyy, $zz, $this->leafBlock);\n\t\t\t\t\t\t$level->setBlockDataAt($xx, $yyy, $zz, $this->type);\n\t\t\t\t\t}\n                }\n            }\n\n            if($radius >= $maxR){\n\t\t\t\t$radius = $minR;\n\t\t\t\t$minR = 1;\n\t\t\t\tif(++$maxR > $lRadius){\n\t\t\t\t\t$maxR = $lRadius;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t++$radius;\n\t\t\t}\n\t\t}\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/SugarCaneStack.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\n \nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\object\\Object;\nuse pocketmine\\utils\\Random;\n\nclass SugarCaneStack extends Object{\n\t\n\t/** @var Random */\n\tprivate $random;\n\tprivate $baseHeight = 2;\n\tprivate $randomHeight = 4;\n\tprivate $totalHeight;\n\t\n\tpublic function __construct(Random $random){\n\t\t$this->random = $random;\n\t\t$this->randomize();\n\t}\n\t\n\tpublic function randomize(){\n\t\t$this->totalHeight = $this->baseHeight + $this->random->nextBoundedInt($this->randomHeight);\n\t}\n\t\n\tprivate function isWater(int $id) : bool{\n\t\tif($id == Block::WATER or $id == Block::STILL_WATER){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpublic function canPlaceObject(ChunkManager $level, int $x, int $y, int $z) : bool{\n\t\t$below = $level->getBlockIdAt($x, $y - 1, $z);\n\t\tif($level->getBlockIdAt($x, $y, $z) == Block::AIR and\n\t\t\t($below == Block::DIRT or $below == Block::GRASS or $below == Block::SAND) and (\n\t\t\t\t$this->isWater($level->getBlockIdAt($x - 1, $y - 1 , $z)) or\n\t\t\t\t$this->isWater($level->getBlockIdAt($x + 1, $y - 1, $z)) or\n\t\t\t\t$this->isWater($level->getBlockIdAt($x, $y - 1, $z - 1)) or\n\t\t\t\t$this->isWater($level->getBlockIdAt($x, $y - 1, $z + 1))\n\t\t\t)\n\t\t){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\t\n\tpublic function placeObject(ChunkManager $level, int $x, int $y, int $z){\n\t\tfor($yy = 0; $yy < $this->totalHeight; $yy++){\n\t\t\tif($level->getBlockIdAt($x, $y + $yy, $z) != Block::AIR){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$level->setBlockIdAt($x, $y + $yy, $z, Block::SUGARCANE_BLOCK);\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/TallGrass.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\math\\Vector3 as Vector3;\nuse pocketmine\\level\\generator\\object\\Object;\nuse pocketmine\\utils\\Random;\n\nclass TallGrass extends Object{\n\tpublic static function growGrass(ChunkManager $level, Vector3 $pos, Random $random, $count = 15, $radius = 10){\n\t\t$arr = [\n\t\t\t[Block::DANDELION, 0],\n\t\t\t[Block::POPPY, 0],\n\t\t\t[Block::TALL_GRASS, 1],\n\t\t\t[Block::TALL_GRASS, 1],\n\t\t\t[Block::TALL_GRASS, 1],\n\t\t\t[Block::TALL_GRASS, 1]\n\t\t];\n\t\t$arrC = count($arr) - 1;\n\t\tfor($c = 0; $c < $count; ++$c){\n\t\t\t$x = $random->nextRange($pos->x - $radius, $pos->x + $radius);\n\t\t\t$z = $random->nextRange($pos->z - $radius, $pos->z + $radius);\n\t\t\tif($level->getBlockIdAt($x, $pos->y + 1, $z) === Block::AIR and $level->getBlockIdAt($x, $pos->y, $z) === Block::GRASS){\n\t\t\t\t$t = $arr[$random->nextRange(0, $arrC)];\n\t\t\t\t$level->setBlockIdAt($x, $pos->y + 1, $z, $t[0]);\n\t\t\t\t$level->setBlockDataAt($x, $pos->y + 1, $z, $t[1]);\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/object/Tree.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\object;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Sapling;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\object\\Object;\nuse pocketmine\\utils\\Random;\n\nabstract class Tree extends Object{\n\tpublic $overridable = [\n\t\tBlock::AIR => true,\n\t\t6 => true,\n\t\t17 => true,\n\t\t18 => true,\n\t\tBlock::SNOW_LAYER => true,\n\t\tBlock::LOG2 => true,\n\t\tBlock::LEAVES2 => true\n\t];\n\n\tpublic $type = 0;\n\tpublic $trunkBlock = Block::LOG;\n\tpublic $leafBlock = Block::LEAVES;\n\tpublic $treeHeight = 7;\n\tpublic $leafType = 0;\n\n\tpublic static function growTree(ChunkManager $level, $x, $y, $z, Random $random, $type = 0, bool $noBigTree = true){\n\t\tswitch($type){\n\t\t\tcase Sapling::SPRUCE:\n\t\t\t\t$tree = new SpruceTree();\n\t\t\t\tbreak;\n\t\t\tcase Sapling::BIRCH:\n\t\t\t\tif($random->nextBoundedInt(39) === 0){\n\t\t\t\t\t$tree = new BirchTree(true);\n\t\t\t\t}else{\n\t\t\t\t\t$tree = new BirchTree();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase Sapling::JUNGLE:\n\t\t\t\t$tree = new JungleTree();\n\t\t\t\tbreak;\n\t\t\tcase Sapling::ACACIA:\n\t\t\t\t$tree = new AcaciaTree();\n\t\t\t\tbreak;\n\t\t\tcase Sapling::DARK_OAK:\n\t\t\t\t$tree = new DarkOakTree();\n\t\t\t\tbreak;\n\t\t\tcase Sapling::OAK:\n\t\t\tdefault:\n\t\t\t\tif(!$noBigTree and $random->nextRange(0, 9) === 0){\n\t\t\t\t\t$tree = new BigTree();\n\t\t\t\t}else{\n\t\t\t\t\t$tree = new OakTree();\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t\tif($tree->canPlaceObject($level, $x, $y, $z, $random)){\n\t\t\t$tree->placeObject($level, $x, $y, $z, $random);\n\t\t}\n\t}\n\n\n\tpublic function canPlaceObject(ChunkManager $level, $x, $y, $z, Random $random){\n\t\t$radiusToCheck = 0;\n\t\tfor($yy = 0; $yy < $this->treeHeight + 3; ++$yy){\n\t\t\tif($yy == 1 or $yy === $this->treeHeight){\n\t\t\t\t++$radiusToCheck;\n\t\t\t}\n\t\t\tfor($xx = -$radiusToCheck; $xx < ($radiusToCheck + 1); ++$xx){\n\t\t\t\tfor($zz = -$radiusToCheck; $zz < ($radiusToCheck + 1); ++$zz){\n\t\t\t\t\tif(!isset($this->overridable[$level->getBlockIdAt($x + $xx, $y + $yy, $z + $zz)])){\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function placeObject(ChunkManager $level, $x, $y, $z, Random $random){\n\n\t\t$this->placeTrunk($level, $x, $y, $z, $random, $this->treeHeight - 1);\n\n\t\tfor($yy = $y - 3 + $this->treeHeight; $yy <= $y + $this->treeHeight; ++$yy){\n\t\t\t$yOff = $yy - ($y + $this->treeHeight);\n\t\t\t$mid = (int) (1 - $yOff / 2);\n\t\t\tfor($xx = $x - $mid; $xx <= $x + $mid; ++$xx){\n\t\t\t\t$xOff = abs($xx - $x);\n\t\t\t\tfor($zz = $z - $mid; $zz <= $z + $mid; ++$zz){\n\t\t\t\t\t$zOff = abs($zz - $z);\n\t\t\t\t\tif($xOff === $mid and $zOff === $mid and ($yOff === 0 or $random->nextBoundedInt(2) === 0)){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\tif(!Block::$solid[$level->getBlockIdAt($xx, $yy, $zz)]){\n\t\t\t\t\t\t$level->setBlockIdAt($xx, $yy, $zz, $this->leafBlock);\n\t\t\t\t\t\t$level->setBlockDataAt($xx, $yy, $zz, $this->leafType);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected function placeTrunk(ChunkManager $level, $x, $y, $z, Random $random, $trunkHeight){\n\t\t// The base dirt block\n\t\t$level->setBlockIdAt($x, $y - 1, $z, Block::DIRT);\n\n\t\tfor($yy = 0; $yy < $trunkHeight; ++$yy){\n\t\t\t$blockId = $level->getBlockIdAt($x, $y + $yy, $z);\n\t\t\tif(isset($this->overridable[$blockId])){\n\t\t\t\t$level->setBlockIdAt($x, $y + $yy, $z, $this->trunkBlock);\n\t\t\t\t$level->setBlockDataAt($x, $y + $yy, $z, $this->type);\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Cactus.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\normal\\object\\CactusStack;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass Cactus extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\tpublic function __construct(){\n\t\tparent::__construct(2, 1);\n\t}\n\t\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\t$cactus = new CactusStack($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\t\t\t$cactus->randomize();\n\t\t\tif($y !== -1 and $cactus->canPlaceObject($level, $x, $y, $z)){\n\t\t\t\t$cactus->placeObject($level, $x, $y, $z);\n\t\t\t}\n\t\t}\n\t}\n\t\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Cave.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\math\\Math;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\math\\VectorMath;\nuse pocketmine\\utils\\Random;\n\nclass Cave extends Populator{\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$overlap = 8;\n\t\t$firstSeed = $random->nextInt();\n\t\t$secondSeed = $random->nextInt();\n\t\tfor($cxx = 0; $cxx < 1; $cxx++){\n\t\t\tfor($czz = 0; $czz < 1; $czz++){\n\t\t\t\t$dcx = $chunkX + $cxx;\n\t\t\t\t$dcz = $chunkZ + $czz;\n\t\t\t\tfor($cxxx = -$overlap; $cxxx <= $overlap; $cxxx++){\n\t\t\t\t\tfor($czzz = -$overlap; $czzz <= $overlap; $czzz++){\n\t\t\t\t\t\t$dcxx = $dcx + $cxxx;\n\t\t\t\t\t\t$dczz = $dcz + $czzz;\n\t\t\t\t\t\t$this->pop($level, $dcxx, $dczz, $dcx, $dcz, new Random(($dcxx * $firstSeed) ^ ($dczz * $secondSeed) ^ $random->getSeed()));\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function pop(ChunkManager $level, $x, $z, $chunkX, $chunkZ, Random $random){\n\t\t$c = $level->getChunk($x, $z);\n\t\t$oC = $level->getChunk($chunkX, $chunkZ);\n\t\tif($c == null or $oC == null or ($c != null and !$c->isGenerated()) or ($oC != null and !$oC->isGenerated())){\n\t\t\treturn;\n\t\t}\n\t\t$chunk = new Vector3($x << 4, 0, $z << 4);\n\t\t$originChunk = new Vector3($chunkX << 4, 0, $chunkZ << 4);\n\t\tif($random->nextRange(0, 15) != 0){\n\t\t\treturn;\n\t\t}\n\n\t\t$numberOfCaves = $random->nextRange(0, $random->nextRange(0, $random->nextRange(0, 40) + 1) + 1);\n\t\tfor($caveCount = 0; $caveCount < $numberOfCaves; $caveCount++){\n\t\t\t$target = new Vector3($chunk->getX() + $random->nextRange(0, 16), $random->nextRange(0, $random->nextRange(0, 120) + 8), $chunk->getZ() + $random->nextRange(0, 16));\n\n\t\t\t$numberOfSmallCaves = 1;\n\n\t\t\tif($random->nextRange(0, 4) == 0){\n\t\t\t\t$this->generateLargeCaveBranch($level, $originChunk, $target, new Random($random->nextInt()));\n\t\t\t\t$numberOfSmallCaves += $random->nextRange(0, 4);\n\t\t\t}\n\n\t\t\tfor($count = 0; $count < $numberOfSmallCaves; $count++){\n\t\t\t\t$randomHorizontalAngle = $random->nextFloat() * pi() * 2;\n\t\t\t\t$randomVerticalAngle = (($random->nextFloat() - 0.5) * 2) / 8;\n\t\t\t\t$horizontalScale = $random->nextFloat() * 2 + $random->nextFloat();\n\n\t\t\t\tif($random->nextRange(0, 10) == 0){\n\t\t\t\t\t$horizontalScale *= $random->nextFloat() * $random->nextFloat() * 3 + 1;\n\t\t\t\t}\n\n\t\t\t\t$this->generateCaveBranch($level, $originChunk, $target, $horizontalScale, 1, $randomHorizontalAngle, $randomVerticalAngle, 0, 0, new Random($random->nextInt()));\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function generateCaveBranch(ChunkManager $level, Vector3 $chunk, Vector3 $target, $horizontalScale, $verticalScale, $horizontalAngle, $verticalAngle, int $startingNode, int $nodeAmount, Random $random){\n\t\t$middle = new Vector3($chunk->getX() + 8, 0, $chunk->getZ() + 8);\n\t\t$horizontalOffset = 0;\n\t\t$verticalOffset = 0;\n\n\t\tif($nodeAmount <= 0){\n\t\t\t$size = 7 * 16;\n\t\t\t$nodeAmount = $size - $random->nextRange(0, $size / 4);\n\t\t}\n\n\t\t$intersectionMode = $random->nextRange(0, $nodeAmount / 2) + $nodeAmount / 4;\n\t\t$extraVerticalScale = $random->nextRange(0, 6) == 0;\n\n\t\tif($startingNode == -1){\n\t\t\t$startingNode = $nodeAmount / 2;\n\t\t\t$lastNode = true;\n\t\t}else{\n\t\t\t$lastNode = false;\n\t\t}\n\n\t\tfor(; $startingNode < $nodeAmount; $startingNode++){\n\t\t\t$horizontalSize = 1.5 + sin($startingNode * pi() / $nodeAmount) * $horizontalScale;\n\t\t\t$verticalSize = $horizontalSize * $verticalScale;\n\t\t\t$target = $target->add(VectorMath::getDirection3D($horizontalAngle, $verticalAngle));\n\t\t\tif($extraVerticalScale){\n\t\t\t\t$verticalAngle *= 0.92;\n\t\t\t}else{\n\t\t\t\t$verticalScale *= 0.7;\n\t\t\t}\n\n\t\t\t$verticalAngle += $verticalOffset * 0.1;\n\t\t\t$horizontalAngle += $horizontalOffset * 0.1;\n\t\t\t$verticalOffset *= 0.9;\n\t\t\t$horizontalOffset *= 0.75;\n\t\t\t$verticalOffset += ($random->nextFloat() - $random->nextFloat()) * $random->nextFloat() * 2;\n\t\t\t$horizontalOffset += ($random->nextFloat() - $random->nextFloat()) * $random->nextFloat() * 4;\n\n\t\t\tif(!$lastNode){\n\t\t\t\tif($startingNode == $intersectionMode and $horizontalScale > 1 and $nodeAmount > 0){\n\t\t\t\t\t$this->generateCaveBranch($level, $chunk, $target, $random->nextFloat() * 0.5 + 0.5, 1, $horizontalAngle - pi() / 2, $verticalAngle / 3, $startingNode, $nodeAmount, new Random($random->nextInt()));\n\t\t\t\t\t$this->generateCaveBranch($level, $chunk, $target, $random->nextFloat() * 0.5 + 0.5, 1, $horizontalAngle - pi() / 2, $verticalAngle / 3, $startingNode, $nodeAmount, new Random($random->nextInt()));\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tif($random->nextRange(0, 4) == 0){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$xOffset = $target->getX() - $middle->getX();\n\t\t\t$zOffset = $target->getZ() - $middle->getZ();\n\t\t\t$nodesLeft = $nodeAmount - $startingNode;\n\t\t\t$offsetHorizontalScale = $horizontalScale + 18;\n\n\t\t\tif((($xOffset * $xOffset + $zOffset * $zOffset) - $nodesLeft * $nodesLeft) > ($offsetHorizontalScale * $offsetHorizontalScale)){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif($target->getX() < ($middle->getX() - 16 - $horizontalSize * 2)\n\t\t\t\tor $target->getZ() < ($middle->getZ() - 16 - $horizontalSize * 2)\n\t\t\t\tor $target->getX() > ($middle->getX() + 16 + $horizontalSize * 2)\n\t\t\t\tor $target->getZ() > ($middle->getZ() + 16 + $horizontalSize * 2)\n\t\t\t){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$start = new Vector3(floor($target->getX() - $horizontalSize) - $chunk->getX() - 1, floor($target->getY() - $verticalSize) - 1, floor($target->getZ() - $horizontalSize) - $chunk->getZ() - 1);\n\t\t\t$end = new Vector3(floor($target->getX() + $horizontalSize) - $chunk->getX() + 1, floor($target->getY() + $verticalSize) + 1, floor($target->getZ() + $horizontalSize) - $chunk->getZ() + 1);\n\t\t\t$node = new CaveNode($level, $chunk, $start, $end, $target, $verticalSize, $horizontalSize);\n\n\t\t\tif($node->canPlace()){\n\t\t\t\t$node->place();\n\t\t\t}\n\n\t\t\tif($lastNode){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function generateLargeCaveBranch(ChunkManager $level, Vector3 $chunk, Vector3 $target, Random $random){\n\t\t$this->generateCaveBranch($level, $chunk, $target, $random->nextFloat() * 6 + 1, 0.5, 0, 0, -1, -1, $random);\n\t}\n}\n\nclass CaveNode{\n\t/** @var ChunkManager */\n\tprivate $level;\n\t/** @var Vector3 */\n\tprivate $chunk;\n\t/** @var Vector3 */\n\tprivate $start;\n\t/** @var Vector3 */\n\tprivate $end;\n\t/** @var Vector3 */\n\tprivate $target;\n\tprivate $verticalSize;\n\tprivate $horizontalSize;\n\n\tpublic function __construct(ChunkManager $level, Vector3 $chunk, Vector3 $start, Vector3 $end, Vector3 $target, $verticalSize, $horizontalSize){\n\t\t$this->level = $level;\n\t\t$this->chunk = $chunk;\n\t\t$this->start = $this->clamp($start);\n\t\t$this->end = $this->clamp($end);\n\t\t$this->target = $target;\n\t\t$this->verticalSize = $verticalSize;\n\t\t$this->horizontalSize = $horizontalSize;\n\t}\n\n\tprivate function clamp(Vector3 $pos){\n\t\treturn new Vector3(\n\t\t\tMath::clamp($pos->getFloorX(), 0, 16),\n\t\t\tMath::clamp($pos->getFloorY(), 1, 120),\n\t\t\tMath::clamp($pos->getFloorZ(), 0, 16)\n\t\t);\n\t}\n\n\tpublic function canPlace(){\n\t\tfor($x = $this->start->getFloorX(); $x < $this->end->getFloorX(); $x++){\n\t\t\tfor($z = $this->start->getFloorZ(); $z < $this->end->getFloorZ(); $z++){\n\t\t\t\tfor($y = $this->end->getFloorY() + 1; $y >= $this->start->getFloorY() - 1; $y--){\n\t\t\t\t\t$blockId = $this->level->getBlockIdAt($this->chunk->getX() + $x, $y, $this->chunk->getZ() + $z);\n\t\t\t\t\tif($blockId == Block::WATER or $blockId == Block::STILL_WATER){\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t\tif($y != ($this->start->getFloorY() - 1) and $x != ($this->start->getFloorX()) and $x != ($this->end->getFloorX() - 1) and $z != ($this->start->getFloorZ()) and $z != ($this->end->getFloorZ() - 1)){\n\t\t\t\t\t\t$y = $this->start->getFloorY();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function place(){\n\t\tfor($x = $this->start->getFloorX(); $x < $this->end->getFloorX(); $x++){\n\t\t\t$xOffset = ($this->chunk->getX() + $x + 0.5 - $this->target->getX()) / $this->horizontalSize;\n\t\t\tfor($z = $this->start->getFloorZ(); $z < $this->end->getFloorZ(); $z++){\n\t\t\t\t$zOffset = ($this->chunk->getZ() + $z + 0.5 - $this->target->getZ()) / $this->horizontalSize;\n\t\t\t\tif(($xOffset * $xOffset + $zOffset * $zOffset) >= 1){\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t\tfor($y = $this->end->getFloorY() - 1; $y >= $this->start->getFloorY(); $y--){\n\t\t\t\t\t$yOffset = ($y + 0.5 - $this->target->getY()) / $this->verticalSize;\n\t\t\t\t\tif($yOffset > -0.7 and ($xOffset * $xOffset + $yOffset * $yOffset + $zOffset * $zOffset) < 1){\n\t\t\t\t\t\t$xx = $this->chunk->getX() + $x;\n\t\t\t\t\t\t$zz = $this->chunk->getZ() + $z;\n\t\t\t\t\t\t$blockId = $this->level->getBlockIdAt($xx, $y, $zz);\n\t\t\t\t\t\tif($blockId == Block::STONE or $blockId == Block::DIRT or $blockId == Block::GRASS){\n\t\t\t\t\t\t\tif($y < 10){\n\t\t\t\t\t\t\t\t$this->level->setBlockIdAt($xx, $y, $zz, Block::STILL_LAVA);\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\tif($blockId == Block::GRASS and $this->level->getBlockIdAt($xx, $y - 1, $zz) == Block::DIRT){\n\t\t\t\t\t\t\t\t\t$this->level->setBlockIdAt($xx, $y - 1, $zz, Block::GRASS);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$this->level->setBlockIdAt($xx, $y, $zz, Block::AIR);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/DeadBush.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass DeadBush extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\n\t\t\tif($y !== -1 and $this->canDeadBushStay($x, $y, $z)){\n\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::DEAD_BUSH);\n\t\t\t\t$this->level->setBlockDataAt($x, $y, $z, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canDeadBushStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn ($b === Block::AIR or $b === Block::SNOW_LAYER) and $this->level->getBlockIdAt($x, $y - 1, $z) === Block::SAND;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2 and $b !== Block::SNOW_LAYER){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Flower.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\block\\Flower as FlowerBlock;\n\nclass Flower extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\tprotected $baseAmount = 8;\n\n\tprivate $flowerTypes = [];\n\n\tpublic function addType($type){\n\t\t$this->flowerTypes[] = $type;\n\t}\n\n\tpublic function getTypes(){\n\t\treturn $this->flowerTypes;\n\t}\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\n\t\tif(count($this->flowerTypes) === 0){\n\t\t\t$this->addType([Block::DANDELION, 0]);\n\t\t\t$this->addType([Block::RED_FLOWER, FlowerBlock::TYPE_POPPY]);\n\t\t}\n\n\t\t$endNum = count($this->flowerTypes) - 1;\n\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\t\t\tif($y !== -1 and $this->canFlowerStay($x, $y, $z)){\n\t\t\t\t$type = mt_rand(0, $endNum);\n\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, $this->flowerTypes[$type][0]);\n\t\t\t\t$this->level->setBlockDataAt($x, $y, $z, $this->flowerTypes[$type][1]);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canFlowerStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn ($b === Block::AIR or $b === Block::SNOW_LAYER) and $this->level->getBlockIdAt($x, $y - 1, $z) === Block::GRASS;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2 and $b !== Block::SNOW_LAYER){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/GroundCover.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\biome\\Biome;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\level\\SimpleChunkManager;\nuse pocketmine\\utils\\Random;\n\nclass GroundCover extends Populator{\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$chunk = $level->getChunk($chunkX, $chunkZ);\n\t\tif($level instanceof Level or $level instanceof SimpleChunkManager){\n\t\t\t$waterHeight = $level->getWaterHeight();\n\t\t} else $waterHeight = 0;\n\t\tfor($x = 0; $x < 16; ++$x){\n\t\t\tfor($z = 0; $z < 16; ++$z){\n\t\t\t\t$biome = Biome::getBiome($chunk->getBiomeId($x, $z));\n\t\t\t\t$cover = $biome->getGroundCover();\n\t\t\t\tif(count($cover) > 0){\n\t\t\t\t\t$diffY = 0;\n\t\t\t\t\tif(!$cover[0]->isSolid()){\n\t\t\t\t\t\t$diffY = 1;\n\t\t\t\t\t}\n\n\t\t\t\t\t$column = $chunk->getBlockIdColumn($x, $z);\n\t\t\t\t\tfor($y = 127; $y > 0; --$y){\n\t\t\t\t\t\tif($column{$y} !== \"\\x00\" and !Block::get(ord($column{$y}))->isTransparent()){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$startY = min(127, $y + $diffY);\n\t\t\t\t\t$endY = $startY - count($cover);\n\t\t\t\t\tfor($y = $startY; $y > $endY and $y >= 0; --$y){\n\t\t\t\t\t\t$b = $cover[$startY - $y];\n\t\t\t\t\t\tif($column{$y} === \"\\x00\" and $b->isSolid()){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($y <= $waterHeight and $b->getId() == Block::GRASS and $chunk->getBlockId($x, $y + 1, $z) == Block::STILL_WATER){\n\t\t\t\t\t\t\t$b = Block::get(Block::DIRT);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif($b->getDamage() === 0){\n\t\t\t\t\t\t\t$chunk->setBlockId($x, $y, $z, $b->getId());\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$chunk->setBlock($x, $y, $z, $b->getId(), $b->getDamage());\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/LilyPad.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\n\nclass LilyPad extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\n\t\t\tif($y !== -1 and $this->canLilyPadStay($x, $y, $z)){\n\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::WATER_LILY);\n\t\t\t\t$this->level->setBlockDataAt($x, $y, $z, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canLilyPadStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn ($b === Block::AIR or $b === Block::SNOW_LAYER) and $this->level->getBlockIdAt($x, $y - 1, $z) === Block::STILL_WATER;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2 and $b !== Block::SNOW_LAYER){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Mineshaft.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\level\\generator\\populator\\Populator;\n\nclass Mineshaft extends Populator{\n\tprivate static $DISTANCE = 256;\n\tprivate static $VARIATION = 16;\n\tprivate static $ODD = 3;\n\tprivate static $BASE_Y = 35;\n\tprivate static $RAND_Y = 11;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\tif($random->nextRange(0, self::$ODD) === 0){\n\t\t\t//$mineshaft = new Mineshaft($random);\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/MossStone.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\n\nclass MossStone extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\n\t\t\tif($y !== -1 and $this->canMossStoneStay($x, $y, $z)){\n\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::MOSS_STONE);\n\t\t\t\t$this->level->setBlockDataAt($x, $y, $z, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canMossStoneStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn ($b === Block::AIR or $b === Block::SNOW_LAYER) and $this->level->getBlockIdAt($x, $y - 1, $z) === Block::PODZOL;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2 and $b !== Block::SNOW_LAYER){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Mushroom.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass Mushroom extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function __construct(){\n\t\tparent::__construct(1, 0, 64);\n\t}\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\tif(!$this->checkOdd($random)){\n\t\t\treturn;\n\t\t}\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $chunkX * 16;\n\t\t\t$z = $chunkZ * 16;\n\t\t\tfor($size = 6; $size > 0; $size--){\n\t\t\t\t$xx = $x - 7 + $random->nextRange(0, 15);\n\t\t\t\t$zz = $z - 7 + $random->nextRange(0, 15);\n\t\t\t\t$yy = $this->getHighestWorkableBlock($xx, $zz);\n\t\t\t\tif($yy !== -1 and $this->canMushroomStay($xx, $yy, $zz)){\n\t\t\t\t\t$this->level->setBlockIdAt($xx, $yy, $zz, (($random->nextRange(0, 4)) == 0 ? Block::RED_MUSHROOM_BLOCK : Block::BROWN_MUSHROOM_BLOCK));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canMushroomStay($x, $y, $z){\n\t\t$c = $this->level->getBlockIdAt($x, $y, $z);\n\t\t$b = $this->level->getBlockIdAt($x, $y - 1, $z);\n\t\treturn ($c === Block::AIR or $c === Block::SNOW_LAYER) and ($b === Block::MYCELIUM or (!Block::$transparent[$b]));\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2 and $b !== Block::SNOW_LAYER){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Ore.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\normal\\object\\Ore as ObjectOre;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\utils\\Random;\n\nclass Ore extends Populator{\n\tprivate $oreTypes = [];\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\tforeach($this->oreTypes as $type){\n\t\t\t$ore = new ObjectOre($random, $type);\n\t\t\tfor($i = 0; $i < $ore->type->clusterCount; ++$i){\n\t\t\t\t$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);\n\t\t\t\t$y = $random->nextRange($ore->type->minHeight, $ore->type->maxHeight);\n\t\t\t\t$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);\n\t\t\t\tif($ore->canPlaceObject($level, $x, $y, $z)){\n\t\t\t\t\t$ore->placeObject($level, $x, $y, $z);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function setOreTypes(array $types){\n\t\t$this->oreTypes = $types;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Pond.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Water;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\populator\\Populator;\nuse pocketmine\\utils\\Random;\n\nclass Pond extends Populator{\n\tprivate $waterOdd = 4;\n\tprivate $lavaOdd = 4;\n\tprivate $lavaSurfaceOdd = 4;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\tif($random->nextRange(0, $this->waterOdd) === 0){\n\t\t\t$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 16);\n\t\t\t$y = $random->nextBoundedInt(128);\n\t\t\t$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 16);\n\t\t\t$pond = new \\pocketmine\\level\\generator\\normal\\object\\Pond($random, new Water());\n\t\t\tif($pond->canPlaceObject($level, $x, $y, $z)){\n\t\t\t\t$pond->placeObject($level, $x, $y, $z);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function setWaterOdd($waterOdd){\n\t\t$this->waterOdd = $waterOdd;\n\t}\n\n\tpublic function setLavaOdd($lavaOdd){\n\t\t$this->lavaOdd = $lavaOdd;\n\t}\n\n\tpublic function setLavaSurfaceOdd($lavaSurfaceOdd){\n\t\t$this->lavaSurfaceOdd = $lavaSurfaceOdd;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/SugarCane.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\normal\\object\\SugarCaneStack;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass SugarCane extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\tprotected $randomAmount = 10;\n\tprotected $baseAmount = 1;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$canes = new SugarCaneStack($random);\n\t\t$successfulClusterCount = 0;\n\t\tfor($count = 0; $count < $this->randomAmount; $count++){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\t\t\tif($y == -1 or !$canes->canPlaceObject($level, $x, $y, $z)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$successfulClusterCount++;\n\t\t\t$canes->randomize();\n\t\t\t$canes->placeObject($level, $x, $y, $z);\n\t\t\tfor($placed = 1; $placed < 4; $placed++){\n\t\t\t\t$xx = $x - 3 + $random->nextBoundedInt(7);\n\t\t\t\t$zz = $z - 3 + $random->nextBoundedInt(7);\n\t\t\t\t$canes->randomize();\n\t\t\t\tif($canes->canPlaceObject($level, $xx, $y, $zz)){\n\t\t\t\t\t$canes->placeObject($level, $xx, $y, $zz);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($successfulClusterCount >= $this->baseAmount){\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/TallGrass.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass TallGrass extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\n\t\t\tif($y !== -1 and $this->canTallGrassStay($x, $y, $z)){\n\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::TALL_GRASS);\n\t\t\t\t$this->level->setBlockDataAt($x, $y, $z, 1);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canTallGrassStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn ($b === Block::AIR or $b === Block::SNOW_LAYER) and $this->level->getBlockIdAt($x, $y - 1, $z) === Block::GRASS;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2 and $b !== Block::SNOW_LAYER){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/Tree.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\Sapling;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\generator\\normal\\object\\Tree as ObjectTree;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\nuse pocketmine\\utils\\Random;\n\nclass Tree extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\n\tprivate $type;\n\n\tpublic function __construct($type = Sapling::OAK){\n\t\t$this->type = $type;\n\t}\n\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX << 4, ($chunkX << 4) + 15);\n\t\t\t$z = $random->nextRange($chunkZ << 4, ($chunkZ << 4) + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\t\t\tif($y === -1){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tObjectTree::growTree($this->level, $x, $y, $z, $random, $this->type);\n\t\t}\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 127; $y > 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b === Block::DIRT or $b === Block::GRASS or $b === Block::PODZOL){\n\t\t\t\tbreak;\n\t\t\t}elseif($b !== 0 and $b !== Block::SNOW_LAYER){\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t}\n\n\t\treturn ++$y;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/normal/populator/WaterPit.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\generator\\normal\\populator;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\nuse pocketmine\\level\\generator\\populator\\VariableAmountPopulator;\n//TODO: Remove\nclass WaterPit extends VariableAmountPopulator{\n\t/** @var ChunkManager */\n\tprivate $level;\n\n\tpublic function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random){\n\t\t$this->level = $level;\n\t\t$amount = $this->getAmount($random);\n\t\tfor($i = 0; $i < $amount; ++$i){\n\t\t\t$x = $random->nextRange($chunkX * 16, $chunkX * 16 + 15);\n\t\t\t$z = $random->nextRange($chunkZ * 16, $chunkZ * 16 + 15);\n\t\t\t$y = $this->getHighestWorkableBlock($x, $z);\n\n\t\t\tif($y !== -1 and $this->canWaterPitStay($x, $y, $z)){\n\t\t\t\t$this->level->setBlockIdAt($x, $y, $z, Block::STILL_WATER);\n\t\t\t\t$this->level->setBlockDataAt($x, $y, $z , 8);\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate function canWaterPitStay($x, $y, $z){\n\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\treturn ($b === Block::AIR or $b === Block::GRASS) and $this->level->getBlockIdAt($x, $y, $z) === Block::DIRT;\n\t}\n\n\tprivate function getHighestWorkableBlock($x, $z){\n\t\tfor($y = 61; $y >= 0; --$y){\n\t\t\t$b = $this->level->getBlockIdAt($x, $y, $z);\n\t\t\tif($b !== Block::AIR and $b !== Block::LEAVES and $b !== Block::LEAVES2 and $b !== Block::SNOW_LAYER){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $y === 0 ? -1 : ++$y;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/generator/object/Object.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * All the different object classes used in populators\n */\nnamespace pocketmine\\level\\generator\\object;\n\n\nabstract class Object{\n\n}"
  },
  {
    "path": "src/pocketmine/level/generator/populator/Populator.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * All the Object populator classes\n */\nnamespace pocketmine\\level\\generator\\populator;\n\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\utils\\Random;\n\nabstract class Populator{\n\tpublic abstract function populate(ChunkManager $level, $chunkX, $chunkZ, Random $random);\n}"
  },
  {
    "path": "src/pocketmine/level/generator/populator/VariableAmountPopulator.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\n\nnamespace pocketmine\\level\\generator\\populator;\n\nuse pocketmine\\utils\\Random;\n\nabstract class VariableAmountPopulator extends Populator{\n\tprotected $baseAmount;\n\tprotected $randomAmount;\n\tprotected $odd;\n\n\tpublic function __construct(int $baseAmount = 0, int $randomAmount = 0, int $odd = 0){\n\t\t$this->baseAmount = $baseAmount;\n\t\t$this->randomAmount = $randomAmount;\n\t\t$this->odd = $odd;\n\t}\n\n\tpublic function setOdd(int $odd){\n\t\t$this->odd = $odd;\n\t}\n\n\tpublic function checkOdd(Random $random) : bool{\n\t\tif($random->nextRange(0, $this->odd) == 0){\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function getAmount(Random $random){\n\t\treturn $this->baseAmount + $random->nextRange(0, $this->randomAmount + 1);\n\t}\n\n\tpublic final function setBaseAmount(int $baseAmount){\n\t\t$this->baseAmount = $baseAmount;\n\t}\n\n\tpublic final function setRandomAmount(int $randomAmount){\n\t\t$this->randomAmount = $randomAmount;\n\t}\n\n\tpublic function getBaseAmount() : int{\n\t\treturn $this->baseAmount;\n\t}\n\n\tpublic function getRandomAmount() : int{\n\t\treturn $this->randomAmount;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/particle/AngryVillagerParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass AngryVillagerParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_VILLAGER_ANGRY);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/BlockForceFieldParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass BlockForceFieldParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, int $data = 0){\n\t\tparent::__construct($pos, Particle::TYPE_BLOCK_FORCE_FIELD, $data); //TODO: proper encode/decode of data\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/BubbleParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass BubbleParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_BUBBLE);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/CriticalParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass CriticalParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $scale = 2){\n\t\tparent::__construct($pos, Particle::TYPE_CRITICAL, $scale);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/DestroyBlockParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * NOTE: This is also the destroy block SOUND.\n */\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\network\\protocol\\LevelEventPacket;\nuse pocketmine\\block\\Block;\nuse pocketmine\\math\\Vector3;\n\nclass DestroyBlockParticle extends Particle{\n\t\n\tprotected $data;\n\n\tpublic function __construct(Vector3 $pos, Block $b){\n\t\tparent::__construct($pos->x, $pos->y, $pos->z);\n\t\t$this->data = $b->getId() + ($b->getDamage() << 12);\n\t}\n\t\n\tpublic function encode(){\n\t\t$pk = new LevelEventPacket;\n\t\t$pk->evid = LevelEventPacket::EVENT_PARTICLE_DESTROY;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->data = $this->data;\n\t\t\n\t\treturn $pk;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/DustParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass DustParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $r, $g, $b, $a = 255){\n\t\tparent::__construct($pos, Particle::TYPE_DUST, (($a & 0xff) << 24) | (($r & 0xff) << 16) | (($g & 0xff) << 8) | ($b & 0xff));\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/EnchantParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass EnchantParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_MOB_SPELL);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/EnchantmentTableParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass EnchantmentTableParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_ENCHANTMENT_TABLE);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/EntityFlameParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass EntityFlameParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_MOB_FLAME);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/ExplodeParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass ExplodeParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_EXPLODE);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/FlameParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass FlameParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_FLAME);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/FloatingTextParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\entity\\Item as ItemEntity;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\network\\protocol\\RemoveEntityPacket;\n\n\nclass FloatingTextParticle extends Particle{\n\t//TODO: HACK!\n\n\tprotected $text;\n\tprotected $title;\n\tprotected $entityId;\n\tprotected $invisible = false;\n\n\t/**\n\t * @param Vector3 $pos\n\t * @param int $text\n\t * @param string $title\n\t */\n\tpublic function __construct(Vector3 $pos, $text, $title = \"\"){\n\t\tparent::__construct($pos->x, $pos->y, $pos->z);\n\t\t$this->text = $text;\n\t\t$this->title = $title;\n\t}\n\n\tpublic function getText(){\n\t\treturn $this->text;\n\t}\n\n\tpublic function getTitle(){\n\t\treturn $this->title;\n\t}\n\n\tpublic function setText($text){\n\t\t$this->text = $text;\n\t}\n\n\tpublic function setTitle($title){\n\t\t$this->title = $title;\n\t}\n\t\n\tpublic function isInvisible(){\n\t\treturn $this->invisible;\n\t}\n\t\n\tpublic function setInvisible($value = true){\n\t\t$this->invisible = (bool) $value;\n\t}\n\n\tpublic function encode(){\n\t\t$p = [];\n\n\t\tif($this->entityId === null){\n\t\t\t$this->entityId = bcadd(\"1095216660480\", mt_rand(0, 0x7fffffff)); //No conflict with other things\n\t\t}else{\n\t\t\t$pk0 = new RemoveEntityPacket();\n\t\t\t$pk0->eid = $this->entityId;\n\n\t\t\t$p[] = $pk0;\n\t\t}\n\n\t\tif(!$this->invisible){\n\t\t\t$pk = new AddEntityPacket();\n\t\t\t$pk->eid = $this->entityId;\n\t\t\t$pk->type = ItemEntity::NETWORK_ID;\n\t\t\t$pk->x = $this->x;\n\t\t\t$pk->y = $this->y - 0.75;\n\t\t\t$pk->z = $this->z;\n\t\t\t$pk->speedX = 0;\n\t\t\t$pk->speedY = 0;\n\t\t\t$pk->speedZ = 0;\n\t\t\t$pk->yaw = 0;\n\t\t\t$pk->pitch = 0;\n\t\t\t$pk->item = 0;\n\t\t\t$pk->meta = 0;\n\t\t\t$flags = 0;\n\t\t\t$flags |= 1 << Entity::DATA_FLAG_INVISIBLE;\n\t\t\t$flags |= 1 << Entity::DATA_FLAG_CAN_SHOW_NAMETAG;\n\t\t\t$flags |= 1 << Entity::DATA_FLAG_ALWAYS_SHOW_NAMETAG;\n\t\t\t$flags |= 1 << Entity::DATA_FLAG_IMMOBILE;\n\t\t\t$pk->metadata = [\n\t\t\t\tEntity::DATA_FLAGS => [Entity::DATA_TYPE_LONG, $flags],\n\t\t\t\tEntity::DATA_NAMETAG => [Entity::DATA_TYPE_STRING, $this->title . ($this->text !== \"\" ? \"\\n\" . $this->text : \"\")],\n            ];\n\n\t\t\t$p[] = $pk;\n\t\t}\n\n\t\treturn $p;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/GenericParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\network\\protocol\\LevelEventPacket;\nuse pocketmine\\math\\Vector3;\n\nclass GenericParticle extends Particle{\n\t\n\tprotected $id;\n\tprotected $data;\n\n\tpublic function __construct(Vector3 $pos, $id, $data = 0){\n\t\tparent::__construct($pos->x, $pos->y, $pos->z);\n\t\t$this->id = $id & 0xFFF;\n\t\t$this->data = $data;\n\t}\n\t\n\tpublic function encode(){\n\t\t$pk = new LevelEventPacket;\n\t\t$pk->evid = LevelEventPacket::EVENT_ADD_PARTICLE_MASK | $this->id;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->data = $this->data;\n\t\t\n\t\treturn $pk;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/HappyVillagerParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass HappyVillagerParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_VILLAGER_HAPPY);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/HeartParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass HeartParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $scale = 0){\n\t\tparent::__construct($pos, Particle::TYPE_HEART, $scale);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/HugeExplodeParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass HugeExplodeParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_HUGE_EXPLODE);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/HugeExplodeSeedParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass HugeExplodeSeedParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_HUGE_EXPLODE_SEED);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/particle/InkParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass InkParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $scale = 0){\n\t\tparent::__construct($pos, Particle::TYPE_INK, $scale);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/InstantEnchantParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass InstantEnchantParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_MOB_SPELL_INSTANTANEOUS);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/ItemBreakParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\item\\Item;\n\nclass ItemBreakParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, Item $item){\n\t\tparent::__construct($pos, Particle::TYPE_ITEM_BREAK, ($item->getId() << 16) | $item->getDamage());\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/LavaDripParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass LavaDripParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_DRIP_LAVA);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/LavaParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass LavaParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_LAVA);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/MobSpawnParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\network\\protocol\\LevelEventPacket;\nuse pocketmine\\math\\Vector3;\n\nclass MobSpawnParticle extends Particle{\n\t\n\tprotected $width;\n\tprotected $height;\n\t\n\tpublic function __construct(Vector3 $pos, $width = 0, $height = 0){\n\t\tparent::__construct($pos->x, $pos->y, $pos->z);\n\t\t$this->width = $width;\n\t\t$this->height = $height;\n\t}\n\t\n\tpublic function encode(){\n\t\t$pk = new LevelEventPacket;\n\t\t$pk->evid = LevelEventPacket::EVENT_PARTICLE_SPAWN;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->data = ($this->width & 0xff) + (($this->height & 0xff) << 8);\n\t\t\n\t\treturn $pk;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/MobSpellParticle.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass MobSpellParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $r = 0, $g = 0, $b = 0, $a = 255){\n\t\tparent::__construct($pos, Particle::TYPE_MOB_SPELL, (($a & 0xff) << 24) | (($r & 0xff) << 16) | (($g & 0xff) << 8) | ($b & 0xff));\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/particle/Particle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\DataPacket;\n\nabstract class Particle extends Vector3{\n\n\tconst TYPE_BUBBLE = 1;\n\tconst TYPE_CRITICAL = 2;\n\tconst TYPE_BLOCK_FORCE_FIELD = 3;\n\tconst TYPE_SMOKE = 4;\n\tconst TYPE_EXPLODE = 5; //actually steam\n\tconst TYPE_WHITE_SMOKE = 6; //also steam, maybe bigger?\n\tconst TYPE_FLAME = 7;\n\tconst TYPE_LAVA = 8;\n\tconst TYPE_LARGE_SMOKE = 9;\n\tconst TYPE_REDSTONE = 10;\n\tconst TYPE_RISING_RED_DUST = 11;\n\tconst TYPE_ITEM_BREAK = 12;\n\tconst TYPE_SNOWBALL_POOF = 13;\n\tconst TYPE_HUGE_EXPLODE = 14;\n\tconst TYPE_HUGE_EXPLODE_SEED = 15;\n\tconst TYPE_MOB_FLAME = 16;\n\tconst TYPE_HEART = 17;\n\tconst TYPE_TERRAIN = 18;\n\tconst TYPE_SUSPENDED_TOWN = 19, TYPE_TOWN_AURA = 19;\n\tconst TYPE_PORTAL = 20;\n\tconst TYPE_SPLASH = 21, TYPE_WATER_SPLASH = 21;\n\tconst TYPE_WATER_WAKE = 22;\n\tconst TYPE_DRIP_WATER = 23;\n\tconst TYPE_DRIP_LAVA = 24;\n\tconst TYPE_FALLING_DUST = 25, TYPE_DUST = 25;\n\tconst TYPE_MOB_SPELL = 26;\n\tconst TYPE_MOB_SPELL_AMBIENT = 27;\n\tconst TYPE_MOB_SPELL_INSTANTANEOUS = 28;\n\tconst TYPE_INK = 29;\n\tconst TYPE_SLIME = 30;\n\tconst TYPE_RAIN_SPLASH = 31;\n\tconst TYPE_VILLAGER_ANGRY = 32;\n\tconst TYPE_VILLAGER_HAPPY = 33;\n\tconst TYPE_ENCHANTMENT_TABLE = 34;\n\tconst TYPE_TRACKING_EMITTER = 35;\n\tconst TYPE_NOTE = 36;\n\t//37 yet another SpellParticle of some description\n\tconst TYPE_CARROT = 38;\n\t//39 unknown\n\tconst TYPE_END_ROD = 40;\n\tconst TYPE_DRAGONS_BREATH = 41;\n\n\t/**\n\t * @return DataPacket|DataPacket[]\n\t */\n\tabstract public function encode();\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/PortalParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass PortalParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_PORTAL);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/RainSplashParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass RainSplashParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_RAIN_SPLASH);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/RedstoneParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass RedstoneParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $lifetime = 1){\n\t\tparent::__construct($pos, Particle::TYPE_REDSTONE, $lifetime);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/SmokeParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass SmokeParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $scale = 0){\n\t\tparent::__construct($pos, Particle::TYPE_SMOKE, (int) $scale);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/SpellParticle.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass SpellParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $r = 0, $g = 0, $b = 0, $a = 255){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_PARTICLE_SPLASH, (($a & 0xff) << 24) | (($r & 0xff) << 16) | (($g & 0xff) << 8) | ($b & 0xff));\n\t}\n\n\tpublic function encode(){\n\t\t$pk = new LevelEventPacket();\n\t\t$pk->evid = LevelEventPacket::EVENT_PARTICLE_SPLASH;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->data = $this->data;\n\t\treturn $pk;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/particle/SplashParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass SplashParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_WATER_SPLASH);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/SporeParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass SporeParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_TOWN_AURA);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/TerrainParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\math\\Vector3;\n\nclass TerrainParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, Block $b){\n\t\tparent::__construct($pos, Particle::TYPE_TERRAIN, ($b->getDamage() << 8) | $b->getId());\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/WaterDripParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass WaterDripParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_DRIP_WATER);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/WaterParticle.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass WaterParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, Particle::TYPE_WATER_WAKE);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/particle/WhiteSmokeParticle.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\particle;\n\nuse pocketmine\\math\\Vector3;\n\nclass WhiteSmokeParticle extends GenericParticle{\n\tpublic function __construct(Vector3 $pos, $scale = 0){\n\t\tparent::__construct($pos, Particle::TYPE_WHITE_SMOKE, (int) $scale);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/AnvilFallSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass AnvilFallSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_ANVIL_FALL, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/AnvilUseSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass AnvilUseSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_ANVIL_USE, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/BatSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass BatSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_BAT_FLY, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/BlazeShootSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass BlazeShootSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_BLAZE_SHOOT, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/BlockPlaceSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n \nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n \nclass BlockPlaceSound extends GenericSound{\n\t\n\tprotected $data;\n\t\n\tpublic function __construct(Block $b){\n\t\tparent::__construct($b, LevelEventPacket::EVENT_SOUND_BLOCK_PLACE);\n\t\t$this->data = $b->getId();\n\t}\n\t\n\tpublic function encode(){\n\t\t$pk = new LevelEventPacket;\n\t\t$pk->evid = $this->id;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->data = $this->data;\n\t\t\n\t\treturn $pk;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/ButtonClickSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass ButtonClickSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_BUTTON_CLICK);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/ClickSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass ClickSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_CLICK, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/DoorBumpSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass DoorBumpSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_DOOR_BUMP, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/DoorCrashSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass DoorCrashSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_DOOR_CRASH, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/DoorSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass DoorSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_DOOR, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/EndermanTeleportSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass EndermanTeleportSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_ENDERMAN_TELEPORT);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/ExpPickupSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass ExpPickupSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_EXP_PICKUP, $pitch);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/ExplodeSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass ExplodeSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_EXPLODE, $pitch);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/FizzSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass FizzSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_FIZZ, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/GenericSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass GenericSound extends Sound{\n\t\n\tpublic function __construct(Vector3 $pos, $id, $pitch = 0){\n\t\tparent::__construct($pos->x, $pos->y, $pos->z);\n\t\t$this->id = (int) $id;\n\t\t$this->pitch = (float) $pitch * 1000;\n\t}\n\t\n\tprotected $pitch = 0;\n\tprotected $id;\n\t\n\tpublic function getPitch(){\n\t\treturn $this->pitch / 1000;\n\t}\n\t\n\tpublic function setPitch($pitch){\n\t\t$this->pitch = (float) $pitch * 1000;\n\t}\n\t\n\t\n\tpublic function encode(){\n\t\t$pk = new LevelEventPacket;\n\t\t$pk->evid = $this->id;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->data = (int) $this->pitch;\n\t\t\n\t\treturn $pk;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/GhastShootSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass GhastShootSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_GHAST_SHOOT, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/GhastSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass GhastSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_GHAST, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/GraySplashSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass GraySplashSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_GRAY_SPLASH, $pitch);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/LaunchSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass LaunchSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_SHOOT, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/NoteblockSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\BlockEventPacket;\n\nclass NoteblockSound extends GenericSound{\n\tprotected $instrument;\n\tprotected $pitch;\n\n\tconst INSTRUMENT_PIANO = 0;\n\tconst INSTRUMENT_BASS_DRUM = 1;\n\tconst INSTRUMENT_CLICK = 2;\n\tconst INSTRUMENT_TABOUR = 3;\n\tconst INSTRUMENT_BASS = 4;\n\n\tpublic function __construct(Vector3 $pos, $instrument = self::INSTRUMENT_PIANO, $pitch = 0){\n\t\tparent::__construct($pos, $instrument, $pitch);\n\t\t$this->instrument = $instrument;\n\t\t$this->pitch = $pitch;\n\t}\n\n\tpublic function encode(){\n\t\t$pk = new BlockEventPacket();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->case1 = $this->instrument;\n\t\t$pk->case2 = $this->pitch;\n\n\t\treturn $pk;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/PopSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass PopSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_CLICK_FAIL, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/Sound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\DataPacket;\n\nabstract class Sound extends Vector3{\n\t\n\t/**\n\t * @return DataPacket|DataPacket[]\n\t */\n\tabstract public function encode();\n\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/SpellSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass SpellSound extends Sound{\n\n\tprivate $id;\n\tprivate $color;\n\n\tpublic function __construct(Vector3 $pos, $r = 0, $g = 0, $b = 0){\n\t\tparent::__construct($pos->x, $pos->y, $pos->z);\n\t\t$this->id = (int) LevelEventPacket::EVENT_SOUND_SPELL;\n\t\t$this->color = ($r << 16 | $g << 8 | $b) & 0xffffff;\n\t}\n\n\tpublic function encode(){\n\t\t$pk = new LevelEventPacket;\n\t\t$pk->evid = $this->id;\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->data = $this->color;\n\n\t\treturn $pk;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/SplashSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass SplashSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_SPLASH, $pitch);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/level/sound/TNTPrimeSound.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass TNTPrimeSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_TNT, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/ZombieHealSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass ZombieHealSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_ZOMBIE_HEAL, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/sound/ZombieInfectSound.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\level\\sound;\n\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\n\nclass ZombieInfectSound extends GenericSound{\n\tpublic function __construct(Vector3 $pos, $pitch = 0){\n\t\tparent::__construct($pos, LevelEventPacket::EVENT_SOUND_ZOMBIE_INFECT, $pitch);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/level/weather/Weather.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\level\\weather;\n\nuse pocketmine\\event\\level\\WeatherChangeEvent;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\nuse pocketmine\\Player;\n\nclass Weather{\n\tconst CLEAR = 0;\n\tconst SUNNY = 0;\n\tconst RAIN = 1;\n\tconst RAINY = 1;\n\tconst RAINY_THUNDER = 2;\n\tconst THUNDER = 3;\n\n\tprivate $level;\n\tprivate $weatherNow = 0;\n\tprivate $strength1;\n\tprivate $strength2;\n\tprivate $duration;\n\tprivate $canCalculate = true;\n\n\t/** @var Vector3 */\n\tprivate $temporalVector = null;\n\n\tprivate $lastUpdate = 0;\n\n\tprivate $randomWeatherData = [0, 1, 0, 1, 0, 1, 0, 2, 0, 3];\n\n\tpublic function __construct(Level $level, $duration = 1200){\n\t\t$this->level = $level;\n\t\t$this->weatherNow = self::SUNNY;\n\t\t$this->duration = $duration;\n\t\t$this->lastUpdate = $level->getServer()->getTick();\n\t\t$this->temporalVector = new Vector3(0, 0, 0);\n\t}\n\n\tpublic function canCalculate() : bool{\n\t\treturn $this->canCalculate;\n\t}\n\n\tpublic function setCanCalculate(bool $canCalc){\n\t\t$this->canCalculate = $canCalc;\n\t}\n\n\tpublic function calcWeather($currentTick){\n\t\tif($this->canCalculate()){\n\t\t\t$tickDiff = $currentTick - $this->lastUpdate;\n\t\t\t$this->duration -= $tickDiff;\n\t\t\t\n\t\t\tif($this->duration <= 0){\n\t\t\t\t$duration = mt_rand(\n\t\t\t\t\t\tmin($this->level->getServer()->weatherRandomDurationMin, $this->level->getServer()->weatherRandomDurationMax), \n\t\t\t\t\t\tmax($this->level->getServer()->weatherRandomDurationMin, $this->level->getServer()->weatherRandomDurationMax));\n\n\t\t\t\tif($this->weatherNow === self::SUNNY){ \n\t\t\t\t\t$weather = $this->randomWeatherData[array_rand($this->randomWeatherData)];\n\t\t\t\t\t$this->setWeather($weather, $duration);\n\t\t\t\t}else{\n\t\t\t\t\t$weather = self::SUNNY;\n\t\t\t\t\t$this->setWeather($weather, $duration);\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(($this->weatherNow >= self::RAINY_THUNDER) and ($this->level->getServer()->lightningTime > 0) and is_int($this->duration / $this->level->getServer()->lightningTime)){\n\t\t\t\t$players = $this->level->getPlayers();\n\t\t\t\tif(count($players) > 0){\n\t\t\t\t\t$p = $players[array_rand($players)];\n\t\t\t\t\t$x = $p->x + mt_rand(-64, 64);\n\t\t\t\t\t$z = $p->z + mt_rand(-64, 64);\n\t\t\t\t\t$y = $this->level->getHighestBlockAt($x, $z);\n\t\t\t\t\t$this->level->spawnLightning($this->temporalVector->setComponents($x, $y, $z));\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->lastUpdate = $currentTick;\n\t}\n\n\tpublic function setWeather(int $wea, int $duration = 12000){\n\t\t$this->level->getServer()->getPluginManager()->callEvent($ev = new WeatherChangeEvent($this->level, $wea, $duration));\n\t\tif(!$ev->isCancelled()){\n\t\t\t$this->weatherNow = $ev->getWeather();\n\t\t\t$this->strength1 = mt_rand(90000, 110000); //If we're clearing the weather, it doesn't matter what strength values we set\n\t\t\t$this->strength2 = mt_rand(30000, 40000);\n\t\t\t$this->duration = $ev->getDuration();\n\t\t\t$this->sendWeatherToAll();\n\t\t}\n\t}\n\n\tpublic function getRandomWeatherData() : array{\n\t\treturn $this->randomWeatherData;\n\t}\n\n\tpublic function setRandomWeatherData(array $randomWeatherData){\n\t\t$this->randomWeatherData = $randomWeatherData;\n\t}\n\n\tpublic function getWeather() : int{\n\t\treturn $this->weatherNow;\n\t}\n\n\tpublic static function getWeatherFromString($weather){\n\t\tif(is_int($weather)){\n\t\t\tif($weather <= 3){\n\t\t\t\treturn $weather;\n\t\t\t}\n\t\t\treturn self::SUNNY;\n\t\t}\n\t\tswitch(strtolower($weather)){\n\t\t\tcase \"clear\":\n\t\t\tcase \"sunny\":\n\t\t\tcase \"fine\":\n\t\t\t\treturn self::SUNNY;\n\t\t\tcase \"rain\":\n\t\t\tcase \"rainy\":\n\t\t\t\treturn self::RAINY;\n\t\t\tcase \"thunder\":\n\t\t\t\treturn self::THUNDER;\n\t\t\tcase \"rain_thunder\":\n\t\t\tcase \"rainy_thunder\":\n\t\t\tcase \"storm\":\n\t\t\t\treturn self::RAINY_THUNDER;\n\t\t\tdefault:\n\t\t\t\treturn self::SUNNY;\n\t\t}\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isSunny() : bool{\n\t\treturn $this->getWeather() === self::SUNNY;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isRainy() : bool{\n\t\treturn $this->getWeather() === self::RAINY;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isRainyThunder() : bool{\n\t\treturn $this->getWeather() === self::RAINY_THUNDER;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isThunder() : bool{\n\t\treturn $this->getWeather() === self::THUNDER;\n\t}\n\n\tpublic function getStrength() : array{\n\t\treturn [$this->strength1, $this->strength2];\n\t}\n\n\tpublic function sendWeather(Player $p){\n\t\t$pks = [\n\t\t\tnew LevelEventPacket(),\n\t\t\tnew LevelEventPacket()\n\t\t];\n\t\t\n\t\t//Set defaults. These will be sent if the case statement defaults.\n\t\t$pks[0]->evid = LevelEventPacket::EVENT_STOP_RAIN;\n\t\t$pks[0]->data = $this->strength1;\t\n\t\t$pks[1]->evid = LevelEventPacket::EVENT_STOP_THUNDER;\n\t\t$pks[1]->data = $this->strength2;\n\t\t\n\t\tswitch($this->weatherNow){\n\t\t\t//If the weather is not clear, overwrite the packet values with these\n\t\t\tcase self::RAIN:\n\t\t\t\t$pks[0]->evid = LevelEventPacket::EVENT_START_RAIN;\n\t\t\t\t$pks[0]->data = $this->strength1;\n\t\t\t\tbreak;\n\t\t\tcase self::RAINY_THUNDER:\n\t\t\t\t$pks[0]->evid = LevelEventPacket::EVENT_START_RAIN;\n\t\t\t\t$pks[0]->data = $this->strength1;\n\t\t\t\t$pks[1]->evid = LevelEventPacket::EVENT_START_THUNDER;\n\t\t\t\t$pks[1]->data = $this->strength2;\n\t\t\t\tbreak;\n\t\t\tcase self::THUNDER:\n\t\t\t\t$pks[1]->evid = LevelEventPacket::EVENT_START_THUNDER;\n\t\t\t\t$pks[1]->data = $this->strength2;\n\t\t\t\tbreak;\n\t\t\tdefault: break;\n\t\t}\n\t\t\n\t\tforeach($pks as $pk){\n\t\t\t$p->dataPacket($pk);\n\t\t}\n\t\t$p->weatherData = [$this->weatherNow, $this->strength1, $this->strength2];\n\t}\n\n\tpublic function sendWeatherToAll(){\n\t\tforeach($this->level->getPlayers() as $player){\n\t\t\t$this->sendWeather($player);\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/math/AxisAlignedBB.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\math;\n\nuse pocketmine\\level\\MovingObjectPosition;\n\nclass AxisAlignedBB{\n\n\tpublic $minX;\n\tpublic $minY;\n\tpublic $minZ;\n\tpublic $maxX;\n\tpublic $maxY;\n\tpublic $maxZ;\n\n\tpublic function __construct($minX, $minY, $minZ, $maxX, $maxY, $maxZ){\n\t\t$this->minX = $minX;\n\t\t$this->minY = $minY;\n\t\t$this->minZ = $minZ;\n\t\t$this->maxX = $maxX;\n\t\t$this->maxY = $maxY;\n\t\t$this->maxZ = $maxZ;\n\t}\n\n\tpublic function setBounds($minX, $minY, $minZ, $maxX, $maxY, $maxZ){\n\t\t$this->minX = $minX;\n\t\t$this->minY = $minY;\n\t\t$this->minZ = $minZ;\n\t\t$this->maxX = $maxX;\n\t\t$this->maxY = $maxY;\n\t\t$this->maxZ = $maxZ;\n\n\t\treturn $this;\n\t}\n\n\tpublic function addCoord($x, $y, $z){\n\t\t$minX = $this->minX;\n\t\t$minY = $this->minY;\n\t\t$minZ = $this->minZ;\n\t\t$maxX = $this->maxX;\n\t\t$maxY = $this->maxY;\n\t\t$maxZ = $this->maxZ;\n\n\t\tif($x < 0){\n\t\t\t$minX += $x;\n\t\t}elseif($x > 0){\n\t\t\t$maxX += $x;\n\t\t}\n\n\t\tif($y < 0){\n\t\t\t$minY += $y;\n\t\t}elseif($y > 0){\n\t\t\t$maxY += $y;\n\t\t}\n\n\t\tif($z < 0){\n\t\t\t$minZ += $z;\n\t\t}elseif($z > 0){\n\t\t\t$maxZ += $z;\n\t\t}\n\n\t\treturn new AxisAlignedBB($minX, $minY, $minZ, $maxX, $maxY, $maxZ);\n\t}\n\n\tpublic function grow($x, $y, $z){\n\t\treturn new AxisAlignedBB($this->minX - $x, $this->minY - $y, $this->minZ - $z, $this->maxX + $x, $this->maxY + $y, $this->maxZ + $z);\n\t}\n\n\tpublic function expand($x, $y, $z){\n\t\t$this->minX -= $x;\n\t\t$this->minY -= $y;\n\t\t$this->minZ -= $z;\n\t\t$this->maxX += $x;\n\t\t$this->maxY += $y;\n\t\t$this->maxZ += $z;\n\n\t\treturn $this;\n\t}\n\n\tpublic function offset($x, $y, $z){\n\t\t$this->minX += $x;\n\t\t$this->minY += $y;\n\t\t$this->minZ += $z;\n\t\t$this->maxX += $x;\n\t\t$this->maxY += $y;\n\t\t$this->maxZ += $z;\n\n\t\treturn $this;\n\t}\n\n\tpublic function shrink($x, $y, $z){\n\t\treturn new AxisAlignedBB($this->minX + $x, $this->minY + $y, $this->minZ + $z, $this->maxX - $x, $this->maxY - $y, $this->maxZ - $z);\n\t}\n\n\tpublic function contract($x, $y, $z){\n\t\t$this->minX += $x;\n\t\t$this->minY += $y;\n\t\t$this->minZ += $z;\n\t\t$this->maxX -= $x;\n\t\t$this->maxY -= $y;\n\t\t$this->maxZ -= $z;\n\n\t\treturn $this;\n\t}\n\n\tpublic function setBB(AxisAlignedBB $bb){\n\t\t$this->minX = $bb->minX;\n\t\t$this->minY = $bb->minY;\n\t\t$this->minZ = $bb->minZ;\n\t\t$this->maxX = $bb->maxX;\n\t\t$this->maxY = $bb->maxY;\n\t\t$this->maxZ = $bb->maxZ;\n\t\treturn $this;\n\t}\n\n\tpublic function getOffsetBoundingBox($x, $y, $z){\n\t\treturn new AxisAlignedBB($this->minX + $x, $this->minY + $y, $this->minZ + $z, $this->maxX + $x, $this->maxY + $y, $this->maxZ + $z);\n\t}\n\n\tpublic function calculateXOffset(AxisAlignedBB $bb, $x){\n\t\tif($bb->maxY <= $this->minY or $bb->minY >= $this->maxY){\n\t\t\treturn $x;\n\t\t}\n\t\tif($bb->maxZ <= $this->minZ or $bb->minZ >= $this->maxZ){\n\t\t\treturn $x;\n\t\t}\n\t\tif($x > 0 and $bb->maxX <= $this->minX){\n\t\t\t$x1 = $this->minX - $bb->maxX;\n\t\t\tif($x1 < $x){\n\t\t\t\t$x = $x1;\n\t\t\t}\n\t\t}\n\t\tif($x < 0 and $bb->minX >= $this->maxX){\n\t\t\t$x2 = $this->maxX - $bb->minX;\n\t\t\tif($x2 > $x){\n\t\t\t\t$x = $x2;\n\t\t\t}\n\t\t}\n\n\t\treturn $x;\n\t}\n\n\tpublic function calculateYOffset(AxisAlignedBB $bb, $y){\n\t\tif($bb->maxX <= $this->minX or $bb->minX >= $this->maxX){\n\t\t\treturn $y;\n\t\t}\n\t\tif($bb->maxZ <= $this->minZ or $bb->minZ >= $this->maxZ){\n\t\t\treturn $y;\n\t\t}\n\t\tif($y > 0 and $bb->maxY <= $this->minY){\n\t\t\t$y1 = $this->minY - $bb->maxY;\n\t\t\tif($y1 < $y){\n\t\t\t\t$y = $y1;\n\t\t\t}\n\t\t}\n\t\tif($y < 0 and $bb->minY >= $this->maxY){\n\t\t\t$y2 = $this->maxY - $bb->minY;\n\t\t\tif($y2 > $y){\n\t\t\t\t$y = $y2;\n\t\t\t}\n\t\t}\n\n\t\treturn $y;\n\t}\n\n\tpublic function calculateZOffset(AxisAlignedBB $bb, $z){\n\t\tif($bb->maxX <= $this->minX or $bb->minX >= $this->maxX){\n\t\t\treturn $z;\n\t\t}\n\t\tif($bb->maxY <= $this->minY or $bb->minY >= $this->maxY){\n\t\t\treturn $z;\n\t\t}\n\t\tif($z > 0 and $bb->maxZ <= $this->minZ){\n\t\t\t$z1 = $this->minZ - $bb->maxZ;\n\t\t\tif($z1 < $z){\n\t\t\t\t$z = $z1;\n\t\t\t}\n\t\t}\n\t\tif($z < 0 and $bb->minZ >= $this->maxZ){\n\t\t\t$z2 = $this->maxZ - $bb->minZ;\n\t\t\tif($z2 > $z){\n\t\t\t\t$z = $z2;\n\t\t\t}\n\t\t}\n\n\t\treturn $z;\n\t}\n\n\tpublic function intersectsWith(AxisAlignedBB $bb){\n\t\tif($bb->maxX > $this->minX and $bb->minX < $this->maxX){\n\t\t\tif($bb->maxY > $this->minY and $bb->minY < $this->maxY){\n\t\t\t\treturn $bb->maxZ > $this->minZ and $bb->minZ < $this->maxZ;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function isVectorInside(Vector3 $vector){\n\t\tif($vector->x <= $this->minX or $vector->x >= $this->maxX){\n\t\t\treturn false;\n\t\t}\n\t\tif($vector->y <= $this->minY or $vector->y >= $this->maxY){\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $vector->z > $this->minZ and $vector->z < $this->maxZ;\n\t}\n\n\tpublic function getAverageEdgeLength(){\n\t\treturn ($this->maxX - $this->minX + $this->maxY - $this->minY + $this->maxZ - $this->minZ) / 3;\n\t}\n\n\tpublic function isVectorInYZ(Vector3 $vector){\n\t\treturn $vector->y >= $this->minY and $vector->y <= $this->maxY and $vector->z >= $this->minZ and $vector->z <= $this->maxZ;\n\t}\n\n\tpublic function isVectorInXZ(Vector3 $vector){\n\t\treturn $vector->x >= $this->minX and $vector->x <= $this->maxX and $vector->z >= $this->minZ and $vector->z <= $this->maxZ;\n\t}\n\n\tpublic function isVectorInXY(Vector3 $vector){\n\t\treturn $vector->x >= $this->minX and $vector->x <= $this->maxX and $vector->y >= $this->minY and $vector->y <= $this->maxY;\n\t}\n\n\tpublic function calculateIntercept(Vector3 $pos1, Vector3 $pos2){\n\t\t$v1 = $pos1->getIntermediateWithXValue($pos2, $this->minX);\n\t\t$v2 = $pos1->getIntermediateWithXValue($pos2, $this->maxX);\n\t\t$v3 = $pos1->getIntermediateWithYValue($pos2, $this->minY);\n\t\t$v4 = $pos1->getIntermediateWithYValue($pos2, $this->maxY);\n\t\t$v5 = $pos1->getIntermediateWithZValue($pos2, $this->minZ);\n\t\t$v6 = $pos1->getIntermediateWithZValue($pos2, $this->maxZ);\n\n\t\tif($v1 !== null and !$this->isVectorInYZ($v1)){\n\t\t\t$v1 = null;\n\t\t}\n\n\t\tif($v2 !== null and !$this->isVectorInYZ($v2)){\n\t\t\t$v2 = null;\n\t\t}\n\n\t\tif($v3 !== null and !$this->isVectorInXZ($v3)){\n\t\t\t$v3 = null;\n\t\t}\n\n\t\tif($v4 !== null and !$this->isVectorInXZ($v4)){\n\t\t\t$v4 = null;\n\t\t}\n\n\t\tif($v5 !== null and !$this->isVectorInXY($v5)){\n\t\t\t$v5 = null;\n\t\t}\n\n\t\tif($v6 !== null and !$this->isVectorInXY($v6)){\n\t\t\t$v6 = null;\n\t\t}\n\n\t\t$vector = null;\n\n\n\t\tif($v1 !== null and ($vector === null or $pos1->distanceSquared($v1) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v1;\n\t\t}\n\n\t\tif($v2 !== null and ($vector === null or $pos1->distanceSquared($v2) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v2;\n\t\t}\n\n\t\tif($v3 !== null and ($vector === null or $pos1->distanceSquared($v3) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v3;\n\t\t}\n\n\t\tif($v4 !== null and ($vector === null or $pos1->distanceSquared($v4) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v4;\n\t\t}\n\n\t\tif($v5 !== null and ($vector === null or $pos1->distanceSquared($v5) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v5;\n\t\t}\n\n\t\tif($v6 !== null and ($vector === null or $pos1->distanceSquared($v6) < $pos1->distanceSquared($vector))){\n\t\t\t$vector = $v6;\n\t\t}\n\n\t\tif($vector === null){\n\t\t\treturn null;\n\t\t}\n\n\t\t$f = -1;\n\n\t\tif($vector === $v1){\n\t\t\t$f = 4;\n\t\t}elseif($vector === $v2){\n\t\t\t$f = 5;\n\t\t}elseif($vector === $v3){\n\t\t\t$f = 0;\n\t\t}elseif($vector === $v4){\n\t\t\t$f = 1;\n\t\t}elseif($vector === $v5){\n\t\t\t$f = 2;\n\t\t}elseif($vector === $v6){\n\t\t\t$f = 3;\n\t\t}\n\n\t\treturn MovingObjectPosition::fromBlock(0, 0, 0, $f, $vector);\n\t}\n\n\tpublic function __toString(){\n\t\treturn \"AxisAlignedBB({$this->minX}, {$this->minY}, {$this->minZ}, {$this->maxX}, {$this->maxY}, {$this->maxZ})\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/math/Math.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Math related classes, like matrices, bounding boxes and vector\n */\nnamespace pocketmine\\math;\n\n\nabstract class Math{\n\n\tpublic static function floorFloat($n){\n\t\t$i = (int) $n;\n\t\treturn $n >= $i ? $i : $i - 1;\n\t}\n\n\tpublic static function ceilFloat($n){\n\t\t$i = (int) ($n + 1);\n\t\treturn $n >= $i ? $i : $i - 1;\n\t}\n\n\tpublic static function clamp($value, $low, $high){\n\t\treturn min($high, max($low, $value));\n\t}\n\t\n\tpublic static function solveQuadratic($a, $b, $c): array{\n\t\t$x[0] = (-$b + sqrt($b ** 2 - 4 * $a * $c)) / (2 * $a);\n\t\t$x[1] = (-$b - sqrt($b ** 2 - 4 * $a * $c)) / (2 * $a);\n\t\tif($x[0] == $x[1]){\n\t\t\treturn [$x[0]];\n\t\t}\n\t\treturn $x;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/math/Matrix.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\math;\n\n\nclass Matrix implements \\ArrayAccess{\n\tprivate $matrix = [];\n\tprivate $rows = 0;\n\tprivate $columns = 0;\n\n\tpublic function offsetExists($offset){\n\t\treturn isset($this->matrix[(int) $offset]);\n\t}\n\n\tpublic function offsetGet($offset){\n\t\treturn $this->matrix[(int) $offset];\n\t}\n\n\tpublic function offsetSet($offset, $value){\n\t\t$this->matrix[(int) $offset] = $value;\n\t}\n\n\tpublic function offsetUnset($offset){\n\t\tunset($this->matrix[(int) $offset]);\n\t}\n\n\tpublic function __construct($rows, $columns, array $set = []){\n\t\t$this->rows = max(1, (int) $rows);\n\t\t$this->columns = max(1, (int) $columns);\n\t\t$this->set($set);\n\t}\n\n\tpublic function set(array $m){\n\t\tfor($r = 0; $r < $this->rows; ++$r){\n\t\t\t$this->matrix[$r] = [];\n\t\t\tfor($c = 0; $c < $this->columns; ++$c){\n\t\t\t\t$this->matrix[$r][$c] = isset($m[$r][$c]) ? $m[$r][$c] : 0;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getRows(){\n\t\treturn ($this->rows);\n\t}\n\n\tpublic function getColumns(){\n\t\treturn ($this->columns);\n\t}\n\n\tpublic function setElement($row, $column, $value){\n\t\tif($row > $this->rows or $row < 0 or $column > $this->columns or $column < 0){\n\t\t\treturn false;\n\t\t}\n\t\t$this->matrix[(int) $row][(int) $column] = $value;\n\n\t\treturn true;\n\t}\n\n\tpublic function getElement($row, $column){\n\t\tif($row > $this->rows or $row < 0 or $column > $this->columns or $column < 0){\n\t\t\treturn false;\n\t\t}\n\n\t\treturn $this->matrix[(int) $row][(int) $column];\n\t}\n\n\tpublic function isSquare(){\n\t\treturn $this->rows === $this->columns;\n\t}\n\n\tpublic function add(Matrix $matrix){\n\t\tif($this->rows !== $matrix->getRows() or $this->columns !== $matrix->getColumns()){\n\t\t\treturn false;\n\t\t}\n\t\t$result = new Matrix($this->rows, $this->columns);\n\t\tfor($r = 0; $r < $this->rows; ++$r){\n\t\t\tfor($c = 0; $c < $this->columns; ++$c){\n\t\t\t\t$result->setElement($r, $c, $this->matrix[$r][$c] + $matrix->getElement($r, $c));\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\tpublic function substract(Matrix $matrix){\n\t\tif($this->rows !== $matrix->getRows() or $this->columns !== $matrix->getColumns()){\n\t\t\treturn false;\n\t\t}\n\t\t$result = clone $this;\n\t\tfor($r = 0; $r < $this->rows; ++$r){\n\t\t\tfor($c = 0; $c < $this->columns; ++$c){\n\t\t\t\t$result->setElement($r, $c, $this->matrix[$r][$c] - $matrix->getElement($r, $c));\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\tpublic function multiplyScalar($number){\n\t\t$result = clone $this;\n\t\tfor($r = 0; $r < $this->rows; ++$r){\n\t\t\tfor($c = 0; $c < $this->columns; ++$c){\n\t\t\t\t$result->setElement($r, $c, $this->matrix[$r][$c] * $number);\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\n\tpublic function divideScalar($number){\n\t\t$result = clone $this;\n\t\tfor($r = 0; $r < $this->rows; ++$r){\n\t\t\tfor($c = 0; $c < $this->columns; ++$c){\n\t\t\t\t$result->setElement($r, $c, $this->matrix[$r][$c] / $number);\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\tpublic function transpose(){\n\t\t$result = new Matrix($this->columns, $this->rows);\n\t\tfor($r = 0; $r < $this->rows; ++$r){\n\t\t\tfor($c = 0; $c < $this->columns; ++$c){\n\t\t\t\t$result->setElement($c, $r, $this->matrix[$r][$c]);\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\t//Naive Matrix product, O(n^3)\n\tpublic function product(Matrix $matrix){\n\t\tif($this->columns !== $matrix->getRows()){\n\t\t\treturn false;\n\t\t}\n\t\t$c = $matrix->getColumns();\n\t\t$result = new Matrix($this->rows, $c);\n\t\tfor($i = 0; $i < $this->rows; ++$i){\n\t\t\tfor($j = 0; $j < $c; ++$j){\n\t\t\t\t$sum = 0;\n\t\t\t\tfor($k = 0; $k < $this->columns; ++$k){\n\t\t\t\t\t$sum += $this->matrix[$i][$k] * $matrix->getElement($k, $j);\n\t\t\t\t}\n\t\t\t\t$result->setElement($i, $j, $sum);\n\t\t\t}\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\n\t//Computation of the determinant of 2x2 and 3x3 matrices\n\tpublic function determinant(){\n\t\tif($this->isSquare() !== true){\n\t\t\treturn false;\n\t\t}\n\t\tswitch($this->rows){\n\t\t\tcase 1:\n\t\t\t\treturn 0;\n\t\t\tcase 2:\n\t\t\t\treturn $this->matrix[0][0] * $this->matrix[1][1] - $this->matrix[0][1] * $this->matrix[1][0];\n\t\t\tcase 3:\n\t\t\t\treturn $this->matrix[0][0] * $this->matrix[1][1] * $this->matrix[2][2] + $this->matrix[0][1] * $this->matrix[1][2] * $this->matrix[2][0] + $this->matrix[0][2] * $this->matrix[1][0] * $this->matrix[2][1] - $this->matrix[2][0] * $this->matrix[1][1] * $this->matrix[0][2] - $this->matrix[2][1] * $this->matrix[1][2] * $this->matrix[0][0] - $this->matrix[2][2] * $this->matrix[1][0] * $this->matrix[0][1];\n\t\t}\n\n\t\treturn false;\n\t}\n\n\n\tpublic function __toString(){\n\t\t$s = \"\";\n\t\tfor($r = 0; $r < $this->rows; ++$r){\n\t\t\t$s .= implode(\",\", $this->matrix[$r]) . \";\";\n\t\t}\n\n\t\treturn \"Matrix({$this->rows}x{$this->columns};\" . substr($s, 0, -1) . \")\";\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/math/Vector2.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\math;\nuse pocketmine\\utils\\Random;\n\nclass Vector2{\n\tpublic $x;\n\tpublic $y;\n\n\tpublic function __construct($x = 0, $y = 0){\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t}\n\n\tpublic function getX(){\n\t\treturn $this->x;\n\t}\n\n\tpublic function getY(){\n\t\treturn $this->y;\n\t}\n\n\tpublic function getFloorX(){\n\t\treturn (int) $this->x;\n\t}\n\n\tpublic function getFloorY(){\n\t\treturn (int) $this->y;\n\t}\n\n\tpublic function add($x, $y = 0){\n\t\tif($x instanceof Vector2){\n\t\t\treturn $this->add($x->x, $x->y);\n\t\t}else{\n\t\t\treturn new Vector2($this->x + $x, $this->y + $y);\n\t\t}\n\t}\n\n\tpublic function subtract($x, $y = 0){\n\t\tif($x instanceof Vector2){\n\t\t\treturn $this->add(-$x->x, -$x->y);\n\t\t}else{\n\t\t\treturn $this->add(-$x, -$y);\n\t\t}\n\t}\n\n\tpublic function ceil(){\n\t\treturn new Vector2((int) ($this->x + 1), (int) ($this->y + 1));\n\t}\n\n\tpublic function floor(){\n\t\treturn new Vector2((int) $this->x, (int) $this->y);\n\t}\n\n\tpublic function round(){\n\t\treturn new Vector2(round($this->x), round($this->y));\n\t}\n\n\tpublic function abs(){\n\t\treturn new Vector2(abs($this->x), abs($this->y));\n\t}\n\n\tpublic function multiply($number){\n\t\treturn new Vector2($this->x * $number, $this->y * $number);\n\t}\n\n\tpublic function divide($number){\n\t\treturn new Vector2($this->x / $number, $this->y / $number);\n\t}\n\n\tpublic function distance($x, $y = 0){\n\t\tif($x instanceof Vector2){\n\t\t\treturn sqrt($this->distanceSquared($x->x, $x->y));\n\t\t}else{\n\t\t\treturn sqrt($this->distanceSquared($x, $y));\n\t\t}\n\t}\n\n\tpublic function distanceSquared($x, $y = 0){\n\t\tif($x instanceof Vector2){\n\t\t\treturn $this->distanceSquared($x->x, $x->y);\n\t\t}else{\n\t\t\treturn pow($this->x - $x, 2) + pow($this->y - $y, 2);\n\t\t}\n\t}\n\n\tpublic function length(){\n\t\treturn sqrt($this->lengthSquared());\n\t}\n\n\tpublic function lengthSquared(){\n\t\treturn $this->x * $this->x + $this->y * $this->y;\n\t}\n\n\tpublic function normalize(){\n\t\t$len = $this->lengthSquared();\n\t\tif($len != 0){\n\t\t\treturn $this->divide(sqrt($len));\n\t\t}\n\n\t\treturn new Vector2(0, 0);\n\t}\n\n\tpublic function dot(Vector2 $v){\n\t\treturn $this->x * $v->x + $this->y * $v->y;\n\t}\n\n\tpublic function __toString(){\n\t\treturn \"Vector2(x=\" . $this->x . \",y=\" . $this->y . \")\";\n\t}\n\n\tpublic static function createRandomDirection(Random $random){\n\t\treturn VectorMath::getDirection2D($random->nextFloat() * 2 * pi());\n\t}\n}"
  },
  {
    "path": "src/pocketmine/math/Vector3.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\math;\n\nuse pocketmine\\utils\\Random;\n\nclass Vector3{\n\n\tconst SIDE_DOWN = 0;\n\tconst SIDE_UP = 1;\n\tconst SIDE_NORTH = 2;\n\tconst SIDE_SOUTH = 3;\n\tconst SIDE_WEST = 4;\n\tconst SIDE_EAST = 5;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\n\tpublic function __construct($x = 0, $y = 0, $z = 0){\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t\t$this->z = $z;\n\t}\n\n\tpublic function getX(){\n\t\treturn $this->x;\n\t}\n\n\tpublic function getY(){\n\t\treturn $this->y;\n\t}\n\n\tpublic function getZ(){\n\t\treturn $this->z;\n\t}\n\n\tpublic function getFloorX(){\n\t\treturn (int) floor($this->x);\n\t}\n\n\tpublic function getFloorY(){\n\t\treturn (int) floor($this->y);\n\t}\n\n\tpublic function getFloorZ(){\n\t\treturn (int) floor($this->z);\n\t}\n\n\tpublic function getRight(){\n\t\treturn $this->x;\n\t}\n\n\tpublic function getUp(){\n\t\treturn $this->y;\n\t}\n\n\tpublic function getForward(){\n\t\treturn $this->z;\n\t}\n\n\tpublic function getSouth(){\n\t\treturn $this->x;\n\t}\n\n\tpublic function getWest(){\n\t\treturn $this->z;\n\t}\n\n\t/**\n\t * @param Vector3|int $x\n\t * @param int         $y\n\t * @param int         $z\n\t *\n\t * @return Vector3\n\t */\n\tpublic function add($x, $y = 0, $z = 0){\n\t\tif($x instanceof Vector3){\n\t\t\treturn new Vector3($this->x + $x->x, $this->y + $x->y, $this->z + $x->z);\n\t\t}else{\n\t\t\treturn new Vector3($this->x + $x, $this->y + $y, $this->z + $z);\n\t\t}\n\t}\n\n\t/**\n\t * @param Vector3|int $x\n\t * @param int         $y\n\t * @param int         $z\n\t *\n\t * @return Vector3\n\t */\n\tpublic function subtract($x = 0, $y = 0, $z = 0){\n\t\tif($x instanceof Vector3){\n\t\t\treturn $this->add(-$x->x, -$x->y, -$x->z);\n\t\t}else{\n\t\t\treturn $this->add(-$x, -$y, -$z);\n\t\t}\n\t}\n\n\tpublic function multiply($number){\n\t\treturn new Vector3($this->x * $number, $this->y * $number, $this->z * $number);\n\t}\n\n\tpublic function divide($number){\n\t\treturn new Vector3($this->x / $number, $this->y / $number, $this->z / $number);\n\t}\n\n\tpublic function ceil(){\n\t\treturn new Vector3((int) ceil($this->x), (int) ceil($this->y), (int) ceil($this->z));\n\t}\n\n\tpublic function floor(){\n\t\treturn new Vector3((int) floor($this->x), (int) floor($this->y), (int) floor($this->z));\n\t}\n\n\tpublic function round(){\n\t\treturn new Vector3((int) round($this->x), (int) round($this->y), (int) round($this->z));\n\t}\n\n\tpublic function abs(){\n\t\treturn new Vector3(abs($this->x), abs($this->y), abs($this->z));\n\t}\n\n\tpublic function getSide($side, $step = 1){\n\t\tswitch((int) $side){\n\t\t\tcase Vector3::SIDE_DOWN:\n\t\t\t\treturn new Vector3($this->x, $this->y - $step, $this->z);\n\t\t\tcase Vector3::SIDE_UP:\n\t\t\t\treturn new Vector3($this->x, $this->y + $step, $this->z);\n\t\t\tcase Vector3::SIDE_NORTH:\n\t\t\t\treturn new Vector3($this->x, $this->y, $this->z - $step);\n\t\t\tcase Vector3::SIDE_SOUTH:\n\t\t\t\treturn new Vector3($this->x, $this->y, $this->z + $step);\n\t\t\tcase Vector3::SIDE_WEST:\n\t\t\t\treturn new Vector3($this->x - $step, $this->y, $this->z);\n\t\t\tcase Vector3::SIDE_EAST:\n\t\t\t\treturn new Vector3($this->x + $step, $this->y, $this->z);\n\t\t\tdefault:\n\t\t\t\treturn $this;\n\t\t}\n\t}\n\n\tpublic static function getOppositeSide($side){\n\t\tswitch((int) $side){\n\t\t\tcase Vector3::SIDE_DOWN:\n\t\t\t\treturn Vector3::SIDE_UP;\n\t\t\tcase Vector3::SIDE_UP:\n\t\t\t\treturn Vector3::SIDE_DOWN;\n\t\t\tcase Vector3::SIDE_NORTH:\n\t\t\t\treturn Vector3::SIDE_SOUTH;\n\t\t\tcase Vector3::SIDE_SOUTH:\n\t\t\t\treturn Vector3::SIDE_NORTH;\n\t\t\tcase Vector3::SIDE_WEST:\n\t\t\t\treturn Vector3::SIDE_EAST;\n\t\t\tcase Vector3::SIDE_EAST:\n\t\t\t\treturn Vector3::SIDE_WEST;\n\t\t\tdefault:\n\t\t\t\treturn -1;\n\t\t}\n\t}\n\n\tpublic function distance(Vector3 $pos){\n\t\treturn sqrt($this->distanceSquared($pos));\n\t}\n\n\tpublic function distanceSquared(Vector3 $pos){\n\t\treturn pow($this->x - $pos->x, 2) + pow($this->y - $pos->y, 2) + pow($this->z - $pos->z, 2);\n\t}\n\n\tpublic function maxPlainDistance($x = 0, $z = 0){\n\t\tif($x instanceof Vector3){\n\t\t\treturn $this->maxPlainDistance($x->x, $x->z);\n\t\t}elseif($x instanceof Vector2){\n\t\t\treturn $this->maxPlainDistance($x->x, $x->y);\n\t\t}else{\n\t\t\treturn max(abs($this->x - $x), abs($this->z - $z));\n\t\t}\n\t}\n\n\tpublic function length(){\n\t\treturn sqrt($this->lengthSquared());\n\t}\n\n\tpublic function lengthSquared(){\n\t\treturn $this->x * $this->x + $this->y * $this->y + $this->z * $this->z;\n\t}\n\n\t/**\n\t * @return Vector3\n\t */\n\tpublic function normalize(){\n\t\t$len = $this->lengthSquared();\n\t\tif($len > 0){\n\t\t\treturn $this->divide(sqrt($len));\n\t\t}\n\n\t\treturn new Vector3(0, 0, 0);\n\t}\n\n\tpublic function dot(Vector3 $v){\n\t\treturn $this->x * $v->x + $this->y * $v->y + $this->z * $v->z;\n\t}\n\n\tpublic function cross(Vector3 $v){\n\t\treturn new Vector3(\n\t\t\t$this->y * $v->z - $this->z * $v->y,\n\t\t\t$this->z * $v->x - $this->x * $v->z,\n\t\t\t$this->x * $v->y - $this->y * $v->x\n\t\t);\n\t}\n\n\tpublic function equals(Vector3 $v){\n\t\treturn $this->x == $v->x and $this->y == $v->y and $this->z == $v->z;\n\t}\n\n\t/**\n\t * Returns a new vector with x value equal to the second parameter, along the line between this vector and the\n\t * passed in vector, or null if not possible.\n\t *\n\t * @param Vector3 $v\n\t * @param float   $x\n\t *\n\t * @return Vector3\n\t */\n\tpublic function getIntermediateWithXValue(Vector3 $v, $x){\n\t\t$xDiff = $v->x - $this->x;\n\t\t$yDiff = $v->y - $this->y;\n\t\t$zDiff = $v->z - $this->z;\n\n\t\tif(($xDiff * $xDiff) < 0.0000001){\n\t\t\treturn null;\n\t\t}\n\n\t\t$f = ($x - $this->x) / $xDiff;\n\n\t\tif($f < 0 or $f > 1){\n\t\t\treturn null;\n\t\t}else{\n\t\t\treturn new Vector3($this->x + $xDiff * $f, $this->y + $yDiff * $f, $this->z + $zDiff * $f);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a new vector with y value equal to the second parameter, along the line between this vector and the\n\t * passed in vector, or null if not possible.\n\t *\n\t * @param Vector3 $v\n\t * @param float   $y\n\t *\n\t * @return Vector3\n\t */\n\tpublic function getIntermediateWithYValue(Vector3 $v, $y){\n\t\t$xDiff = $v->x - $this->x;\n\t\t$yDiff = $v->y - $this->y;\n\t\t$zDiff = $v->z - $this->z;\n\n\t\tif(($yDiff * $yDiff) < 0.0000001){\n\t\t\treturn null;\n\t\t}\n\n\t\t$f = ($y - $this->y) / $yDiff;\n\n\t\tif($f < 0 or $f > 1){\n\t\t\treturn null;\n\t\t}else{\n\t\t\treturn new Vector3($this->x + $xDiff * $f, $this->y + $yDiff * $f, $this->z + $zDiff * $f);\n\t\t}\n\t}\n\n\t/**\n\t * Returns a new vector with z value equal to the second parameter, along the line between this vector and the\n\t * passed in vector, or null if not possible.\n\t *\n\t * @param Vector3 $v\n\t * @param float   $z\n\t *\n\t * @return Vector3\n\t */\n\tpublic function getIntermediateWithZValue(Vector3 $v, $z){\n\t\t$xDiff = $v->x - $this->x;\n\t\t$yDiff = $v->y - $this->y;\n\t\t$zDiff = $v->z - $this->z;\n\n\t\tif(($zDiff * $zDiff) < 0.0000001){\n\t\t\treturn null;\n\t\t}\n\n\t\t$f = ($z - $this->z) / $zDiff;\n\n\t\tif($f < 0 or $f > 1){\n\t\t\treturn null;\n\t\t}else{\n\t\t\treturn new Vector3($this->x + $xDiff * $f, $this->y + $yDiff * $f, $this->z + $zDiff * $f);\n\t\t}\n\t}\n\n\t/**\n\t * @param $x\n\t * @param $y\n\t * @param $z\n\t *\n\t * @return Vector3\n\t */\n\tpublic function setComponents($x, $y, $z){\n\t\t$this->x = $x;\n\t\t$this->y = $y;\n\t\t$this->z = $z;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * @param Vector3 $pos\n\t * @param         $x\n\t * @param         $y\n\t * @param         $z\n\t *\n\t * @return $this\n\t */\n\tpublic function fromObjectAdd(Vector3 $pos, $x, $y, $z){\n\t\t$this->x = $pos->x + $x;\n\t\t$this->y = $pos->y + $y;\n\t\t$this->z = $pos->z + $z;\n\t\treturn $this;\n\t}\n\n\tpublic function __toString(){\n\t\treturn \"Vector3(x=\" . $this->x . \",y=\" . $this->y . \",z=\" . $this->z . \")\";\n\t}\n\n\tpublic static function createRandomDirection(Random $random){\n\t\treturn VectorMath::getDirection3D($random->nextFloat() * 2 * pi(), $random->nextFloat() * 2 * pi());\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/math/VectorMath.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\math;\n\n\nabstract class VectorMath{\n\n\tpublic static function getDirection2D($azimuth) : Vector2{\n\t\treturn new Vector2(cos($azimuth), sin($azimuth));\n\t}\n\n\tpublic static function getDirection3D($azimuth, $inclination) : Vector3{\n\t\t$yFact = cos($inclination);\n\t\treturn new Vector3($yFact * cos($azimuth), sin($inclination), $yFact * sin($azimuth));\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/metadata/BlockMetadataStore.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\metadata;\n\nuse pocketmine\\Block\\Block;\nuse pocketmine\\level\\Level;\nuse pocketmine\\plugin\\Plugin;\n\nclass BlockMetadataStore extends MetadataStore{\n\t/** @var Level */\n\tprivate $owningLevel;\n\n\tpublic function __construct(Level $owningLevel){\n\t\t$this->owningLevel = $owningLevel;\n\t}\n\n\tpublic function disambiguate(Metadatable $block, $metadataKey){\n\t\tif(!($block instanceof Block)){\n\t\t\tthrow new \\InvalidArgumentException(\"Argument must be a Block instance\");\n\t\t}\n\n\t\treturn $block->x . \":\" . $block->y . \":\" . $block->z . \":\" . $metadataKey;\n\t}\n\n\tpublic function getMetadata($block, $metadataKey){\n\t\tif(!($block instanceof Block)){\n\t\t\tthrow new \\InvalidArgumentException(\"Object must be a Block\");\n\t\t}\n\t\tif($block->getLevel() === $this->owningLevel){\n\t\t\treturn parent::getMetadata($block, $metadataKey);\n\t\t}else{\n\t\t\tthrow new \\InvalidStateException(\"Block does not belong to world \" . $this->owningLevel->getName());\n\t\t}\n\t}\n\n\tpublic function hasMetadata($block, $metadataKey){\n\t\tif(!($block instanceof Block)){\n\t\t\tthrow new \\InvalidArgumentException(\"Object must be a Block\");\n\t\t}\n\t\tif($block->getLevel() === $this->owningLevel){\n\t\t\treturn parent::hasMetadata($block, $metadataKey);\n\t\t}else{\n\t\t\tthrow new \\InvalidStateException(\"Block does not belong to world \" . $this->owningLevel->getName());\n\t\t}\n\t}\n\n\tpublic function removeMetadata($block, $metadataKey, Plugin $owningPlugin){\n\t\tif(!($block instanceof Block)){\n\t\t\tthrow new \\InvalidArgumentException(\"Object must be a Block\");\n\t\t}\n\t\tif($block->getLevel() === $this->owningLevel){\n\t\t\tparent::hasMetadata($block, $metadataKey);\n\t\t}else{\n\t\t\tthrow new \\InvalidStateException(\"Block does not belong to world \" . $this->owningLevel->getName());\n\t\t}\n\t}\n\n\tpublic function setMetadata($block, $metadataKey, MetadataValue $newMetadatavalue){\n\t\tif(!($block instanceof Block)){\n\t\t\tthrow new \\InvalidArgumentException(\"Object must be a Block\");\n\t\t}\n\t\tif($block->getLevel() === $this->owningLevel){\n\t\t\tparent::setMetadata($block, $metadataKey, $newMetadatavalue);\n\t\t}else{\n\t\t\tthrow new \\InvalidStateException(\"Block does not belong to world \" . $this->owningLevel->getName());\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/metadata/EntityMetadataStore.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\metadata;\n\nuse pocketmine\\entity\\Entity;\n\nclass EntityMetadataStore extends MetadataStore{\n\n\tpublic function disambiguate(Metadatable $entity, $metadataKey){\n\t\tif(!($entity instanceof Entity)){\n\t\t\tthrow new \\InvalidArgumentException(\"Argument must be an Entity instance\");\n\t\t}\n\n\t\treturn $entity->getId() . \":\" . $metadataKey;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/metadata/LevelMetadataStore.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\metadata;\n\nuse pocketmine\\level\\Level;\n\nclass LevelMetadataStore extends MetadataStore{\n\n\tpublic function disambiguate(Metadatable $level, $metadataKey){\n\t\tif(!($level instanceof Level)){\n\t\t\tthrow new \\InvalidArgumentException(\"Argument must be a Level instance\");\n\t\t}\n\n\t\treturn strtolower($level->getName()) . \":\" . $metadataKey;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/metadata/MetadataStore.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Saves extra data on runtime for different items\n */\nnamespace pocketmine\\metadata;\n\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\utils\\PluginException;\n\nabstract class MetadataStore{\n\t/** @var \\WeakMap[] */\n\tprivate $metadataMap;\n\n\t/**\n\t * Adds a metadata value to an object.\n\t *\n\t * @param mixed         $subject\n\t * @param string        $metadataKey\n\t * @param MetadataValue $newMetadataValue\n\t *\n\t * @throws \\Exception\n\t */\n\tpublic function setMetadata($subject, $metadataKey, MetadataValue $newMetadataValue){\n\t\t$owningPlugin = $newMetadataValue->getOwningPlugin();\n\t\tif($owningPlugin === null){\n\t\t\tthrow new PluginException(\"Plugin cannot be null\");\n\t\t}\n\n\t\t$key = $this->disambiguate($subject, $metadataKey);\n\t\tif(!isset($this->metadataMap[$key])){\n\t\t\t//$entry = new \\WeakMap();\n\t\t\t$this->metadataMap[$key] = new \\SplObjectStorage();//$entry;\n\t\t}else{\n\t\t\t$entry = $this->metadataMap[$key];\n\t\t}\n\t\t$entry[$owningPlugin] = $newMetadataValue;\n\t}\n\n\t/**\n\t * Returns all metadata values attached to an object. If multiple\n\t * have attached metadata, each will value will be included.\n\t *\n\t * @param mixed  $subject\n\t * @param string $metadataKey\n\t *\n\t * @return MetadataValue[]\n\t *\n\t * @throws \\Exception\n\t */\n\tpublic function getMetadata($subject, $metadataKey){\n\t\t$key = $this->disambiguate($subject, $metadataKey);\n\t\tif(isset($this->metadataMap[$key])){\n\t\t\treturn $this->metadataMap[$key];\n\t\t}else{\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t/**\n\t * Tests to see if a metadata attribute has been set on an object.\n\t *\n\t * @param mixed  $subject\n\t * @param string $metadataKey\n\t *\n\t * @return bool\n\t *\n\t * @throws \\Exception\n\t */\n\tpublic function hasMetadata($subject, $metadataKey){\n\t\treturn isset($this->metadataMap[$this->disambiguate($subject, $metadataKey)]);\n\t}\n\n\t/**\n\t * Removes a metadata item owned by a plugin from a subject.\n\t *\n\t * @param mixed  $subject\n\t * @param string $metadataKey\n\t * @param Plugin $owningPlugin\n\t *\n\t * @throws \\Exception\n\t */\n\tpublic function removeMetadata($subject, $metadataKey, Plugin $owningPlugin){\n\t\t$key = $this->disambiguate($subject, $metadataKey);\n\t\tif(isset($this->metadataMap[$key])){\n\t\t\tunset($this->metadataMap[$key][$owningPlugin]);\n\t\t\tif($this->metadataMap[$key]->count() === 0){\n\t\t\t\tunset($this->metadataMap[$key]);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Invalidates all metadata in the metadata store that originates from the\n\t * given plugin. Doing this will force each invalidated metadata item to\n\t * be recalculated the next time it is accessed.\n\t *\n\t * @param Plugin $owningPlugin\n\t */\n\tpublic function invalidateAll(Plugin $owningPlugin){\n\t\t/** @var $values MetadataValue[] */\n\t\tforeach($this->metadataMap as $values){\n\t\t\tif(isset($values[$owningPlugin])){\n\t\t\t\t$values[$owningPlugin]->invalidate();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Creates a unique name for the object receiving metadata by combining\n\t * unique data from the subject with a metadataKey.\n\t *\n\t * @param Metadatable $subject\n\t * @param string      $metadataKey\n\t *\n\t * @return string\n\t *\n\t * @throws \\InvalidArgumentException\n\t */\n\tpublic abstract function disambiguate(Metadatable $subject, $metadataKey);\n}"
  },
  {
    "path": "src/pocketmine/metadata/MetadataValue.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\metadata;\n\nuse pocketmine\\plugin\\Plugin;\n\nabstract class MetadataValue{\n\t/** @var \\WeakRef<Plugin> */\n\tprotected $owningPlugin;\n\n\tprotected function __construct(Plugin $owningPlugin){\n\t\t$this->owningPlugin = new \\WeakRef($owningPlugin);\n\t}\n\n\t/**\n\t * @return Plugin\n\t */\n\tpublic function getOwningPlugin(){\n\t\treturn $this->owningPlugin->get();\n\t}\n\n\t/**\n\t * Fetches the value of this metadata item.\n\t *\n\t * @return mixed\n\t */\n\tpublic abstract function value();\n\n\t/**\n\t * Invalidates this metadata item, forcing it to recompute when next\n\t * accessed.\n\t */\n\tpublic abstract function invalidate();\n}"
  },
  {
    "path": "src/pocketmine/metadata/Metadatable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\metadata;\n\nuse pocketmine\\plugin\\Plugin;\n\ninterface Metadatable{\n\n\t/**\n\t * Sets a metadata value in the implementing object's metadata store.\n\t *\n\t * @param string        $metadataKey\n\t * @param MetadataValue $newMetadataValue\n\t *\n\t * @return void\n\t */\n\tpublic function setMetadata($metadataKey, MetadataValue $newMetadataValue);\n\n\t/**\n\t * Returns a list of previously set metadata values from the implementing\n\t * object's metadata store.\n\t *\n\t * @param string $metadataKey\n\t *\n\t * @return MetadataValue[]\n\t */\n\tpublic function getMetadata($metadataKey);\n\n\t/**\n\t * Tests to see whether the implementing object contains the given\n\t * metadata value in its metadata store.\n\t *\n\t * @param string $metadataKey\n\t *\n\t * @return boolean\n\t */\n\tpublic function hasMetadata($metadataKey);\n\n\t/**\n\t * Removes the given metadata value from the implementing object's\n\t * metadata store.\n\t *\n\t * @param string $metadataKey\n\t * @param Plugin $owningPlugin\n\t *\n\t * @return void\n\t */\n\tpublic function removeMetadata($metadataKey, Plugin $owningPlugin);\n\n}"
  },
  {
    "path": "src/pocketmine/metadata/PlayerMetadataStore.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\metadata;\n\nuse pocketmine\\IPlayer;\n\nclass PlayerMetadataStore extends MetadataStore{\n\n\tpublic function disambiguate(Metadatable $player, $metadataKey){\n\t\tif(!($player instanceof IPlayer)){\n\t\t\tthrow new \\InvalidArgumentException(\"Argument must be an IPlayer instance\");\n\t\t}\n\n\t\treturn strtolower($player->getName()) . \":\" . $metadataKey;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/nbt/NBT.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Named Binary Tag handling classes\n */\nnamespace pocketmine\\nbt;\n\nuse pocketmine\\nbt\\tag\\ByteArrayTag;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\EndTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\IntArrayTag;\nuse pocketmine\\nbt\\tag\\LongTag;\nuse pocketmine\\nbt\\tag\\NamedTAG;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\Tag;\n#ifndef COMPILE\nuse pocketmine\\utils\\Binary;\n\n#endif\n\n\n#include <rules/NBT.h>\n\n/**\n * Named Binary Tag encoder/decoder\n */\nclass NBT{\n\n\tconst LITTLE_ENDIAN = 0;\n\tconst BIG_ENDIAN = 1;\n\tconst TAG_End = 0;\n\tconst TAG_Byte = 1;\n\tconst TAG_Short = 2;\n\tconst TAG_Int = 3;\n\tconst TAG_Long = 4;\n\tconst TAG_Float = 5;\n\tconst TAG_Double = 6;\n\tconst TAG_ByteArray = 7;\n\tconst TAG_String = 8;\n\tconst TAG_List = 9;\n\tconst TAG_Compound = 10;\n\tconst TAG_IntArray = 11;\n\n\tpublic $buffer;\n\tprivate $offset;\n\tpublic $endianness;\n\tprivate $data;\n\n\tpublic static function matchList(ListTag $tag1, ListTag $tag2){\n\t\tif($tag1->getName() !== $tag2->getName() or $tag1->getCount() !== $tag2->getCount()){\n\t\t\treturn false;\n\t\t}\n\n\t\tforeach($tag1 as $k => $v){\n\t\t\tif(!($v instanceof Tag)){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif(!isset($tag2->{$k}) or !($tag2->{$k} instanceof $v)){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif($v instanceof CompoundTag){\n\t\t\t\tif(!self::matchTree($v, $tag2->{$k})){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}elseif($v instanceof ListTag){\n\t\t\t\tif(!self::matchList($v, $tag2->{$k})){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif($v->getValue() !== $tag2->{$k}->getValue()){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic static function matchTree(CompoundTag $tag1, CompoundTag $tag2){\n\t\tif($tag1->getName() !== $tag2->getName() or $tag1->getCount() !== $tag2->getCount()){\n\t\t\treturn false;\n\t\t}\n\n\t\tforeach($tag1 as $k => $v){\n\t\t\tif(!($v instanceof Tag)){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif(!isset($tag2->{$k}) or !($tag2->{$k} instanceof $v)){\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif($v instanceof CompoundTag){\n\t\t\t\tif(!self::matchTree($v, $tag2->{$k})){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}elseif($v instanceof ListTag){\n\t\t\t\tif(!self::matchList($v, $tag2->{$k})){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif($v->getValue() !== $tag2->{$k}->getValue()){\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic static function combineCompoundTags(CompoundTag $tag1, CompoundTag $tag2, bool $override = false) : CompoundTag{\n\t\t$tag1 = clone $tag1;\n\t\tforeach($tag2 as $k => $v){\n\t\t\tif(!($v instanceof Tag)){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(!isset($tag1->{$k}) or (isset($tag1->{$k}) and $override)){\n\t\t\t\t$tag1->{$k} = clone $v;\n\t\t\t}\n\t\t}\n\t\treturn $tag1;\n\t}\n\n\tpublic static function parseJSON($data, &$offset = 0){\n\t\t$len = strlen($data);\n\t\tfor(; $offset < $len; ++$offset){\n\t\t\t$c = $data{$offset};\n\t\t\tif($c === \"{\"){\n\t\t\t\t++$offset;\n\t\t\t\t$data = self::parseCompound($data, $offset);\n\t\t\t\treturn new CompoundTag(\"\", $data);\n\t\t\t}elseif($c !== \" \" and $c !== \"\\r\" and $c !== \"\\n\" and $c !== \"\\t\"){\n\t\t\t\tthrow new \\Exception(\"Syntax error: unexpected '$c' at offset $offset\");\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate static function parseList($str, &$offset = 0){\n\t\t$len = strlen($str);\n\n\n\t\t$key = 0;\n\t\t$value = null;\n\n\t\t$data = [];\n\n\t\tfor(; $offset < $len; ++$offset){\n\t\t\tif($str{$offset - 1} === \"]\"){\n\t\t\t\tbreak;\n\t\t\t}elseif($str{$offset} === \"]\"){\n\t\t\t\t++$offset;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$value = self::readValue($str, $offset, $type);\n\n\t\t\tswitch($type){\n\t\t\t\tcase NBT::TAG_Byte:\n\t\t\t\t\t$data[$key] = new ByteTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Short:\n\t\t\t\t\t$data[$key] = new ShortTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Int:\n\t\t\t\t\t$data[$key] = new IntTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Long:\n\t\t\t\t\t$data[$key] = new LongTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Float:\n\t\t\t\t\t$data[$key] = new FloatTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Double:\n\t\t\t\t\t$data[$key] = new DoubleTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_ByteArray:\n\t\t\t\t\t$data[$key] = new ByteArrayTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_String:\n\t\t\t\t\t$data[$key] = new StringTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_List:\n\t\t\t\t\t$data[$key] = new ListTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Compound:\n\t\t\t\t\t$data[$key] = new CompoundTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_IntArray:\n\t\t\t\t\t$data[$key] = new IntArrayTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$key++;\n\t\t}\n\n\t\treturn $data;\n\t}\n\n\tprivate static function parseCompound($str, &$offset = 0){\n\t\t$len = strlen($str);\n\n\t\t$data = [];\n\n\t\tfor(; $offset < $len; ++$offset){\n\t\t\tif($str{$offset - 1} === \"}\"){\n\t\t\t\tbreak;\n\t\t\t}elseif($str{$offset} === \"}\"){\n\t\t\t\t++$offset;\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$key = self::readKey($str, $offset);\n\t\t\t$value = self::readValue($str, $offset, $type);\n\n\t\t\tswitch($type){\n\t\t\t\tcase NBT::TAG_Byte:\n\t\t\t\t\t$data[$key] = new ByteTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Short:\n\t\t\t\t\t$data[$key] = new ShortTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Int:\n\t\t\t\t\t$data[$key] = new IntTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Long:\n\t\t\t\t\t$data[$key] = new LongTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Float:\n\t\t\t\t\t$data[$key] = new FloatTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Double:\n\t\t\t\t\t$data[$key] = new DoubleTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_ByteArray:\n\t\t\t\t\t$data[$key] = new ByteArrayTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_String:\n\t\t\t\t\t$data[$key] = new StringTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_List:\n\t\t\t\t\t$data[$key] = new ListTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Compound:\n\t\t\t\t\t$data[$key] = new CompoundTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_IntArray:\n\t\t\t\t\t$data[$key] = new IntArrayTag($key, $value);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $data;\n\t}\n\n\tprivate static function readValue($data, &$offset, &$type = null){\n\t\t$value = \"\";\n\t\t$type = null;\n\t\t$inQuotes = false;\n\n\t\t$len = strlen($data);\n\t\tfor(; $offset < $len; ++$offset){\n\t\t\t$c = $data{$offset};\n\n\t\t\tif(!$inQuotes and ($c === \" \" or $c === \"\\r\" or $c === \"\\n\" or $c === \"\\t\" or $c === \",\" or $c === \"}\" or $c === \"]\")){\n\t\t\t\tif($c === \",\" or $c === \"}\" or $c === \"]\"){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}elseif($c === '\"'){\n\t\t\t\t$inQuotes = !$inQuotes;\n\t\t\t\tif($type === null){\n\t\t\t\t\t$type = self::TAG_String;\n\t\t\t\t}elseif($inQuotes){\n\t\t\t\t\tthrow new \\Exception(\"Syntax error: invalid quote at offset $offset\");\n\t\t\t\t}\n\t\t\t}elseif($c === \"\\\\\"){\n\t\t\t\t$value .= isset($data{$offset + 1}) ? $data{$offset + 1} : \"\";\n\t\t\t\t++$offset;\n\t\t\t}elseif($c === \"{\" and !$inQuotes){\n\t\t\t\tif($value !== \"\"){\n\t\t\t\t\tthrow new \\Exception(\"Syntax error: invalid compound start at offset $offset\");\n\t\t\t\t}\n\t\t\t\t++$offset;\n\t\t\t\t$value = self::parseCompound($data, $offset);\n\t\t\t\t$type = self::TAG_Compound;\n\t\t\t\tbreak;\n\t\t\t}elseif($c === \"[\" and !$inQuotes){\n\t\t\t\tif($value !== \"\"){\n\t\t\t\t\tthrow new \\Exception(\"Syntax error: invalid list start at offset $offset\");\n\t\t\t\t}\n\t\t\t\t++$offset;\n\t\t\t\t$value = self::parseList($data, $offset);\n\t\t\t\t$type = self::TAG_List;\n\t\t\t\tbreak;\n\t\t\t}else{\n\t\t\t\t$value .= $c;\n\t\t\t}\n\t\t}\n\n\t\tif($value === \"\"){\n\t\t\tthrow new \\Exception(\"Syntax error: invalid empty value at offset $offset\");\n\t\t}\n\n\t\tif($type === null and strlen($value) > 0){\n\t\t\t$value = trim($value);\n\t\t\t$last = strtolower(substr($value, -1));\n\t\t\t$part = substr($value, 0, -1);\n\n\t\t\tif($last !== \"b\" and $last !== \"s\" and $last !== \"l\" and $last !== \"f\" and $last !== \"d\"){\n\t\t\t\t$part = $value;\n\t\t\t\t$last = null;\n\t\t\t}\n\n\t\t\tif($last !== \"f\" and $last !== \"d\" and ((string) ((int) $part)) === $part){\n\t\t\t\tif($last === \"b\"){\n\t\t\t\t\t$type = self::TAG_Byte;\n\t\t\t\t}elseif($last === \"s\"){\n\t\t\t\t\t$type = self::TAG_Short;\n\t\t\t\t}elseif($last === \"l\"){\n\t\t\t\t\t$type = self::TAG_Long;\n\t\t\t\t}else{\n\t\t\t\t\t$type = self::TAG_Int;\n\t\t\t\t}\n\t\t\t\t$value = (int) $part;\n\t\t\t}elseif(is_numeric($part)){\n\t\t\t\tif($last === \"f\" or $last === \"d\" or strpos($part, \".\") !== false){\n\t\t\t\t\tif($last === \"f\"){\n\t\t\t\t\t\t$type = self::TAG_Float;\n\t\t\t\t\t}elseif($last === \"d\"){\n\t\t\t\t\t\t$type = self::TAG_Double;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$type = self::TAG_Float;\n\t\t\t\t\t}\n\t\t\t\t\t$value = (float) $part;\n\t\t\t\t}else{\n\t\t\t\t\tif($last === \"l\"){\n\t\t\t\t\t\t$type = self::TAG_Long;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$type = self::TAG_Int;\n\t\t\t\t\t}\n\n\t\t\t\t\t$value = $part;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$type = self::TAG_String;\n\t\t\t}\n\t\t}\n\n\t\treturn $value;\n\t}\n\n\tprivate static function readKey($data, &$offset){\n\t\t$key = \"\";\n\n\t\t$len = strlen($data);\n\t\tfor(; $offset < $len; ++$offset){\n\t\t\t$c = $data{$offset};\n\n\t\t\tif($c === \":\"){\n\t\t\t\t++$offset;\n\t\t\t\tbreak;\n\t\t\t}elseif($c !== \" \" and $c !== \"\\r\" and $c !== \"\\n\" and $c !== \"\\t\" and $c !== \"\\\"\"){\n\t\t\t\t$key .= $c;\n\t\t\t}\n\t\t}\n\n\t\tif($key === \"\"){\n\t\t\tthrow new \\Exception(\"Syntax error: invalid empty key at offset $offset\");\n\t\t}\n\n\t\treturn $key;\n\t}\n\n\tpublic function get($len){\n\t\tif($len < 0){\n\t\t\t$this->offset = strlen($this->buffer) - 1;\n\t\t\treturn \"\";\n\t\t}elseif($len === true){\n\t\t\treturn substr($this->buffer, $this->offset);\n\t\t}\n\n\t\treturn $len === 1 ? $this->buffer{$this->offset++} : substr($this->buffer, ($this->offset += $len) - $len, $len);\n\t}\n\n\tpublic function put($v){\n\t\t$this->buffer .= $v;\n\t}\n\n\tpublic function feof(){\n\t\treturn !isset($this->buffer{$this->offset});\n\t}\n\n\tpublic function __construct($endianness = self::LITTLE_ENDIAN){\n\t\t$this->offset = 0;\n\t\t$this->endianness = $endianness & 0x01;\n\t}\n\n\tpublic function read($buffer, $doMultiple = false, bool $network = false){\n\t\t$this->offset = 0;\n\t\t$this->buffer = $buffer;\n\t\t$this->data = $this->readTag($network);\n\t\tif($doMultiple and $this->offset < strlen($this->buffer)){\n\t\t\t$this->data = [$this->data];\n\t\t\tdo{\n\t\t\t\t$this->data[] = $this->readTag($network);\n\t\t\t}while($this->offset < strlen($this->buffer));\n\t\t}\n\t\t$this->buffer = \"\";\n\t}\n\n\tpublic function readCompressed($buffer, $compression = ZLIB_ENCODING_GZIP){\n\t\t$this->read(zlib_decode($buffer));\n\t}\n\n\tpublic function readNetworkCompressed($buffer, $compression = ZLIB_ENCODING_GZIP){\n\t\t$this->read(zlib_decode($buffer), false, true);\n\t}\n\n\n\t/**\n\t * @param bool $network\n\t *\n\t * @return string|bool\n\t */\n\tpublic function write(bool $network = false){\n\t\t$this->offset = 0;\n\t\t$this->buffer = \"\";\n\n\t\tif($this->data instanceof CompoundTag){\n\t\t\t$this->writeTag($this->data, $network);\n\n\t\t\treturn $this->buffer;\n\t\t}elseif(is_array($this->data)){\n\t\t\tforeach($this->data as $tag){\n\t\t\t\t$this->writeTag($tag, $network);\n\t\t\t}\n\t\t\treturn $this->buffer;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function writeCompressed($compression = ZLIB_ENCODING_GZIP, $level = 7){\n\t\tif(($write = $this->write()) !== false){\n\t\t\treturn zlib_encode($write, $compression, $level);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function writeNetworkCompressed($compression = ZLIB_ENCODING_GZIP, $level = 7){\n\t\tif(($write = $this->write(true)) !== false){\n\t\t\treturn zlib_encode($write, $compression, $level);\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function readTag(bool $network = false){\n\t\tif($this->feof()){\n\t\t\t$tagType = -1; //prevent crashes for empty tags\n\t\t}else{\n\t\t\t$tagType = $this->getByte();\n\t\t}\n\t\tswitch($tagType){\n\t\t\tcase NBT::TAG_Byte:\n\t\t\t\t$tag = new ByteTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_Short:\n\t\t\t\t$tag = new ShortTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_Int:\n\t\t\t\t$tag = new IntTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_Long:\n\t\t\t\t$tag = new LongTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_Float:\n\t\t\t\t$tag = new FloatTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_Double:\n\t\t\t\t$tag = new DoubleTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_ByteArray:\n\t\t\t\t$tag = new ByteArrayTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_String:\n\t\t\t\t$tag = new StringTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_List:\n\t\t\t\t$tag = new ListTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_Compound:\n\t\t\t\t$tag = new CompoundTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\t\t\tcase NBT::TAG_IntArray:\n\t\t\t\t$tag = new IntArrayTag($this->getString($network));\n\t\t\t\t$tag->read($this, $network);\n\t\t\t\tbreak;\n\n\t\t\tcase NBT::TAG_End: //No named tag\n\t\t\tdefault:\n\t\t\t\t$tag = new EndTag;\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $tag;\n\t}\n\n\tpublic function writeTag(Tag $tag, bool $network = false){\n\t\t$this->putByte($tag->getType());\n\t\tif($tag instanceof NamedTAG){\n\t\t\t$this->putString($tag->getName(), $network);\n\t\t}\n\t\t$tag->write($this, $network);\n\t}\n\n\tpublic function getByte(){\n\t\treturn Binary::readByte($this->get(1));\n\t}\n\n\tpublic function putByte($v){\n\t\t$this->buffer .= Binary::writeByte($v);\n\t}\n\n\tpublic function getShort(){\n\t\treturn $this->endianness === self::BIG_ENDIAN ? Binary::readShort($this->get(2)) : Binary::readLShort($this->get(2));\n\t}\n\n\tpublic function putShort($v){\n\t\t$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeShort($v) : Binary::writeLShort($v);\n\t}\n\n\tpublic function getInt(bool $network = false){\n\t\tif($network === true){\n\t\t\treturn Binary::readVarInt($this);\n\t\t}\n\t\treturn $this->endianness === self::BIG_ENDIAN ? Binary::readInt($this->get(4)) : Binary::readLInt($this->get(4));\n\t}\n\n\tpublic function putInt($v, bool $network = false){\n\t\tif($network === true){\n\t\t\t$this->buffer .= Binary::writeVarInt($v);\n\t\t}else{\n\t\t\t$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeInt($v) : Binary::writeLInt($v);\n\t\t}\n\t}\n\n\tpublic function getLong(){\n\t\treturn $this->endianness === self::BIG_ENDIAN ? Binary::readLong($this->get(8)) : Binary::readLLong($this->get(8));\n\t}\n\n\tpublic function putLong($v){\n\t\t$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeLong($v) : Binary::writeLLong($v);\n\t}\n\n\tpublic function getFloat(){\n\t\treturn $this->endianness === self::BIG_ENDIAN ? Binary::readFloat($this->get(4)) : Binary::readLFloat($this->get(4));\n\t}\n\n\tpublic function putFloat($v){\n\t\t$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeFloat($v) : Binary::writeLFloat($v);\n\t}\n\n\tpublic function getDouble(){\n\t\treturn $this->endianness === self::BIG_ENDIAN ? Binary::readDouble($this->get(8)) : Binary::readLDouble($this->get(8));\n\t}\n\n\tpublic function putDouble($v){\n\t\t$this->buffer .= $this->endianness === self::BIG_ENDIAN ? Binary::writeDouble($v) : Binary::writeLDouble($v);\n\t}\n\n\tpublic function getString(bool $network = false){\n\t\t$len = $network ? $this->getByte() : $this->getShort();\n\t\treturn $this->get($len);\n\t}\n\n\tpublic function putString($v, bool $network = false){\n\t\tif($network === true){\n\t\t\t$this->putByte(strlen($v));\n\t\t}else{\n\t\t\t$this->putShort(strlen($v));\n\t\t}\n\t\t$this->buffer .= $v;\n\t}\n\n\tpublic function getArray(){\n\t\t$data = [];\n\t\tself::toArray($data, $this->data);\n\t}\n\n\tprivate static function toArray(array &$data, Tag $tag){\n\t\t/** @var CompoundTag[]|ListTag[]|IntArrayTag[] $tag */\n\t\tforeach($tag as $key => $value){\n\t\t\tif($value instanceof CompoundTag or $value instanceof ListTag or $value instanceof IntArrayTag){\n\t\t\t\t$data[$key] = [];\n\t\t\t\tself::toArray($data[$key], $value);\n\t\t\t}else{\n\t\t\t\t$data[$key] = $value->getValue();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic static function fromArrayGuesser($key, $value){\n\t\tif(is_int($value)){\n\t\t\treturn new IntTag($key, $value);\n\t\t}elseif(is_float($value)){\n\t\t\treturn new FloatTag($key, $value);\n\t\t}elseif(is_string($value)){\n\t\t\treturn new StringTag($key, $value);\n\t\t}elseif(is_bool($value)){\n\t\t\treturn new ByteTag($key, $value ? 1 : 0);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate static function fromArray(Tag $tag, array $data, callable $guesser){\n\t\tforeach($data as $key => $value){\n\t\t\tif(is_array($value)){\n\t\t\t\t$isNumeric = true;\n\t\t\t\t$isIntArray = true;\n\t\t\t\tforeach($value as $k => $v){\n\t\t\t\t\tif(!is_numeric($k)){\n\t\t\t\t\t\t$isNumeric = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}elseif(!is_int($v)){\n\t\t\t\t\t\t$isIntArray = false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$tag{$key} = $isNumeric ? ($isIntArray ? new IntArrayTag($key, []) : new ListTag($key, [])) : new CompoundTag($key, []);\n\t\t\t\tself::fromArray($tag->{$key}, $value, $guesser);\n\t\t\t}else{\n\t\t\t\t$v = call_user_func($guesser, $key, $value);\n\t\t\t\tif($v instanceof Tag){\n\t\t\t\t\t$tag{$key} = $v;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function setArray(array $data, callable $guesser = null){\n\t\t$this->data = new CompoundTag(\"\", []);\n\t\tself::fromArray($this->data, $data, $guesser === null ? [self::class, \"fromArrayGuesser\"] : $guesser);\n\t}\n\n\t/**\n\t * @return CompoundTag|array\n\t */\n\tpublic function getData(){\n\t\treturn $this->data;\n\t}\n\n\t/**\n\t * @param CompoundTag|array $data\n\t */\n\tpublic function setData($data){\n\t\t$this->data = $data;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/nbt/tag/ByteArrayTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass ByteArrayTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_ByteArray;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->get($nbt->getInt($network));\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putInt(strlen($this->value), $network);\n\t\t$nbt->put($this->value);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/ByteTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass ByteTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_Byte;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->getByte();\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putByte($this->value);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/CompoundTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass CompoundTag extends NamedTag implements \\ArrayAccess{\n\n\t/**\n\t * @param string     $name\n\t * @param NamedTag[] $value\n\t */\n\tpublic function __construct($name = \"\", $value = []){\n\t\t$this->__name = $name;\n\t\tforeach($value as $tag){\n\t\t\t$this->{$tag->getName()} = $tag;\n\t\t}\n\t}\n\n\tpublic function getCount(){\n\t\t$count = 0;\n\t\tforeach($this as $tag){\n\t\t\tif($tag instanceof Tag){\n\t\t\t\t++$count;\n\t\t\t}\n\t\t}\n\n\t\treturn $count;\n\t}\n\n\tpublic function offsetExists($offset){\n\t\treturn isset($this->{$offset}) and $this->{$offset} instanceof Tag;\n\t}\n\n\tpublic function offsetGet($offset){\n\t\tif(isset($this->{$offset}) and $this->{$offset} instanceof Tag){\n\t\t\tif($this->{$offset} instanceof \\ArrayAccess){\n\t\t\t\treturn $this->{$offset};\n\t\t\t}else{\n\t\t\t\treturn $this->{$offset}->getValue();\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function offsetSet($offset, $value){\n\t\tif($value instanceof Tag){\n\t\t\t$this->{$offset} = $value;\n\t\t}elseif(isset($this->{$offset}) and $this->{$offset} instanceof Tag){\n\t\t\t$this->{$offset}->setValue($value);\n\t\t}\n\t}\n\n\tpublic function offsetUnset($offset){\n\t\tunset($this->{$offset});\n\t}\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_Compound;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = [];\n\t\tdo{\n\t\t\t$tag = $nbt->readTag($network);\n\t\t\tif($tag instanceof NamedTag and $tag->getName() !== \"\"){\n\t\t\t\t$this->{$tag->getName()} = $tag;\n\t\t\t}\n\t\t}while(!($tag instanceof EndTag) and !$nbt->feof());\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\tforeach($this as $tag){\n\t\t\tif($tag instanceof Tag and !($tag instanceof EndTag)){\n\t\t\t\t$nbt->writeTag($tag, $network);\n\t\t\t}\n\t\t}\n\n\t\t$nbt->writeTag(new EndTag, $network);\n\t}\n\n\tpublic function __toString(){\n\t\t$str = get_class($this) . \"{\\n\";\n\t\tforeach($this as $tag){\n\t\t\tif($tag instanceof Tag){\n\t\t\t\t$str .= get_class($tag) . \":\" . $tag->__toString() . \"\\n\";\n\t\t\t}\n\t\t}\n\t\treturn $str . \"}\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/DoubleTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass DoubleTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_Double;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->getDouble();\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putDouble($this->value);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/EndTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\nclass EndTag extends Tag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_End;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/FloatTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass FloatTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_Float;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->getFloat();\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putFloat($this->value);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/IntArrayTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass IntArrayTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_IntArray;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$size = $nbt->getInt($network);\n\t\t$this->value = array_values(unpack($nbt->endianness === NBT::LITTLE_ENDIAN ? \"V*\" : \"N*\", $nbt->get($size * 4)));\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putInt(count($this->value), $network);\n\t\t$nbt->put(pack($nbt->endianness === NBT::LITTLE_ENDIAN ? \"V*\" : \"N*\", ...$this->value));\n\t}\n\n\tpublic function __toString(){\n\t\t$str = get_class($this) . \"{\\n\";\n\t\t$str .= implode(\", \", $this->value);\n\t\treturn $str . \"}\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/IntTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass IntTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_Int;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->getInt($network);\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putInt($this->value, $network);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/ListTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\ListTag as TagEnum;\n\n#include <rules/NBT.h>\n\nclass ListTag extends NamedTag implements \\ArrayAccess, \\Countable{\n\n\tprivate $tagType;\n\n\tpublic function __construct($name = \"\", $value = []){\n\t\t$this->__name = $name;\n\t\tforeach($value as $k => $v){\n\t\t\t$this->{$k} = $v;\n\t\t}\n\t}\n\n\tpublic function &getValue(){\n\t\t$value = [];\n\t\tforeach($this as $k => $v){\n\t\t\tif($v instanceof Tag){\n\t\t\t\t$value[$k] = $v;\n\t\t\t}\n\t\t}\n\n\t\treturn $value;\n\t}\n\n\tpublic function getCount(){\n\t\t$count = 0;\n\t\tforeach($this as $tag){\n\t\t\tif($tag instanceof Tag){\n\t\t\t\t++$count;\n\t\t\t}\n\t\t}\n\n\t\treturn $count;\n\t}\n\n\tpublic function offsetExists($offset){\n\t\treturn isset($this->{$offset});\n\t}\n\n\tpublic function offsetGet($offset){\n\t\tif(isset($this->{$offset}) and $this->{$offset} instanceof Tag){\n\t\t\tif($this->{$offset} instanceof \\ArrayAccess){\n\t\t\t\treturn $this->{$offset};\n\t\t\t}else{\n\t\t\t\treturn $this->{$offset}->getValue();\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function offsetSet($offset, $value){\n\t\tif($value instanceof Tag){\n\t\t\t$this->{$offset} = $value;\n\t\t}elseif($this->{$offset} instanceof Tag){\n\t\t\t$this->{$offset}->setValue($value);\n\t\t}\n\t}\n\n\tpublic function offsetUnset($offset){\n\t\tunset($this->{$offset});\n\t}\n\n\tpublic function count($mode = COUNT_NORMAL){\n\t\tfor($i = 0; true; $i++){\n\t\t\tif(!isset($this->{$i})){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t\tif($mode === COUNT_RECURSIVE){\n\t\t\t\tif($this->{$i} instanceof \\Countable){\n\t\t\t\t\t$i += count($this->{$i});\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $i;\n\t}\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_List;\n\t}\n\n\tpublic function setTagType($type){\n\t\t$this->tagType = $type;\n\t}\n\n\tpublic function getTagType(){\n\t\treturn $this->tagType;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = [];\n\t\t$this->tagType = $nbt->getByte();\n\t\t$size = $nbt->getInt($network);\n\t\tfor($i = 0; $i < $size and !$nbt->feof(); ++$i){\n\t\t\tswitch($this->tagType){\n\t\t\t\tcase NBT::TAG_Byte:\n\t\t\t\t\t$tag = new ByteTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Short:\n\t\t\t\t\t$tag = new ShortTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Int:\n\t\t\t\t\t$tag = new IntTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Long:\n\t\t\t\t\t$tag = new LongTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Float:\n\t\t\t\t\t$tag = new FloatTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Double:\n\t\t\t\t\t$tag = new DoubleTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_ByteArray:\n\t\t\t\t\t$tag = new ByteArrayTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_String:\n\t\t\t\t\t$tag = new StringTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_List:\n\t\t\t\t\t$tag = new TagEnum(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_Compound:\n\t\t\t\t\t$tag = new CompoundTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t\tcase NBT::TAG_IntArray:\n\t\t\t\t\t$tag = new IntArrayTag(\"\");\n\t\t\t\t\t$tag->read($nbt, $network);\n\t\t\t\t\t$this->{$i} = $tag;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\tif(!isset($this->tagType)){\n\t\t\t$id = null;\n\t\t\tforeach($this as $tag){\n\t\t\t\tif($tag instanceof Tag){\n\t\t\t\t\tif(!isset($id)){\n\t\t\t\t\t\t$id = $tag->getType();\n\t\t\t\t\t}elseif($id !== $tag->getType()){\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->tagType = $id;\n\t\t}\n\n\t\t$nbt->putByte($this->tagType);\n\n\t\t/** @var Tag[] $tags */\n\t\t$tags = [];\n\t\tforeach($this as $tag){\n\t\t\tif($tag instanceof Tag){\n\t\t\t\t$tags[] = $tag;\n\t\t\t}\n\t\t}\n\t\t$nbt->putInt(count($tags));\n\t\tforeach($tags as $tag){\n\t\t\t$tag->write($nbt, $network);\n\t\t}\n\t}\n\n\tpublic function __toString(){\n\t\t$str = get_class($this) . \"{\\n\";\n\t\tforeach($this as $tag){\n\t\t\tif($tag instanceof Tag){\n\t\t\t\t$str .= get_class($tag) . \":\" . $tag->__toString() . \"\\n\";\n\t\t\t}\n\t\t}\n\t\treturn $str . \"}\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/nbt/tag/LongTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass LongTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_Long;\n\t}\n\n\t//TODO: check if this also changed to varint\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->getLong();\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putLong($this->value);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/NamedTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\n\nabstract class NamedTag extends Tag{\n\n\tprotected $__name;\n\n\t/**\n\t * @param string                                                      $name\n\t * @param bool|float|double|int|byte|short|array|CompoundTag|ListTag|string $value\n\t */\n\tpublic function __construct($name = \"\", $value = null){\n\t\t$this->__name = ($name === null or $name === false) ? \"\" : $name;\n\t\tif($value !== null){\n\t\t\t$this->value = $value;\n\t\t}\n\t}\n\n\tpublic function getName(){\n\t\treturn $this->__name;\n\t}\n\n\tpublic function setName($name){\n\t\t$this->__name = $name;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/ShortTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass ShortTag extends NamedTag{\n\n\tpublic function getType(){\n\t\treturn NBT::TAG_Short;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->getShort();\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putShort($this->value);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/StringTag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\n#include <rules/NBT.h>\n\nclass StringTag extends NamedTag{\n\t\n\tpublic function getType(){\n\t\treturn NBT::TAG_String;\n\t}\n\n\tpublic function read(NBT $nbt, bool $network = false){\n\t\t$this->value = $nbt->getString($network);\n\t}\n\n\tpublic function write(NBT $nbt, bool $network = false){\n\t\t$nbt->putString($this->value, $network);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/nbt/tag/Tag.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * All the NBT Tags\n */\nnamespace pocketmine\\nbt\\tag;\n\nuse pocketmine\\nbt\\NBT;\n\nabstract class Tag extends \\stdClass{\n\n\tprotected $value;\n\n\tpublic function &getValue(){\n\t\treturn $this->value;\n\t}\n\n\tpublic abstract function getType();\n\n\tpublic function setValue($value){\n\t\t$this->value = $value;\n\t}\n\n\tabstract public function write(NBT $nbt, bool $network = false);\n\n\tabstract public function read(NBT $nbt, bool $network = false);\n\n\tpublic function __toString(){\n\t\treturn (string) $this->value;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/AdvancedSourceInterface.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Network-related classes\n */\nnamespace pocketmine\\network;\n\ninterface AdvancedSourceInterface extends SourceInterface{\n\n\t/**\n\t * @param string $address\n\t * @param int    $timeout Seconds\n\t */\n\tpublic function blockAddress($address, $timeout = 300);\n\n\t/**\n\t * @param Network $network\n\t */\n\tpublic function setNetwork(Network $network);\n\n\t/**\n\t * @param string $address\n\t * @param int    $port\n\t * @param string $payload\n\t */\n\tpublic function sendRawPacket($address, $port, $payload);\n\n}"
  },
  {
    "path": "src/pocketmine/network/CachedEncapsulatedPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\network;\n\nuse raklib\\protocol\\EncapsulatedPacket;\n\nclass CachedEncapsulatedPacket extends EncapsulatedPacket{\n\n\tprivate $internalData = null;\n\n\tpublic function toBinary($internal = false){\n\t\treturn $this->internalData === null ? ($this->internalData = parent::toBinary($internal)) : $this->internalData;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/CompressBatchedTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\network;\n\n\nuse pocketmine\\scheduler\\AsyncTask;\nuse pocketmine\\Server;\n\nclass CompressBatchedTask extends AsyncTask{\n\n\tpublic $level = 7;\n\tpublic $data;\n\tpublic $final;\n\tpublic $targets;\n\n\tpublic function __construct($data, array $targets, $level = 7){\n\t\t$this->data = $data;\n\t\t$this->targets = serialize($targets);\n\t\t$this->level = $level;\n\t}\n\n\tpublic function onRun(){\n\t\ttry{\n\t\t\t$this->final = zlib_encode($this->data, ZLIB_ENCODING_DEFLATE, $this->level);\n\t\t\t$this->data = null;\n\t\t}catch(\\Throwable $e){\n\n\t\t}\n\t}\n\n\tpublic function onCompletion(Server $server){\n\t\t$server->broadcastPacketsCallback($this->final, unserialize($this->targets));\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/Network.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Network-related classes\n */\nnamespace pocketmine\\network;\n\nuse pocketmine\\network\\protocol\\AddEntityPacket;\nuse pocketmine\\network\\protocol\\AddHangingEntityPacket;\nuse pocketmine\\network\\protocol\\AddItemEntityPacket;\nuse pocketmine\\network\\protocol\\AddItemPacket;\nuse pocketmine\\network\\protocol\\AddPaintingPacket;\nuse pocketmine\\network\\protocol\\AddPlayerPacket;\nuse pocketmine\\network\\protocol\\AdventureSettingsPacket;\nuse pocketmine\\network\\protocol\\AnimatePacket;\nuse pocketmine\\network\\protocol\\AvailableCommandsPacket;\nuse pocketmine\\network\\protocol\\BatchPacket;\nuse pocketmine\\network\\protocol\\BlockEntityDataPacket;\nuse pocketmine\\network\\protocol\\BlockEventPacket;\nuse pocketmine\\network\\protocol\\BossEventPacket;\nuse pocketmine\\network\\protocol\\ChangeDimensionPacket;\nuse pocketmine\\network\\protocol\\ChunkRadiusUpdatedPacket;\nuse pocketmine\\network\\protocol\\CommandStepPacket;\nuse pocketmine\\network\\protocol\\ContainerClosePacket;\nuse pocketmine\\network\\protocol\\ContainerOpenPacket;\nuse pocketmine\\network\\protocol\\ContainerSetContentPacket;\nuse pocketmine\\network\\protocol\\ContainerSetDataPacket;\nuse pocketmine\\network\\protocol\\ContainerSetSlotPacket;\nuse pocketmine\\network\\protocol\\CraftingDataPacket;\nuse pocketmine\\network\\protocol\\CraftingEventPacket;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\network\\protocol\\DisconnectPacket;\nuse pocketmine\\network\\protocol\\DropItemPacket;\nuse pocketmine\\network\\protocol\\EntityEventPacket;\nuse pocketmine\\network\\protocol\\ExplodePacket;\nuse pocketmine\\network\\protocol\\FullChunkDataPacket;\nuse pocketmine\\network\\protocol\\HurtArmorPacket;\nuse pocketmine\\network\\protocol\\Info;\nuse pocketmine\\network\\protocol\\Info as ProtocolInfo;\nuse pocketmine\\network\\protocol\\InteractPacket;\nuse pocketmine\\network\\protocol\\InventoryActionPacket;\nuse pocketmine\\network\\protocol\\ItemFrameDropItemPacket;\nuse pocketmine\\network\\protocol\\LevelEventPacket;\nuse pocketmine\\network\\protocol\\LevelSoundEventPacket;\nuse pocketmine\\network\\protocol\\LoginPacket;\nuse pocketmine\\network\\protocol\\MobArmorEquipmentPacket;\nuse pocketmine\\network\\protocol\\MobEquipmentPacket;\nuse pocketmine\\network\\protocol\\MoveEntityPacket;\nuse pocketmine\\network\\protocol\\MovePlayerPacket;\nuse pocketmine\\network\\protocol\\PlayStatusPacket;\nuse pocketmine\\network\\protocol\\PlayerActionPacket;\nuse pocketmine\\network\\protocol\\PlayerFallPacket;\nuse pocketmine\\network\\protocol\\PlayerInputPacket;\nuse pocketmine\\network\\protocol\\PlayerListPacket;\nuse pocketmine\\network\\protocol\\RemoveBlockPacket;\nuse pocketmine\\network\\protocol\\RemoveEntityPacket;\nuse pocketmine\\network\\protocol\\ReplaceItemInSlotPacket;\nuse pocketmine\\network\\protocol\\RequestChunkRadiusPacket;\nuse pocketmine\\network\\protocol\\ResourcePackClientResponsePacket;\nuse pocketmine\\network\\protocol\\ResourcePacksInfoPacket;\nuse pocketmine\\network\\protocol\\RespawnPacket;\nuse pocketmine\\network\\protocol\\SetCommandsEnabledPacket;\nuse pocketmine\\network\\protocol\\SetDifficultyPacket;\nuse pocketmine\\network\\protocol\\SetEntityDataPacket;\nuse pocketmine\\network\\protocol\\SetEntityLinkPacket;\nuse pocketmine\\network\\protocol\\SetEntityMotionPacket;\nuse pocketmine\\network\\protocol\\SetHealthPacket;\nuse pocketmine\\network\\protocol\\SetPlayerGameTypePacket;\nuse pocketmine\\network\\protocol\\SetSpawnPositionPacket;\nuse pocketmine\\network\\protocol\\SetTimePacket;\nuse pocketmine\\network\\protocol\\ShowCreditsPacket;\nuse pocketmine\\network\\protocol\\SpawnExperienceOrbPacket;\nuse pocketmine\\network\\protocol\\StartGamePacket;\nuse pocketmine\\network\\protocol\\TakeItemEntityPacket;\nuse pocketmine\\network\\protocol\\TextPacket;\nuse pocketmine\\network\\protocol\\TransferPacket;\nuse pocketmine\\network\\protocol\\UpdateBlockPacket;\nuse pocketmine\\network\\protocol\\UseItemPacket;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\BinaryStream;\nuse pocketmine\\utils\\MainLogger;\n\nclass Network {\n\n\tpublic static $BATCH_THRESHOLD = 512;\n\n\t/** @var \\SplFixedArray */\n\tprivate $packetPool;\n\n\t/** @var Server */\n\tprivate $server;\n\n\t/** @var SourceInterface[] */\n\tprivate $interfaces = [];\n\n\t/** @var AdvancedSourceInterface[] */\n\tprivate $advancedInterfaces = [];\n\n\tprivate $upload = 0;\n\tprivate $download = 0;\n\n\tprivate $name;\n\n\tpublic function __construct(Server $server) {\n\n\t\t$this->registerPackets();\n\n\t\t$this->server = $server;\n\t}\n\n\tpublic function addStatistics($upload, $download) {\n\t\t$this->upload += $upload;\n\t\t$this->download += $download;\n\t}\n\n\tpublic function getUpload() {\n\t\treturn $this->upload;\n\t}\n\n\tpublic function getDownload() {\n\t\treturn $this->download;\n\t}\n\n\tpublic function resetStatistics() {\n\t\t$this->upload = 0;\n\t\t$this->download = 0;\n\t}\n\n\t/**\n\t * @return SourceInterface[]\n\t */\n\tpublic function getInterfaces() {\n\t\treturn $this->interfaces;\n\t}\n\n\tpublic function processInterfaces() {\n\t\tforeach ($this->interfaces as $interface) {\n\t\t\ttry {\n\t\t\t\t$interface->process();\n\t\t\t} catch (\\Throwable $e) {\n\t\t\t\t$logger = $this->server->getLogger();\n\t\t\t\tif (\\pocketmine\\DEBUG > 1) {\n\t\t\t\t\tif ($logger instanceof MainLogger) {\n\t\t\t\t\t\t$logger->logException($e);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$interface->emergencyShutdown();\n\t\t\t\t$this->unregisterInterface($interface);\n\t\t\t\t$logger->critical($this->server->getLanguage()->translateString(\"pocketmine.server.networkError\", [get_class($interface), $e->getMessage()]));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param SourceInterface $interface\n\t */\n\tpublic function registerInterface(SourceInterface $interface) {\n\t\t$this->interfaces[$hash = spl_object_hash($interface)] = $interface;\n\t\tif ($interface instanceof AdvancedSourceInterface) {\n\t\t\t$this->advancedInterfaces[$hash] = $interface;\n\t\t\t$interface->setNetwork($this);\n\t\t}\n\t\t$interface->setName($this->name);\n\t}\n\n\t/**\n\t * @param SourceInterface $interface\n\t */\n\tpublic function unregisterInterface(SourceInterface $interface) {\n\t\tunset($this->interfaces[$hash = spl_object_hash($interface)],\n\t\t\t$this->advancedInterfaces[$hash]);\n\t}\n\n\t/**\n\t * Sets the server name shown on each interface Query\n\t *\n\t * @param string $name\n\t */\n\tpublic function setName($name) {\n\t\t$this->name = (string)$name;\n\t\tforeach ($this->interfaces as $interface) {\n\t\t\t$interface->setName($this->name);\n\t\t}\n\t}\n\n\tpublic function getName() {\n\t\treturn $this->name;\n\t}\n\n\tpublic function updateName() {\n\t\tforeach ($this->interfaces as $interface) {\n\t\t\t$interface->setName($this->name);\n\t\t}\n\t}\n\n\t/**\n\t * @param int        $id 0-255\n\t * @param DataPacket $class\n\t */\n\tpublic function registerPacket($id, $class) {\n\t\t$this->packetPool[$id] = new $class;\n\t}\n\n\tpublic function getServer() {\n\t\treturn $this->server;\n\t}\n\n\tpublic function processBatch(BatchPacket $packet, Player $p){\n\t\ttry{\n\t\t\tif(strlen($packet->payload) === 0){\n\t\t\t\t//prevent zlib_decode errors for incorrectly-decoded packets\n\t\t\t\tthrow new \\InvalidArgumentException(\"BatchPacket payload is empty or packet decode error\");\n\t\t\t}\n\n\t\t\t$str = zlib_decode($packet->payload, 1024 * 1024 * 64); //Max 64MB\n\t\t\t$len = strlen($str);\n\n\t\t\tif($len === 0){\n\t\t\t\tthrow new \\InvalidStateException(\"Decoded BatchPacket payload is empty\");\n\t\t\t}\n\n\t\t\t$stream = new BinaryStream($str);\n\n\t\t\twhile($stream->offset < $len){\n\t\t\t\t$buf = $stream->getString();\n\t\t\t\tif(($pk = $this->getPacket(ord($buf{0}))) !== null){\n\t\t\t\t\tif($pk::NETWORK_ID === Info::BATCH_PACKET){\n\t\t\t\t\t\tthrow new \\InvalidStateException(\"Invalid BatchPacket inside BatchPacket\");\n\t\t\t\t\t}\n\n\t\t\t\t\t$pk->setBuffer($buf, 1);\n\n\t\t\t\t\t$pk->decode();\n\t\t\t\t\tassert($pk->feof(), \"Still \" . strlen(substr($pk->buffer, $pk->offset)) . \" bytes unread in \" . get_class($pk));\n\t\t\t\t\t$p->handleDataPacket($pk);\n\t\t\t\t}\n\t\t\t}\n\t\t}catch(\\Throwable $e){\n\t\t\tif(\\pocketmine\\DEBUG > 1){\n\t\t\t\t$logger = $this->server->getLogger();\n\t\t\t\tif($logger instanceof MainLogger){\n\t\t\t\t\t$logger->debug(\"BatchPacket \" . \" 0x\" . bin2hex($packet->payload));\n\t\t\t\t\t$logger->logException($e);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param $id\n\t *\n\t * @return DataPacket\n\t */\n\tpublic function getPacket($id) {\n\t\t/** @var DataPacket $class */\n\t\t$class = $this->packetPool[$id];\n\t\tif ($class !== null) {\n\t\t\treturn clone $class;\n\t\t}\n\t\treturn null;\n\t}\n\n\n\t/**\n\t * @param string $address\n\t * @param int    $port\n\t * @param string $payload\n\t */\n\tpublic function sendPacket($address, $port, $payload) {\n\t\tforeach ($this->advancedInterfaces as $interface) {\n\t\t\t$interface->sendRawPacket($address, $port, $payload);\n\t\t}\n\t}\n\n\t/**\n\t * Blocks an IP address from the main interface. Setting timeout to -1 will block it forever\n\t *\n\t * @param string $address\n\t * @param int    $timeout\n\t */\n\tpublic function blockAddress($address, $timeout = 300) {\n\t\tforeach ($this->advancedInterfaces as $interface) {\n\t\t\t$interface->blockAddress($address, $timeout);\n\t\t}\n\t}\n\n\t/**\n\t * Unblocks an IP address from the main interface.\n\t *\n\t * @param string $address\n\t */\n\tpublic function unblockAddress($address) {\n\t\tforeach ($this->advancedInterfaces as $interface) {\n\t\t\t$interface->unblockAddress($address);\n\t\t}\n\t}\n\n\tprivate function registerPackets() {\n\t\t$this->packetPool = new \\SplFixedArray(256);\n\n\t\t$this->registerPacket(ProtocolInfo::ADD_ENTITY_PACKET, AddEntityPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ADD_HANGING_ENTITY_PACKET, AddHangingEntityPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ADD_ITEM_ENTITY_PACKET, AddItemEntityPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ADD_ITEM_PACKET, AddItemPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ADD_PAINTING_PACKET, AddPaintingPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ADD_PLAYER_PACKET, AddPlayerPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ADVENTURE_SETTINGS_PACKET, AdventureSettingsPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ANIMATE_PACKET, AnimatePacket::class);\n\t\t$this->registerPacket(ProtocolInfo::AVAILABLE_COMMANDS_PACKET, AvailableCommandsPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::BATCH_PACKET, BatchPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::BLOCK_ENTITY_DATA_PACKET, BlockEntityDataPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::BLOCK_EVENT_PACKET, BlockEventPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::BOSS_EVENT_PACKET, BossEventPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CHANGE_DIMENSION_PACKET, ChangeDimensionPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CHUNK_RADIUS_UPDATED_PACKET, ChunkRadiusUpdatedPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::COMMAND_STEP_PACKET, CommandStepPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CONTAINER_CLOSE_PACKET, ContainerClosePacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CONTAINER_OPEN_PACKET, ContainerOpenPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CONTAINER_SET_CONTENT_PACKET, ContainerSetContentPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CONTAINER_SET_DATA_PACKET, ContainerSetDataPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CONTAINER_SET_SLOT_PACKET, ContainerSetSlotPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CRAFTING_DATA_PACKET, CraftingDataPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::CRAFTING_EVENT_PACKET, CraftingEventPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::DISCONNECT_PACKET, DisconnectPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::DROP_ITEM_PACKET, DropItemPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ENTITY_EVENT_PACKET, EntityEventPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::EXPLODE_PACKET, ExplodePacket::class);\n\t\t$this->registerPacket(ProtocolInfo::FULL_CHUNK_DATA_PACKET, FullChunkDataPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::HURT_ARMOR_PACKET, HurtArmorPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::INTERACT_PACKET, InteractPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::INVENTORY_ACTION_PACKET, InventoryActionPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::ITEM_FRAME_DROP_ITEM_PACKET, ItemFrameDropItemPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::LEVEL_EVENT_PACKET, LevelEventPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::LEVEL_SOUND_EVENT_PACKET, LevelSoundEventPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::LOGIN_PACKET, LoginPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::MOB_ARMOR_EQUIPMENT_PACKET, MobArmorEquipmentPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::MOB_EQUIPMENT_PACKET, MobEquipmentPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::MOVE_ENTITY_PACKET, MoveEntityPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::MOVE_PLAYER_PACKET, MovePlayerPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::PLAYER_ACTION_PACKET, PlayerActionPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::PLAYER_FALL_PACKET, PlayerFallPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::PLAYER_INPUT_PACKET, PlayerInputPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::PLAYER_LIST_PACKET, PlayerListPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::PLAY_STATUS_PACKET, PlayStatusPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::REMOVE_BLOCK_PACKET, RemoveBlockPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::REMOVE_ENTITY_PACKET, RemoveEntityPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::REPLACE_ITEM_IN_SLOT_PACKET, ReplaceItemInSlotPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::REQUEST_CHUNK_RADIUS_PACKET, RequestChunkRadiusPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::RESOURCE_PACK_CLIENT_RESPONSE_PACKET, ResourcePackClientResponsePacket::class);\n\t\t$this->registerPacket(ProtocolInfo::RESOURCE_PACKS_INFO_PACKET, ResourcePacksInfoPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::RESPAWN_PACKET, RespawnPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_COMMANDS_ENABLED_PACKET, SetCommandsEnabledPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_DIFFICULTY_PACKET, SetDifficultyPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_ENTITY_DATA_PACKET, SetEntityDataPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_ENTITY_LINK_PACKET, SetEntityLinkPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_ENTITY_MOTION_PACKET, SetEntityMotionPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_HEALTH_PACKET, SetHealthPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_PLAYER_GAME_TYPE_PACKET, SetPlayerGameTypePacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_SPAWN_POSITION_PACKET, SetSpawnPositionPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SET_TIME_PACKET, SetTimePacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SHOW_CREDITS_PACKET, ShowCreditsPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::SPAWN_EXPERIENCE_ORB_PACKET, SpawnExperienceOrbPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::START_GAME_PACKET, StartGamePacket::class);\n\t\t$this->registerPacket(ProtocolInfo::TAKE_ITEM_ENTITY_PACKET, TakeItemEntityPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::TEXT_PACKET, TextPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::TRANSFER_PACKET, TransferPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::UPDATE_BLOCK_PACKET, UpdateBlockPacket::class);\n\t\t$this->registerPacket(ProtocolInfo::USE_ITEM_PACKET, UseItemPacket::class);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/RakLibInterface.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\network;\n\nuse pocketmine\\event\\player\\PlayerCreationEvent;\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\network\\protocol\\Info as ProtocolInfo;\nuse pocketmine\\network\\protocol\\Info;\nuse pocketmine\\Player;\nuse pocketmine\\Server;\nuse raklib\\protocol\\EncapsulatedPacket;\nuse raklib\\RakLib;\nuse raklib\\server\\RakLibServer;\nuse raklib\\server\\ServerHandler;\nuse raklib\\server\\ServerInstance;\n\nclass RakLibInterface implements ServerInstance, AdvancedSourceInterface{\n\n\t/** @var Server */\n\tprivate $server;\n\n\t/** @var Network */\n\tprivate $network;\n\n\t/** @var RakLibServer */\n\tprivate $rakLib;\n\n\t/** @var Player[] */\n\tprivate $players = [];\n\n\t/** @var string[] */\n\tprivate $identifiers;\n\n\t/** @var int[] */\n\tprivate $identifiersACK = [];\n\n\t/** @var ServerHandler */\n\tprivate $interface;\n\n\tpublic function __construct(Server $server){\n\n\t\t$this->server = $server;\n\t\t$this->identifiers = [];\n\n\t\t$this->rakLib = new RakLibServer($this->server->getLogger(), $this->server->getLoader(), $this->server->getPort(), $this->server->getIp() === \"\" ? \"0.0.0.0\" : $this->server->getIp());\n\t\t$this->interface = new ServerHandler($this->rakLib, $this);\n\t}\n\n\tpublic function setNetwork(Network $network){\n\t\t$this->network = $network;\n\t}\n\n\tpublic function process(){\n\t\t$work = false;\n\t\tif($this->interface->handlePacket()){\n\t\t\t$work = true;\n\t\t\t$lasttime = time();\n\t\t\twhile($this->interface->handlePacket()){\n\t\t\t\t$diff = time() - $lasttime;\n\t\t\t\tif($diff >= 1) break;\n\t\t\t}\n\t\t}\n\n\t\tif($this->rakLib->isTerminated()){\n\t\t\t$this->network->unregisterInterface($this);\n\n\t\t\tthrow new \\Exception(\"RakLib Thread crashed\");\n\t\t}\n\n\t\treturn $work;\n\t}\n\n\tpublic function closeSession($identifier, $reason){\n\t\tif(isset($this->players[$identifier])){\n\t\t\t$player = $this->players[$identifier];\n\t\t\tunset($this->identifiers[spl_object_hash($player)]);\n\t\t\tunset($this->players[$identifier]);\n\t\t\tunset($this->identifiersACK[$identifier]);\n\t\t\t$player->close($player->getLeaveMessage(), $reason);\n\t\t}\n\t}\n\n\tpublic function close(Player $player, $reason = \"unknown reason\"){\n\t\tif(isset($this->identifiers[$h = spl_object_hash($player)])){\n\t\t\tunset($this->players[$this->identifiers[$h]]);\n\t\t\tunset($this->identifiersACK[$this->identifiers[$h]]);\n\t\t\t$this->interface->closeSession($this->identifiers[$h], $reason);\n\t\t\tunset($this->identifiers[$h]);\n\t\t}\n\t}\n\n\tpublic function shutdown(){\n\t\t$this->interface->shutdown();\n\t}\n\n\tpublic function emergencyShutdown(){\n\t\t$this->interface->emergencyShutdown();\n\t}\n\n\tpublic function openSession($identifier, $address, $port, $clientID){\n\t\t$ev = new PlayerCreationEvent($this, Player::class, Player::class, null, $address, $port);\n\t\t$this->server->getPluginManager()->callEvent($ev);\n\t\t$class = $ev->getPlayerClass();\n\n\t\t$player = new $class($this, $ev->getClientId(), $ev->getAddress(), $ev->getPort());\n\t\t$this->players[$identifier] = $player;\n\t\t$this->identifiersACK[$identifier] = 0;\n\t\t$this->identifiers[spl_object_hash($player)] = $identifier;\n\t\t$this->server->addPlayer($identifier, $player);\n\t}\n\n\tpublic function handleEncapsulated($identifier, EncapsulatedPacket $packet, $flags){\n\t\tif(isset($this->players[$identifier])){\n\t\t\ttry{\n\t\t\t\tif($packet->buffer !== \"\"){\n\t\t\t\t\t$pk = $this->getPacket($packet->buffer);\n\t\t\t\t\tif($pk !== null){\n\t\t\t\t\t\t$pk->decode();\n\t\t\t\t\t\tassert($pk->feof(), \"Still \" . strlen(substr($pk->buffer, $pk->offset)) . \" bytes unread!\");\n\t\t\t\t\t\t$this->players[$identifier]->handleDataPacket($pk);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$logger = $this->server->getLogger();\n\t\t\t\tif(\\pocketmine\\DEBUG > 1 and isset($pk)){\n\t\t\t\t\t$logger->debug(\"Exception in packet \" . get_class($pk) . \" 0x\" . bin2hex($packet->buffer));\n\t\t\t\t}\n\t\t\t\t$logger->logException($e);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function blockAddress($address, $timeout = 300){\n\t\t$this->interface->blockAddress($address, $timeout);\n\t}\n\t\n\tpublic function unblockAddress($address){\n\t\t$this->interface->unblockAddress($address);\n\t}\n\n\tpublic function handleRaw($address, $port, $payload){\n\t\t$this->server->handlePacket($address, $port, $payload);\n\t}\n\n\tpublic function sendRawPacket($address, $port, $payload){\n\t\t$this->interface->sendRaw($address, $port, $payload);\n\t}\n\n\tpublic function notifyACK($identifier, $identifierACK){\n\n\t}\n\n\tpublic function setName($name){\n\n\t\tif($this->server->isDServerEnabled()){\n\t\t\tif($this->server->dserverConfig[\"motdMaxPlayers\"] > 0) $pc = $this->server->dserverConfig[\"motdMaxPlayers\"];\n\t\t\telseif($this->server->dserverConfig[\"motdAllPlayers\"]) $pc = $this->server->getDServerMaxPlayers();\n\t\t\telse $pc = $this->server->getMaxPlayers();\n\n\t\t\tif($this->server->dserverConfig[\"motdPlayers\"]) $poc = $this->server->getDServerOnlinePlayers();\n\t\t\telse $poc = count($this->server->getOnlinePlayers());\n\t\t}else{\n\t\t\t$info = $this->server->getQueryInformation();\n\t\t\t$pc = $info->getMaxPlayerCount();\n\t\t\t$poc = $info->getPlayerCount();\n\t\t}\n\n\t\t$this->interface->sendOption(\"name\",\n\t\t\t\"MCPE;\" . rtrim(addcslashes($name, \";\"), '\\\\') . \";\" .\n\t\t\tInfo::CURRENT_PROTOCOL . \";\" .\n\t\t\tInfo::MINECRAFT_VERSION_NETWORK . \";\" .\n\t\t\t$poc . \";\" .\n\t\t\t$pc\n\t\t);\n\t}\n\n\tpublic function setPortCheck($name){\n\t\t$this->interface->sendOption(\"portChecking\", (bool) $name);\n\t}\n\n\tpublic function handleOption($name, $value){\n\t\tif($name === \"bandwidth\"){\n\t\t\t$v = unserialize($value);\n\t\t\t$this->network->addStatistics($v[\"up\"], $v[\"down\"]);\n\t\t}\n\t}\n\n\tpublic function putPacket(Player $player, DataPacket $packet, $needACK = false, $immediate = false){\n\t\tif(isset($this->identifiers[$h = spl_object_hash($player)])){\n\t\t\t$identifier = $this->identifiers[$h];\n\t\t\t$pk = null;\n\t\t\tif(!$packet->isEncoded){\n\t\t\t\t$packet->encode();\n\t\t\t}elseif(!$needACK){\n\t\t\t\tif(!isset($packet->__encapsulatedPacket)){\n\t\t\t\t\t$packet->__encapsulatedPacket = new CachedEncapsulatedPacket;\n\t\t\t\t\t$packet->__encapsulatedPacket->identifierACK = null;\n\t\t\t\t\t$packet->__encapsulatedPacket->buffer = chr(0xfe) . $packet->buffer;\n\t\t\t\t\t$packet->__encapsulatedPacket->reliability = 3;\n\t\t\t\t\t$packet->__encapsulatedPacket->orderChannel = 0;\n\t\t\t\t}\n\t\t\t\t$pk = $packet->__encapsulatedPacket;\n\t\t\t}\n\n\t\t\tif(!$immediate and !$needACK and $packet::NETWORK_ID !== ProtocolInfo::BATCH_PACKET\n\t\t\t\tand Network::$BATCH_THRESHOLD >= 0\n\t\t\t\tand strlen($packet->buffer) >= Network::$BATCH_THRESHOLD){\n\t\t\t\t$this->server->batchPackets([$player], [$packet], true);\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\tif($pk === null){\n\t\t\t\t$pk = new EncapsulatedPacket();\n\t\t\t\t$pk->buffer = chr(0xfe) . $packet->buffer;\n\t\t\t\t$packet->reliability = 3;\n\t\t\t\t$packet->orderChannel = 0;\n\n\t\t\t\tif($needACK === true){\n\t\t\t\t\t$pk->identifierACK = $this->identifiersACK[$identifier]++;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t$this->interface->sendEncapsulated($identifier, $pk, ($needACK === true ? RakLib::FLAG_NEED_ACK : 0) | ($immediate === true ? RakLib::PRIORITY_IMMEDIATE : RakLib::PRIORITY_NORMAL));\n\n\t\t\treturn $pk->identifierACK;\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate function getPacket($buffer){\n\t\t$pid = ord($buffer{0});\n\t\t$start = 1;\n\t\tif($pid == 0xfe){\n\t\t\t$pid = ord($buffer{1});\n\t\t\t$start++;\n\t\t}\n\t\tif(($data = $this->network->getPacket($pid)) === null){\n\t\t\treturn null;\n\t\t}\n\t\t$data->setBuffer($buffer, $start);\n\n\t\treturn $data;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/SourceInterface.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Network-related classes\n */\nnamespace pocketmine\\network;\n\nuse pocketmine\\network\\protocol\\DataPacket;\nuse pocketmine\\Player;\n\n/**\n * Classes that implement this interface will be able to be attached to players\n */\ninterface SourceInterface{\n\n\t/**\n\t * Sends a DataPacket to the interface, returns an unique identifier for the packet if $needACK is true\n\t *\n\t * @param Player     $player\n\t * @param DataPacket $packet\n\t * @param bool       $needACK\n\t * @param bool       $immediate\n\t *\n\t * @return int\n\t */\n\tpublic function putPacket(Player $player, DataPacket $packet, $needACK = false, $immediate = true);\n\n\t/**\n\t * Terminates the connection\n\t *\n\t * @param Player $player\n\t * @param string $reason\n\t *\n\t */\n\tpublic function close(Player $player, $reason = \"unknown reason\");\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function setName($name);\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function process();\n\n\tpublic function shutdown();\n\n\tpublic function emergencyShutdown();\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/AddEntityPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n#ifndef COMPILE\nuse pocketmine\\utils\\Binary;\n\n#endif\n\nclass AddEntityPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ADD_ENTITY_PACKET;\n\n\tpublic $eid;\n\tpublic $type;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $speedX;\n\tpublic $speedY;\n\tpublic $speedZ;\n\tpublic $yaw;\n\tpublic $pitch;\n\tpublic $modifiers;\n\tpublic $metadata = [];\n\tpublic $links = [];\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid); //EntityUniqueID - TODO: verify this\n\t\t$this->putEntityId($this->eid);\n\t\t$this->putUnsignedVarInt($this->type);\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);\n\t\t$this->putLFloat($this->pitch * (256 / 360));\n\t\t$this->putLFloat($this->yaw * (256 / 360));\n\t\t$this->putUnsignedVarInt($this->modifiers); //attributes?\n\t\t$meta = Binary::writeMetadata($this->metadata);\n\t\t$this->put($meta);\n\t\t$this->putUnsignedVarInt(count($this->links));\n\t\tforeach($this->links as $link){\n\t\t\t$this->putEntityId($link[0]);\n\t\t\t$this->putEntityId($link[1]);\n\t\t\t$this->putByte($link[2]);\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/AddHangingEntityPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass AddHangingEntityPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ADD_HANGING_ENTITY_PACKET;\n\n\tpublic $entityUniqueId;\n\tpublic $entityRuntimeId;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $unknown;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->entityUniqueId);\n\t\t$this->putEntityId($this->entityRuntimeId);\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->putVarInt($this->unknown);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/AddItemEntityPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass AddItemEntityPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ADD_ITEM_ENTITY_PACKET;\n\n\tpublic $eid;\n\tpublic $item;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $speedX;\n\tpublic $speedY;\n\tpublic $speedZ;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid); //EntityUniqueID\n\t\t$this->putEntityId($this->eid); //EntityRuntimeID\n\t\t$this->putSlot($this->item);\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/AddItemPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass AddItemPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ADD_ITEM_PACKET;\n\n\tpublic $item;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putSlot($this->item);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/AddPaintingPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass AddPaintingPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ADD_PAINTING_PACKET;\n\n\tpublic $eid;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $direction;\n\tpublic $title;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid); //EntityUniqueID\n\t\t$this->putEntityId($this->eid); //EntityRuntimeID\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->putVarInt($this->direction);\n\t\t$this->putString($this->title);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/AddPlayerPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n#ifndef COMPILE\nuse pocketmine\\utils\\Binary;\n\n#endif\n\nclass AddPlayerPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ADD_PLAYER_PACKET;\n\n\tpublic $uuid;\n\tpublic $username;\n\tpublic $eid;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $speedX;\n\tpublic $speedY;\n\tpublic $speedZ;\n\tpublic $pitch;\n\tpublic $headYaw;\n\tpublic $yaw;\n\tpublic $item;\n\tpublic $metadata = [];\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putUUID($this->uuid);\n\t\t$this->putString($this->username);\n\t\t$this->putEntityId($this->eid); //EntityUniqueID\n\t\t$this->putEntityId($this->eid); //EntityRuntimeID\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putVector3f($this->speedX, $this->speedY, $this->speedZ);\n\t\t$this->putLFloat($this->pitch);\n\t\t$this->putLFloat($this->headYaw ?? $this->yaw);\n\t\t$this->putLFloat($this->yaw);\n\t\t$this->putSlot($this->item);\n\t\t$meta = Binary::writeMetadata($this->metadata);\n\t\t$this->put($meta);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/AdventureSettingsPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass AdventureSettingsPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ADVENTURE_SETTINGS_PACKET;\n\n\tconst PERMISSION_NORMAL = 0;\n\tconst PERMISSION_OPERATOR = 1;\n\tconst PERMISSION_HOST = 2;\n\tconst PERMISSION_AUTOMATION = 3;\n\tconst PERMISSION_ADMIN = 4;\n\n\tpublic $worldImmutable;\n\tpublic $noPvp;\n\tpublic $noPvm;\n\tpublic $noMvp;\n\n\tpublic $autoJump;\n\tpublic $allowFlight;\n\tpublic $noClip;\n\tpublic $isFlying;\n\n\t/*\n\t bit mask | flag name\n\t0x00000001 world_immutable\n\t0x00000002 no_pvp\n\t0x00000004 no_pvm\n\t0x00000008 no_mvp\n\t0x00000010 ?\n\t0x00000020 auto_jump\n\t0x00000040 allow_fly\n\t0x00000080 noclip\n\t0x00000100 ?\n\t0x00000200 is_flying\n\t*/\n\n\tpublic $flags = 0;\n\tpublic $userPermission;\n\n\tpublic function decode(){\n\t\t$this->flags = $this->getUnsignedVarInt();\n\t\t$this->userPermission = $this->getUnsignedVarInt();\n\n\t\t$this->worldImmutable = (bool) ($this->flags & 1);\n\t\t$this->noPvp          = (bool) ($this->flags & (1 << 1));\n\t\t$this->noPvm          = (bool) ($this->flags & (1 << 2));\n\t\t$this->noMvp          = (bool) ($this->flags & (1 << 3));\n\n\t\t$this->autoJump       = (bool) ($this->flags & (1 << 5));\n\t\t$this->allowFlight    = (bool) ($this->flags & (1 << 6));\n\t\t$this->noClip         = (bool) ($this->flags & (1 << 7));\n\n\t\t$this->isFlying       = (bool) ($this->flags & (1 << 9));\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\n\t\t$this->flags |= ((int) $this->worldImmutable);\n\t\t$this->flags |= ((int) $this->noPvp)       << 1;\n\t\t$this->flags |= ((int) $this->noPvm)       << 2;\n\t\t$this->flags |= ((int) $this->noMvp)       << 3;\n\n\t\t$this->flags |= ((int) $this->autoJump)    << 5;\n\t\t$this->flags |= ((int) $this->allowFlight) << 6;\n\t\t$this->flags |= ((int) $this->noClip)      << 7;\n\n\t\t$this->flags |= ((int) $this->isFlying)    << 9;\n\n\t\t$this->putUnsignedVarInt($this->flags);\n\t\t$this->putUnsignedVarInt($this->userPermission);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/AnimatePacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass AnimatePacket extends DataPacket{\n\tconst NETWORK_ID = Info::ANIMATE_PACKET;\n\n\tpublic $action;\n\tpublic $eid;\n\n\tpublic function decode(){\n\t\t$this->action = $this->getVarInt();\n\t\t$this->eid = $this->getEntityId();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->action);\n\t\t$this->putEntityId($this->eid);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/AvailableCommandsPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass AvailableCommandsPacket extends DataPacket{\n\tconst NETWORK_ID = Info::AVAILABLE_COMMANDS_PACKET;\n\n\tpublic $commands; //JSON-encoded command data\n\tpublic $unknown;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putString($this->commands);\n\t\t$this->putString($this->unknown);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/BatchPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass BatchPacket extends DataPacket{\n\tconst NETWORK_ID = Info::BATCH_PACKET;\n\n\tpublic $payload;\n\n\tpublic function decode(){\n\t\t$this->payload = $this->getString();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putString($this->payload);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/BlockEntityDataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass BlockEntityDataPacket extends DataPacket{\n\tconst NETWORK_ID = Info::BLOCK_ENTITY_DATA_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $namedtag;\n\n\tpublic function decode(){\n\t\t$this->getBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->namedtag = $this->get(true);\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->put($this->namedtag);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/BlockEventPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass BlockEventPacket extends DataPacket{\n\tconst NETWORK_ID = Info::BLOCK_EVENT_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $case1;\n\tpublic $case2;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->putVarInt($this->case1);\n\t\t$this->putVarInt($this->case2);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/BossEventPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\nuse pocketmine\\utils\\Binary;\n\nclass BossEventPacket extends DataPacket{\n\tconst NETWORK_ID = Info::BOSS_EVENT_PACKET;\n  \tpublic $eid;\n\tpublic $type;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->eid);\n\t\t$this->putUnsignedVarInt($this->type);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/CameraPacket.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\n#include <rules/DataPacket.h>\nnamespace pocketmine\\network\\protocol;\n\nclass CameraPacket extends DataPacket{\n\t\n\tconst NETWORK_ID = Info::CAMERA_PACKET;\n\tpublic $eid;\n\t\n\tpublic function decode(){\n\t}\n\t\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->eid);\n\t\t$this->putVarInt($this->eid);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ChangeDimensionPacket.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass ChangeDimensionPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CHANGE_DIMENSION_PACKET;\n\n\tconst DIMENSION_NORMAL = 0;\n\tconst DIMENSION_NETHER = 1;\n\n\tpublic $dimension;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $unknown; //bool\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->dimension);\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putBool($this->unknown);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ChunkRadiusUpdatedPacket.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\network\\protocol;\n\n\nclass ChunkRadiusUpdatedPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CHUNK_RADIUS_UPDATED_PACKET;\n\n\tpublic $radius;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->radius);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/CommandStepPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass CommandStepPacket extends DataPacket{\n\tconst NETWORK_ID = Info::COMMAND_STEP_PACKET;\n\n\t/**\n\t * unknown (string)\n\t * unknown (string)\n\t * unknown (uvarint)\n\t * unknown (uvarint)\n\t * unknown (bool)\n\t * unknown (uvarint64)\n\t * unknown (string)\n\t * unknown (string)\n\t * https://gist.github.com/dktapps/8285b93af4ca38e0104bfeb9a6c87afd\n\t */\n\n\tpublic $command;\n\tpublic $overload;\n\tpublic $uvarint1;\n\tpublic $uvarint2;\n\tpublic $bool;\n\tpublic $uvarint64;\n\tpublic $args; //JSON formatted command arguments\n\tpublic $string4;\n\n\tpublic function decode(){\n\t\t$this->command = $this->getString();\n\t\t$this->overload = $this->getString();\n\t\t$this->uvarint1 = $this->getUnsignedVarInt();\n\t\t$this->uvarint2 = $this->getUnsignedVarInt();\n\t\t$this->bool = (bool) $this->getByte();\n\t\t$this->uvarint64 = $this->getUnsignedVarInt(); //TODO: varint64\n\t\t$this->args = json_decode($this->getString());\n\t\t$this->string4 = $this->getString();\n\t\twhile(!$this->feof()){\n\t\t\t$this->getByte(); //prevent assertion errors. TODO: find out why there are always 3 extra bytes at the end of this packet.\n\t\t}\n\t}\n\n\tpublic function encode(){\n\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ContainerClosePacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ContainerClosePacket extends DataPacket{\n\tconst NETWORK_ID = Info::CONTAINER_CLOSE_PACKET;\n\n\tpublic $windowid;\n\n\tpublic function decode(){\n\t\t$this->windowid = $this->getByte();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->windowid);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ContainerOpenPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ContainerOpenPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CONTAINER_OPEN_PACKET;\n\n\tpublic $windowid;\n\tpublic $type;\n\tpublic $slots;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $entityId = -1;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->windowid);\n\t\t$this->putByte($this->type);\n\t\t$this->putVarInt($this->slots);\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->putEntityId($this->entityId);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ContainerSetContentPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ContainerSetContentPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CONTAINER_SET_CONTENT_PACKET;\n\n\tconst SPECIAL_INVENTORY = 0;\n\tconst SPECIAL_ARMOR = 0x78;\n\tconst SPECIAL_CREATIVE = 0x79;\n\tconst SPECIAL_HOTBAR = 0x7a;\n\n\tpublic $windowid;\n\tpublic $slots = [];\n\tpublic $hotbar = [];\n\n\tpublic function clean(){\n\t\t$this->slots = [];\n\t\t$this->hotbar = [];\n\t\treturn parent::clean();\n\t}\n\n\tpublic function decode(){\n\t\t$this->windowid = $this->getByte();\n\t\t$count = $this->getUnsignedVarInt();\n\t\tfor($s = 0; $s < $count and !$this->feof(); ++$s){\n\t\t\t$this->slots[$s] = $this->getSlot();\n\t\t}\n\t\tif($this->windowid === self::SPECIAL_INVENTORY){\n\t\t\t$count = $this->getUnsignedVarInt();\n\t\t\tfor($s = 0; $s < $count and !$this->feof(); ++$s){\n\t\t\t\t$this->hotbar[$s] = $this->getVarInt();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->windowid);\n\t\t$this->putUnsignedVarInt(count($this->slots));\n\t\tforeach($this->slots as $slot){\n\t\t\t$this->putSlot($slot);\n\t\t}\n\t\tif($this->windowid === self::SPECIAL_INVENTORY and count($this->hotbar) > 0){\n\t\t\t$this->putUnsignedVarInt(count($this->hotbar));\n\t\t\tforeach($this->hotbar as $slot){\n\t\t\t\t$this->putVarInt($slot);\n\t\t\t}\n\t\t}else{\n\t\t\t$this->putUnsignedVarInt(0);\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ContainerSetDataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ContainerSetDataPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CONTAINER_SET_DATA_PACKET;\n\n\tpublic $windowid;\n\tpublic $property;\n\tpublic $value;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->windowid);\n\t\t$this->putVarInt($this->property);\n\t\t$this->putVarInt($this->value);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ContainerSetSlotPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nuse pocketmine\\item\\Item;\n\nclass ContainerSetSlotPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CONTAINER_SET_SLOT_PACKET;\n\n\tpublic $windowid;\n\tpublic $slot;\n\t/** @var Item */\n\tpublic $item;\n\tpublic $hotbarSlot;\n\tpublic $unknown;\n\n\tpublic function decode(){\n\t\t$this->windowid = $this->getByte();\n\t\t$this->slot = $this->getVarInt();\n\t\t$this->hotbarSlot = $this->getVarInt();\n\t\t$this->item = $this->getSlot();\n\t\t$this->unknown = $this->getByte();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->windowid);\n\t\t$this->putVarInt($this->slot);\n\t\t$this->putVarInt($this->hotbarSlot);\n\t\t$this->putSlot($this->item);\n\t\t$this->putByte($this->unknown);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/CraftingDataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nuse pocketmine\\inventory\\FurnaceRecipe;\nuse pocketmine\\inventory\\ShapedRecipe;\nuse pocketmine\\inventory\\ShapelessRecipe;\nuse pocketmine\\item\\Item;\nuse pocketmine\\utils\\BinaryStream;\n\nclass CraftingDataPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CRAFTING_DATA_PACKET;\n\n\tconst ENTRY_SHAPELESS = 0;\n\tconst ENTRY_SHAPED = 1;\n\tconst ENTRY_FURNACE = 2;\n\tconst ENTRY_FURNACE_DATA = 3;\n\tconst ENTRY_MULTI = 4;\n\n\t/** @var object[] */\n\tpublic $entries = [];\n\tpublic $cleanRecipes = false;\n\n\tpublic function clean(){\n\t\t$this->entries = [];\n\t\treturn parent::clean();\n\t}\n\n\tpublic function decode(){\n\t\t$entries = [];\n\t\t$recipeCount = $this->getUnsignedVarInt();\n\t\tfor($i = 0; $i < $recipeCount; ++$i){\n\t\t\t$entry = [];\n\t\t\t$entry[\"type\"] = $recipeType = $this->getVarInt();\n\n\t\t\tswitch($recipeType){\n\t\t\t\tcase self::ENTRY_SHAPELESS:\n\t\t\t\t\t$ingredientCount = $this->getUnsignedVarInt();\n\t\t\t\t\t/** @var Item */\n\t\t\t\t\t$entry[\"input\"] = [];\n\t\t\t\t\tfor($j = 0; $j < $ingredientCount; ++$j){\n\t\t\t\t\t\t$entry[\"input\"][] = $this->getSlot();\n\t\t\t\t\t}\n\t\t\t\t\t$resultCount = $this->getUnsignedVarInt();\n\t\t\t\t\t$entry[\"output\"] = [];\n\t\t\t\t\tfor($k = 0; $k < $resultCount; ++$k){\n\t\t\t\t\t\t$entry[\"output\"][] = $this->getSlot();\n\t\t\t\t\t}\n\t\t\t\t\t$entry[\"uuid\"] = $this->getUUID()->toString();\n\n\t\t\t\t\tbreak;\n\t\t\t\tcase self::ENTRY_SHAPED:\n\t\t\t\t\t$entry[\"width\"] = $this->getVarInt();\n\t\t\t\t\t$entry[\"height\"] = $this->getVarInt();\n\t\t\t\t\t$count = $entry[\"width\"] * $entry[\"height\"];\n\t\t\t\t\t$entry[\"input\"] = [];\n\t\t\t\t\tfor($j = 0; $j < $count; ++$j){\n\t\t\t\t\t\t$entry[\"input\"][] = $this->getSlot();\n\t\t\t\t\t}\n\t\t\t\t\t$resultCount = $this->getUnsignedVarInt();\n\t\t\t\t\t$entry[\"output\"] = [];\n\t\t\t\t\tfor($k = 0; $k < $resultCount; ++$k){\n\t\t\t\t\t\t$entry[\"output\"][] = $this->getSlot();\n\t\t\t\t\t}\n\t\t\t\t\t$entry[\"uuid\"] = $this->getUUID()->toString();\n\t\t\t\t\tbreak;\n\t\t\t\tcase self::ENTRY_FURNACE:\n\t\t\t\tcase self::ENTRY_FURNACE_DATA:\n\t\t\t\t\t$entry[\"inputId\"] = $this->getVarInt();\n\t\t\t\t\tif($recipeType === self::ENTRY_FURNACE_DATA){\n\t\t\t\t\t\t$entry[\"inputDamage\"] = $this->getVarInt();\n\t\t\t\t\t}\n\t\t\t\t\t$entry[\"output\"] = $this->getSlot();\n\t\t\t\t\tbreak;\n\t\t\t\tcase self::ENTRY_MULTI:\n\t\t\t\t\t$entry[\"uuid\"] = $this->getUUID()->toString();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tthrow new \\UnexpectedValueException(\"Unhandled recipe type $recipeType!\"); //do not continue attempting to decode\n\t\t\t}\n\t\t\t$entries[] = $entry;\n\t\t}\n\t\t$this->getBool(); //cleanRecipes\n\t}\n\n\tprivate static function writeEntry($entry, BinaryStream $stream){\n\t\tif($entry instanceof ShapelessRecipe){\n\t\t\treturn self::writeShapelessRecipe($entry, $stream);\n\t\t}elseif($entry instanceof ShapedRecipe){\n\t\t\treturn self::writeShapedRecipe($entry, $stream);\n\t\t}elseif($entry instanceof FurnaceRecipe){\n\t\t\treturn self::writeFurnaceRecipe($entry, $stream);\n\t\t}\n\t\t//TODO: add MultiRecipe\n\n\t\treturn -1;\n\t}\n\n\tprivate static function writeShapelessRecipe(ShapelessRecipe $recipe, BinaryStream $stream){\n\t\t$stream->putUnsignedVarInt($recipe->getIngredientCount());\n\t\tforeach($recipe->getIngredientList() as $item){\n\t\t\t$stream->putSlot($item);\n\t\t}\n\n\t\t$stream->putUnsignedVarInt(1);\n\t\t$stream->putSlot($recipe->getResult());\n\n\t\t$stream->putUUID($recipe->getId());\n\n\t\treturn CraftingDataPacket::ENTRY_SHAPELESS;\n\t}\n\n\tprivate static function writeShapedRecipe(ShapedRecipe $recipe, BinaryStream $stream){\n\t\t$stream->putVarInt($recipe->getWidth());\n\t\t$stream->putVarInt($recipe->getHeight());\n\n\t\tfor($z = 0; $z < $recipe->getHeight(); ++$z){\n\t\t\tfor($x = 0; $x < $recipe->getWidth(); ++$x){\n\t\t\t\t$stream->putSlot($recipe->getIngredient($x, $z));\n\t\t\t}\n\t\t}\n\n\t\t$stream->putUnsignedVarInt(1);\n\t\t$stream->putSlot($recipe->getResult());\n\n\t\t$stream->putUUID($recipe->getId());\n\n\t\treturn CraftingDataPacket::ENTRY_SHAPED;\n\t}\n\n\tprivate static function writeFurnaceRecipe(FurnaceRecipe $recipe, BinaryStream $stream){\n\t\tif(!$recipe->getInput()->hasAnyDamageValue()){ //Data recipe\n\t\t\t$stream->putVarInt($recipe->getInput()->getId());\n\t\t\t$stream->putVarInt($recipe->getInput()->getDamage());\n\t\t\t$stream->putSlot($recipe->getResult());\n\n\t\t\treturn CraftingDataPacket::ENTRY_FURNACE_DATA;\n\t\t}else{\n\t\t\t$stream->putVarInt($recipe->getInput()->getId());\n\t\t\t$stream->putSlot($recipe->getResult());\n\n\t\t\treturn CraftingDataPacket::ENTRY_FURNACE;\n\t\t}\n\t}\n\n\tpublic function addShapelessRecipe(ShapelessRecipe $recipe){\n\t\t$this->entries[] = $recipe;\n\t}\n\n\tpublic function addShapedRecipe(ShapedRecipe $recipe){\n\t\t$this->entries[] = $recipe;\n\t}\n\n\tpublic function addFurnaceRecipe(FurnaceRecipe $recipe){\n\t\t$this->entries[] = $recipe;\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putUnsignedVarInt(count($this->entries));\n\n\t\t$writer = new BinaryStream();\n\t\tforeach($this->entries as $d){\n\t\t\t$entryType = self::writeEntry($d, $writer);\n\t\t\tif($entryType >= 0){\n\t\t\t\t$this->putVarInt($entryType);\n\t\t\t\t$this->put($writer->getBuffer());\n\t\t\t}else{\n\t\t\t\t$this->putVarInt(-1);\n\t\t\t}\n\n\t\t\t$writer->reset();\n\t\t}\n\n\t\t$this->putBool($this->cleanRecipes);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/CraftingEventPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass CraftingEventPacket extends DataPacket{\n\tconst NETWORK_ID = Info::CRAFTING_EVENT_PACKET;\n\n\tpublic $windowId;\n\tpublic $type;\n\tpublic $id;\n\tpublic $input = [];\n\tpublic $output = [];\n\n\tpublic function clean(){\n\t\t$this->input = [];\n\t\t$this->output = [];\n\t\treturn parent::clean();\n\t}\n\n\tpublic function decode(){\n\t\t$this->windowId = $this->getByte();\n\t\t$this->type = $this->getVarInt();\n\t\t$this->id = $this->getUUID();\n\n\t\t$size = $this->getUnsignedVarInt();\n\t\tfor($i = 0; $i < $size and $i < 128; ++$i){\n\t\t\t$this->input[] = $this->getSlot();\n\t\t}\n\n\t\t$size = $this->getUnsignedVarInt();\n\t\tfor($i = 0; $i < $size and $i < 128; ++$i){\n\t\t\t$this->output[] = $this->getSlot();\n\t\t}\n\t}\n\n\tpublic function encode(){\n\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n#ifndef COMPILE\n\n#endif\n\n\nuse pocketmine\\utils\\BinaryStream;\nuse pocketmine\\utils\\Utils;\n\n\nabstract class DataPacket extends BinaryStream{\n\n\tconst NETWORK_ID = 0;\n\n\tpublic $isEncoded = false;\n\n\tpublic function pid(){\n\t\treturn $this::NETWORK_ID;\n\t}\n\n\tabstract public function encode();\n\n\tabstract public function decode();\n\n\tpublic function reset(){\n\t\t$this->buffer = chr($this::NETWORK_ID);\n\t\t$this->offset = 0;\n\t}\n\n\tpublic function clean(){\n\t\t$this->buffer = null;\n\t\t$this->isEncoded = false;\n\t\t$this->offset = 0;\n\t\treturn $this;\n\t}\n\n\tpublic function __debugInfo(){\n\t\t$data = [];\n\t\tforeach($this as $k => $v){\n\t\t\tif($k === \"buffer\"){\n\t\t\t\t$data[$k] = bin2hex($v);\n\t\t\t}elseif(is_string($v) or (is_object($v) and method_exists($v, \"__toString\"))){\n\t\t\t\t$data[$k] = Utils::printable((string) $v);\n\t\t\t}else{\n\t\t\t\t$data[$k] = $v;\n\t\t\t}\n\t\t}\n\n\t\treturn $data;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/DisconnectPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass DisconnectPacket extends DataPacket{\n\tconst NETWORK_ID = Info::DISCONNECT_PACKET;\n\n\tpublic $hideDisconnectionScreen = false;\n\tpublic $message;\n\n\tpublic function decode(){\n\t\t$this->hideDisconnectionScreen = $this->getBool();\n\t\t$this->message = $this->getString();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putBool($this->hideDisconnectionScreen);\n\t\t$this->putString($this->message);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/DropItemPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass DropItemPacket extends DataPacket{\n\tconst NETWORK_ID = Info::DROP_ITEM_PACKET;\n\n\tpublic $type;\n\tpublic $item;\n\n\tpublic function decode(){\n\t\t$this->type = $this->getByte();\n\t\t$this->item = $this->getSlot();\n\t}\n\n\tpublic function encode(){\n\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/EntityEventPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass EntityEventPacket extends DataPacket{\n\tconst NETWORK_ID = Info::ENTITY_EVENT_PACKET;\n\n\tconst HURT_ANIMATION = 2;\n\tconst DEATH_ANIMATION = 3;\n\n\tconst TAME_FAIL = 6;\n\tconst TAME_SUCCESS = 7;\n\tconst SHAKE_WET = 8;\n\tconst USE_ITEM = 9;\n\tconst EAT_GRASS_ANIMATION = 10;\n\tconst FISH_HOOK_BUBBLE = 11;\n\tconst FISH_HOOK_POSITION = 12;\n\tconst FISH_HOOK_HOOK = 13;\n\tconst FISH_HOOK_TEASE = 14;\n\tconst SQUID_INK_CLOUD = 15;\n\tconst AMBIENT_SOUND = 16;\n\tconst RESPAWN = 17;\n\n\t//TODO add new events\n\n\tpublic $eid;\n\tpublic $event;\n\tpublic $unknown;\n\n\tpublic function decode(){\n\t\t$this->eid = $this->getEntityId();\n\t\t$this->event = $this->getByte();\n\t\t$this->unknown = $this->getVarInt();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t\t$this->putByte($this->event);\n\t\t$this->putVarInt($this->unknown);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/ExplodePacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ExplodePacket extends DataPacket{\n\tconst NETWORK_ID = Info::EXPLODE_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $radius;\n\tpublic $records = [];\n\n\tpublic function clean(){\n\t\t$this->records = [];\n\t\treturn parent::clean();\n\t}\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putLFloat($this->radius);\n\t\t$this->putUnsignedVarInt(count($this->records));\n\t\tif(count($this->records) > 0){\n\t\t\tforeach($this->records as $record){\n\t\t\t\t$this->putBlockCoords($record->x, $record->y, $record->z);\n\t\t\t}\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/FullChunkDataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass FullChunkDataPacket extends DataPacket{\n\tconst NETWORK_ID = Info::FULL_CHUNK_DATA_PACKET;\n\n\tpublic $chunkX;\n\tpublic $chunkZ;\n\tpublic $data;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->chunkX);\n\t\t$this->putVarInt($this->chunkZ);\n\t\t$this->putString($this->data);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/HurtArmorPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass HurtArmorPacket extends DataPacket{\n\tconst NETWORK_ID = Info::HURT_ARMOR_PACKET;\n\n\tpublic $health;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->health);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/Info.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Minecraft: PE multiplayer protocol implementation\n */\nnamespace pocketmine\\network\\protocol;\n\n\ninterface Info{\n\n\t/**\n\t * Actual Minecraft: PE protocol version\n\t */\n\tconst CURRENT_PROTOCOL = 102;\n\tconst MINECRAFT_VERSION = \"v1.0.4.1\";\n\tconst MINECRAFT_VERSION_NETWORK = \"1.0.4.1\";\n\n\tconst LOGIN_PACKET = 0x01;\n\tconst PLAY_STATUS_PACKET = 0x02;\n\tconst SERVER_TO_CLIENT_HANDSHAKE_PACKET = 0x03;\n\tconst CLIENT_TO_SERVER_HANDSHAKE_PACKET = 0x04;\n\tconst DISCONNECT_PACKET = 0x05;\n\tconst BATCH_PACKET = 0x06;\n\tconst RESOURCE_PACKS_INFO_PACKET = 0x07;\n\tconst RESOURCE_PACK_STACK_PACKET = 0x08; //ResourcePacksStackPacket\n\tconst RESOURCE_PACK_CLIENT_RESPONSE_PACKET = 0x09;\n\tconst TEXT_PACKET = 0x0a;\n\tconst SET_TIME_PACKET = 0x0b;\n\tconst START_GAME_PACKET = 0x0c;\n\tconst ADD_PLAYER_PACKET = 0x0d;\n\tconst ADD_ENTITY_PACKET = 0x0e;\n\tconst REMOVE_ENTITY_PACKET = 0x0f;\n\tconst ADD_ITEM_ENTITY_PACKET = 0x10;\n\tconst ADD_HANGING_ENTITY_PACKET = 0x11;\n\tconst TAKE_ITEM_ENTITY_PACKET = 0x12;\n\tconst MOVE_ENTITY_PACKET = 0x13;\n\tconst MOVE_PLAYER_PACKET = 0x14;\n\tconst RIDER_JUMP_PACKET = 0x15;\n\tconst REMOVE_BLOCK_PACKET = 0x16;\n\tconst UPDATE_BLOCK_PACKET = 0x17;\n\tconst ADD_PAINTING_PACKET = 0x18;\n\tconst EXPLODE_PACKET = 0x19;\n\tconst LEVEL_SOUND_EVENT_PACKET = 0x1a;\n\tconst LEVEL_EVENT_PACKET = 0x1b;\n\tconst BLOCK_EVENT_PACKET = 0x1c;\n\tconst ENTITY_EVENT_PACKET = 0x1d;\n\tconst MOB_EFFECT_PACKET = 0x1e;\n\tconst UPDATE_ATTRIBUTES_PACKET = 0x1f;\n\tconst MOB_EQUIPMENT_PACKET = 0x20;\n\tconst MOB_ARMOR_EQUIPMENT_PACKET = 0x21;\n\tconst INTERACT_PACKET = 0x22;\n\tconst USE_ITEM_PACKET = 0x23;\n\tconst PLAYER_ACTION_PACKET = 0x24;\n\tconst PLAYER_FALL_PACKET = 0x25;\n\tconst HURT_ARMOR_PACKET = 0x26;\n\tconst SET_ENTITY_DATA_PACKET = 0x27;\n\tconst SET_ENTITY_MOTION_PACKET = 0x28;\n\tconst SET_ENTITY_LINK_PACKET = 0x29;\n\tconst SET_HEALTH_PACKET = 0x2a;\n\tconst SET_SPAWN_POSITION_PACKET = 0x2b;\n\tconst ANIMATE_PACKET = 0x2c;\n\tconst RESPAWN_PACKET = 0x2d;\n\tconst DROP_ITEM_PACKET = 0x2e;\n\tconst INVENTORY_ACTION_PACKET = 0x2f;\n\tconst CONTAINER_OPEN_PACKET = 0x30;\n\tconst CONTAINER_CLOSE_PACKET = 0x31;\n\tconst CONTAINER_SET_SLOT_PACKET = 0x32;\n\tconst CONTAINER_SET_DATA_PACKET = 0x33;\n\tconst CONTAINER_SET_CONTENT_PACKET = 0x34;\n\tconst CRAFTING_DATA_PACKET = 0x35;\n\tconst CRAFTING_EVENT_PACKET = 0x36;\n\tconst ADVENTURE_SETTINGS_PACKET = 0x37;\n\tconst BLOCK_ENTITY_DATA_PACKET = 0x38;\n\tconst PLAYER_INPUT_PACKET = 0x39;\n\tconst FULL_CHUNK_DATA_PACKET = 0x3a;\n\tconst SET_COMMANDS_ENABLED_PACKET = 0x3b;\n\tconst SET_DIFFICULTY_PACKET = 0x3c;\n\tconst CHANGE_DIMENSION_PACKET = 0x3d;\n\tconst SET_PLAYER_GAME_TYPE_PACKET = 0x3e;\n\tconst PLAYER_LIST_PACKET = 0x3f;\n\tconst EVENT_PACKET = 0x40; //TelemetryEventPacket\n\tconst SPAWN_EXPERIENCE_ORB_PACKET = 0x41;\n\tconst CLIENTBOUND_MAP_ITEM_DATA_PACKET = 0x42; //MapItemDataPacket\n\tconst MAP_INFO_REQUEST_PACKET = 0x43;\n\tconst REQUEST_CHUNK_RADIUS_PACKET = 0x44;\n\tconst CHUNK_RADIUS_UPDATED_PACKET = 0x45;\n\tconst ITEM_FRAME_DROP_ITEM_PACKET = 0x46;\n\tconst REPLACE_ITEM_IN_SLOT_PACKET = 0x47; //ReplaceSelectedItemPacket\n\tconst GAME_RULES_CHANGED_PACKET = 0x48;\n\tconst CAMERA_PACKET = 0x49;\n\tconst ADD_ITEM_PACKET = 0x4a;\n\tconst BOSS_EVENT_PACKET = 0x4b;\n\tconst SHOW_CREDITS_PACKET = 0x4c;\n\tconst AVAILABLE_COMMANDS_PACKET = 0x4d;\n\tconst COMMAND_STEP_PACKET = 0x4e;\n\tconst RESOURCE_PACK_DATA_INFO_PACKET = 0x4f;\n\tconst RESOURCE_PACK_CHUNK_DATA_PACKET = 0x50;\n\tconst RESOURCE_PACK_CHUNK_REQUEST_PACKET = 0x51;\n\tconst TRANSFER_PACKET = 0x52;\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/InteractPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass InteractPacket extends DataPacket{\n\tconst NETWORK_ID = Info::INTERACT_PACKET;\n\n\tconst ACTION_RIGHT_CLICK = 1;\n\tconst ACTION_LEFT_CLICK = 2;\n\tconst ACTION_LEAVE_VEHICLE = 3;\n\tconst ACTION_MOUSEOVER = 4;\n\n\tpublic $action;\n\tpublic $eid;\n\tpublic $target;\n\n\tpublic function decode(){\n\t\t$this->action = $this->getByte();\n\t\t$this->target = $this->getEntityId();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->action);\n\t\t$this->putEntityId($this->target);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/InventoryActionPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass InventoryActionPacket extends DataPacket{\n\tconst NETWORK_ID = Info::INVENTORY_ACTION_PACKET;\n\n\tpublic $unknown;\n\tpublic $item;\n\n\tpublic function decode(){\n\n\t}\n\t\n\tpublic function encode(){\n\t\t$this->putUnsignedVarInt($this->unknown);\n\t\t$this->putSlot($this->item);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ItemFrameDropItemPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass ItemFrameDropItemPacket extends DataPacket{\n\n\tconst NETWORK_ID = Info::ITEM_FRAME_DROP_ITEM_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $item;\n\n\tpublic function decode(){\n\t\t$this->getBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->item = $this->getSlot();\n\t}\n\n\tpublic function encode(){\n\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/LevelEventPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass LevelEventPacket extends DataPacket{\n\tconst NETWORK_ID = Info::LEVEL_EVENT_PACKET;\n\n\tconst EVENT_SOUND_CLICK = 1000;\n\tconst EVENT_SOUND_CLICK_FAIL = 1001;\n\tconst EVENT_SOUND_SHOOT = 1002;\n\tconst EVENT_SOUND_DOOR = 1003;\n\tconst EVENT_SOUND_FIZZ = 1004;\n\tconst EVENT_SOUND_TNT = 1005;\n\n\tconst EVENT_SOUND_GHAST = 1007;\n\tconst EVENT_SOUND_GHAST_SHOOT = 1008;\n\tconst EVENT_SOUND_BLAZE_SHOOT = 1009;\n\n\tconst EVENT_SOUND_DOOR_BUMP = 1010;\n\tconst EVENT_SOUND_DOOR_CRASH = 1012;\n\n\tconst EVENT_SOUND_BAT_FLY = 1015;\n\tconst EVENT_SOUND_ZOMBIE_INFECT = 1016;\n\tconst EVENT_SOUND_ZOMBIE_HEAL = 1017;\n\tconst EVENT_SOUND_ENDERMAN_TELEPORT = 1018;\n\t\n\tconst EVENT_SOUND_ANVIL_BREAK = 1020; //This sound is played on the anvil's final use, NOT when the block is broken.\n\tconst EVENT_SOUND_ANVIL_USE = 1021;\n\tconst EVENT_SOUND_ANVIL_FALL = 1022;\n\t\n\tconst EVENT_SOUND_DROP_ITEM = 1030;\n\tconst EVENT_SOUND_THROW_PROJECTILE = 1031;\n\t\n\tconst EVENT_SOUND_ITEMFRAME_ADD_ITEM = 1040;\n\tconst EVENT_SOUND_ITEMFRAME_PLACE = 1041;\n\t//1042 is item frame, but cannot tell exactly what.\n\tconst EVENT_SOUND_ITEMFRAME_DROP_ITEM = 1043;\n\tconst EVENT_SOUND_ITEMFRAME_ROTATE_ITEM = 1044;\n\t\n\t//1050 sounds a lot like skeleton walking but different. TODO: find out exactly what it is.\n\tconst EVENT_SOUND_EXP_PICKUP = 1051;\n\tconst EVENT_SOUND_BLOCK_PLACE = 1052;\n\n\tconst EVENT_SOUND_BUTTON_CLICK = 3500;\n\n\tconst EVENT_PARTICLE_SHOOT = 2000;\n\tconst EVENT_PARTICLE_DESTROY = 2001;\n\tconst EVENT_PARTICLE_SPLASH = 2002; //This is actually the splash potion sound with particles\n\tconst EVENT_PARTICLE_EYE_DESPAWN = 2003;\n\tconst EVENT_PARTICLE_SPAWN = 2004;\n\n\tconst EVENT_START_RAIN = 3001;\n\tconst EVENT_START_THUNDER = 3002;\n\tconst EVENT_STOP_RAIN = 3003;\n\tconst EVENT_STOP_THUNDER = 3004;\n\n\tconst EVENT_SOUND_EXPLODE = 3501;\n\t/* 3502-3509 are splash SOUNDS with particles. Probably for cauldrons. */\n\tconst EVENT_SOUND_SPELL = 3504;\n\tconst EVENT_SOUND_SPLASH = 3506;\n\tconst EVENT_SOUND_GRAY_SPLASH = 3507;//TODO: fix name\n\n\tconst EVENT_SET_DATA = 4000;\n\n\tconst EVENT_PLAYERS_SLEEPING = 9800;\n\n\tconst EVENT_ADD_PARTICLE_MASK = 0x4000;\n\n\tpublic $evid;\n\tpublic $x = 0; //Weather effects don't have coordinates\n\tpublic $y = 0;\n\tpublic $z = 0;\n\tpublic $data;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->evid);\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putVarInt($this->data);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/LevelSoundEventPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass LevelSoundEventPacket extends DataPacket{\n\tconst NETWORK_ID = Info::LEVEL_SOUND_EVENT_PACKET;\n\n\tconst SOUND_ITEM_USE_ON = 0;\n\tconst SOUND_HIT = 1;\n\tconst SOUND_STEP = 2;\n\tconst SOUND_JUMP = 3;\n\tconst SOUND_BREAK = 4;\n\tconst SOUND_PLACE = 5;\n\tconst SOUND_HEAVY_STEP = 6;\n\tconst SOUND_GALLOP = 7;\n\tconst SOUND_FALL = 8;\n\tconst SOUND_AMBIENT = 9;\n\tconst SOUND_AMBIENT_BABY = 10;\n\tconst SOUND_AMBIENT_IN_WATER = 11;\n\tconst SOUND_BREATHE = 12;\n\tconst SOUND_DEATH = 13;\n\tconst SOUND_DEATH_IN_WATER = 14;\n\tconst SOUND_DEATH_TO_ZOMBIE = 15;\n\tconst SOUND_HURT = 16;\n\tconst SOUND_HURT_IN_WATER = 17;\n\tconst SOUND_MAD = 18;\n\tconst SOUND_BOOST = 19;\n\tconst SOUND_BOW = 20;\n\tconst SOUND_SQUISH_BIG  = 21;\n\tconst SOUND_SQUISH_SMALL = 22;\n\tconst SOUND_FALL_BIG = 23;\n\tconst SOUND_FALL_SMALL = 24;\n\tconst SOUND_SPLASH = 25;\n\tconst SOUND_FIZZ = 26;\n\tconst SOUND_FLAP = 27;\n\tconst SOUND_SWIM = 28;\n\tconst SOUND_DRINK = 29;\n\tconst SOUND_EAT = 30;\n\tconst SOUND_TAKEOFF = 31;\n\tconst SOUND_SHAKE = 32;\n\tconst SOUND_PLOP = 33;\n\tconst SOUND_LAND = 34;\n\tconst SOUND_SADDLE = 35;\n\tconst SOUND_ARMOR = 36;\n\tconst SOUND_ADD_CHEST = 37;\n\tconst SOUND_THROW = 38;\n\tconst SOUND_ATTACK = 39;\n\tconst SOUND_ATTACK_NODAMAGE = 40;\n\tconst SOUND_WARN = 41;\n\tconst SOUND_SHEAR = 42;\n\tconst SOUND_MILK = 43;\n\tconst SOUND_THUNDER = 44;\n\tconst SOUND_EXPLODE = 45;\n\tconst SOUND_FIRE = 46;\n\tconst SOUND_IGNITE = 47;\n\tconst SOUND_FUSE = 48;\n\tconst SOUND_STARE = 49;\n\tconst SOUND_SPAWN = 50;\n\tconst SOUND_SHOOT = 51;\n\tconst SOUND_BREAK_BLOCK = 52;\n\tconst SOUND_REMEDY = 53;\n\tconst SOUND_UNFECT = 54;\n\tconst SOUND_LEVELUP = 55;\n\tconst SOUND_BOW_HIT = 56;\n\tconst SOUND_BULLET_HIT = 57;\n\tconst SOUND_EXTINGUISH_FIRE = 58;\n\tconst SOUND_ITEM_FIZZ = 59;\n\tconst SOUND_CHEST_OPEN = 60;\n\tconst SOUND_CHEST_CLOSED = 61;\n\tconst SOUND_POWER_ON = 62;\n\tconst SOUND_POWER_OFF = 63;\n\tconst SOUND_ATTACH = 64;\n\tconst SOUND_DETACH = 65;\n\tconst SOUND_DENY = 66;\n\tconst SOUND_TRIPOD = 67;\n\tconst SOUND_POP = 68;\n\tconst SOUND_DROP_SLOT = 69;\n\tconst SOUND_NOTE = 70;\n\tconst SOUND_THORNS = 71;\n\tconst SOUND_PISTON_IN = 72;\n\tconst SOUND_PISTON_OUT = 73;\n\tconst SOUND_PORTAL = 74;\n\tconst SOUND_WATER = 75;\n\tconst SOUND_LAVA_POP = 76;\n\tconst SOUND_LAVA = 77;\n\tconst SOUND_BURP = 78;\n\tconst SOUND_BUCKET_FILL_WATER = 79;\n\tconst SOUND_BUCKET_FILL_LAVA = 80;\n\tconst SOUND_BUCKET_EMPTY_WATER = 81;\n\tconst SOUND_BUCKET_EMPTY_LAVA = 82;\n\tconst SOUND_GUARDIAN_FLOP = 83;\n\tconst SOUND_ELDERGUARDIAN_CURSE = 84;\n\tconst SOUND_MOB_WARNING = 85;\n\tconst SOUND_MOB_WARNING_BABY = 86;\n\tconst SOUND_TELEPORT = 87;\n\tconst SOUND_SHULKER_OPEN = 88;\n\tconst SOUND_SHULKER_CLOSE = 89;\n\tconst SOUND_DEFAULT = 90;\n\tconst SOUND_UNDEFINED = 91;\n\n\tpublic $sound;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $extraData = -1;\n\tpublic $pitch = 1;\n\tpublic $unknownBool = false;\n\tpublic $unknownBool2 = false;\n\n\tpublic function decode(){\n\t\t$this->sound = $this->getByte();\n\t\t$this->getVector3f($this->x, $this->y, $this->z);\n\t\t$this->extraData = $this->getVarInt();\n\t\t$this->pitch = $this->getVarInt();\n\t\t$this->unknownBool = $this->getBool();\n\t\t$this->unknownBool2 = $this->getBool();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->sound);\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putVarInt($this->extraData);\n\t\t$this->putVarInt($this->pitch);\n\t\t$this->putBool($this->unknownBool);\n\t\t$this->putBool($this->unknownBool2);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/LoginPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass LoginPacket extends DataPacket{\n\tconst NETWORK_ID = Info::LOGIN_PACKET;\n\n\tconst MOJANG_PUBKEY = \"MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAE8ELkixyLcwlZryUQcu1TvPOmI2B7vX83ndnWRUaXm74wFfa5f/lwQNTfrLVHa2PmenpGI6JhIMUJaWZrjmMj90NoKNFSNBuKdm8rYiXsfaz3K36x/1U26HpG0ZxK/V1V\";\n\n\tconst EDITION_POCKET = 0;\n\n\n\tpublic $username;\n\tpublic $protocol;\n\tpublic $gameEdition;\n\tpublic $clientUUID;\n\tpublic $clientId;\n\tpublic $identityPublicKey;\n\tpublic $serverAddress;\n\tpublic $deviceModel;\n\n\tpublic $skinId = null;\n\tpublic $skin = null;\n\n\tpublic function decode(){\n\t\t$this->protocol = $this->getInt();\n\t\tif($this->protocol !== Info::CURRENT_PROTOCOL){\n\t\t\treturn; //Do not attempt to decode for non-accepted protocols\n\t\t}\n\n\t\t$this->gameEdition = $this->getByte();\n\n\t\t$str = zlib_decode($this->getString(), 1024 * 1024 * 64);\n\n\t\t$this->setBuffer($str, 0);\n\n\t\t$time = time();\n\n\t\t$chainData = json_decode($this->get($this->getLInt()))->{\"chain\"};\n\t\t// Start with the trusted one\n\t\t$chainKey = self::MOJANG_PUBKEY;\n\t\twhile(!empty($chainData)){\n\t\t\tforeach($chainData as $index => $chain){\n\t\t\t\tlist($verified, $webtoken) = $this->decodeToken($chain, $chainKey);\n\t\t\t\tif(isset($webtoken[\"extraData\"])){\n\t\t\t\t\tif(isset($webtoken[\"extraData\"][\"displayName\"])){\n\t\t\t\t\t\t$this->username = $webtoken[\"extraData\"][\"displayName\"];\n\t\t\t\t\t}\n\t\t\t\t\tif(isset($webtoken[\"extraData\"][\"identity\"])){\n\t\t\t\t\t\t$this->clientUUID = $webtoken[\"extraData\"][\"identity\"];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($verified){\n\t\t\t\t\t$verified = isset($webtoken[\"nbf\"]) && $webtoken[\"nbf\"] <= $time && isset($webtoken[\"exp\"]) && $webtoken[\"exp\"] > $time;\n\t\t\t\t}\n\t\t\t\tif($verified and isset($webtoken[\"identityPublicKey\"])){\n\t\t\t\t\t// Looped key chain. #blamemojang\n\t\t\t\t\tif($webtoken[\"identityPublicKey\"] != self::MOJANG_PUBKEY) $chainKey = $webtoken[\"identityPublicKey\"];\n\t\t\t\t\tbreak;\n\t\t\t\t}elseif($chainKey === null){\n\t\t\t\t\t// We have already gave up\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif(!$verified && $chainKey !== null){\n\t\t\t\t$chainKey = null;\n\t\t\t}else{\n\t\t\t\tunset($chainData[$index]);\n\t\t\t}\n\t\t}\n\t\tlist($verified, $skinToken) = $this->decodeToken($this->get($this->getLInt()), $chainKey);\n\t\tif(isset($skinToken[\"ClientRandomId\"])){\n\t\t\t$this->clientId = $skinToken[\"ClientRandomId\"];\n\t\t}\n\t\tif(isset($skinToken[\"ServerAddress\"])){\n\t\t\t$this->serverAddress = $skinToken[\"ServerAddress\"];\n\t\t}\n\t\tif(isset($skinToken[\"SkinData\"])){\n\t\t\t$this->skin = base64_decode($skinToken[\"SkinData\"]);\n\t\t}\n\t\tif(isset($skinToken[\"SkinId\"])){\n\t\t\t$this->skinId = $skinToken[\"SkinId\"];\n\t\t}\n\t\tif(isset($skinToken[\"DeviceModel\"])){\n\t\t\t$this->deviceModel = $skinToken[\"DeviceModel\"];\n\t\t}\n\t\tif($verified){\n\t\t\t$this->identityPublicKey = $chainKey;\n\t\t}\n\t}\n\n\tpublic function encode(){\n\n\t}\n\t\n\tpublic function decodeToken($token, $key){\n\t\t$tokens = explode(\".\", $token);\n\t\tlist($headB64, $payloadB64, $sigB64) = $tokens;\n\n\t\tif($key !== null and extension_loaded(\"openssl\")){\n\t\t\t$sig = base64_decode(strtr($sigB64, '-_', '+/'), true);\n\t\t\t$rawLen = 48; // ES384\n\t\t\tfor($i = $rawLen; $i > 0 and $sig[$rawLen - $i] == chr(0); $i--) {}\n\t\t\t$j = $i + (ord($sig[$rawLen - $i]) >= 128 ? 1 : 0);\n\t\t\tfor($k = $rawLen; $k > 0 and $sig[2 * $rawLen - $k] == chr(0); $k--) {}\n\t\t\t$l = $k + (ord($sig[2 * $rawLen - $k]) >= 128 ? 1 : 0);\n\t\t\t$len = 2 + $j + 2 + $l;\n\t\t\t$derSig = chr(48);\n\t\t\tif($len > 255){\n\t\t\t\tthrow new \\RuntimeException(\"Invalid signature format\");\n\t\t\t}elseif($len >= 128){\n\t\t\t\t$derSig .= chr(81);\n\t\t\t}\n\t\t\t$derSig .= chr($len) . chr(2) . chr($j);\n\t\t\t$derSig .= str_repeat(chr(0), $j - $i) . substr($sig, $rawLen - $i, $i);\n\t\t\t$derSig .= chr(2) . chr($l);\n\t\t\t$derSig .= str_repeat(chr(0), $l - $k) . substr($sig, 2 * $rawLen - $k, $k);\n\n\t\t\t$verified = openssl_verify($headB64 . \".\" . $payloadB64, $derSig, \"-----BEGIN PUBLIC KEY-----\\n\" . wordwrap($key, 64, \"\\n\", true) . \"\\n-----END PUBLIC KEY-----\\n\", OPENSSL_ALGO_SHA384) === 1;\n\t\t}else{\n\t\t\t$verified = false;\n\t\t}\n\n\t\treturn array($verified, json_decode(base64_decode($payloadB64), true));\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/MobArmorEquipmentPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass MobArmorEquipmentPacket extends DataPacket{\n\tconst NETWORK_ID = Info::MOB_ARMOR_EQUIPMENT_PACKET;\n\n\tpublic $eid;\n\tpublic $slots = [];\n\n\tpublic function decode(){\n\t\t$this->eid = $this->getEntityId();\n\t\t$this->slots[0] = $this->getSlot();\n\t\t$this->slots[1] = $this->getSlot();\n\t\t$this->slots[2] = $this->getSlot();\n\t\t$this->slots[3] = $this->getSlot();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t\t$this->putSlot($this->slots[0]);\n\t\t$this->putSlot($this->slots[1]);\n\t\t$this->putSlot($this->slots[2]);\n\t\t$this->putSlot($this->slots[3]);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/MobEffectPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass MobEffectPacket extends DataPacket{\n\tconst NETWORK_ID = Info::MOB_EFFECT_PACKET;\n\n\tconst EVENT_ADD = 1;\n\tconst EVENT_MODIFY = 2;\n\tconst EVENT_REMOVE = 3;\n\n\tpublic $eid;\n\tpublic $eventId;\n\tpublic $effectId;\n\tpublic $amplifier;\n\tpublic $particles = true;\n\tpublic $duration;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t\t$this->putByte($this->eventId);\n\t\t$this->putVarInt($this->effectId);\n\t\t$this->putVarInt($this->amplifier);\n\t\t$this->putBool($this->particles);\n\t\t$this->putVarInt($this->duration);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/MobEquipmentPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass MobEquipmentPacket extends DataPacket{\n\tconst NETWORK_ID = Info::MOB_EQUIPMENT_PACKET;\n\n\tpublic $eid;\n\tpublic $item;\n\tpublic $slot;\n\tpublic $selectedSlot;\n\tpublic $unknownByte;\n\n\tpublic function decode(){\n\t\t$this->eid = $this->getEntityId(); //EntityRuntimeID\n\t\t$this->item = $this->getSlot();\n\t\t$this->slot = $this->getByte();\n\t\t$this->selectedSlot = $this->getByte();\n\t\t$this->unknownByte = $this->getByte();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid); //EntityRuntimeID\n\t\t$this->putSlot($this->item);\n\t\t$this->putByte($this->slot);\n\t\t$this->putByte($this->selectedSlot);\n\t\t$this->putByte($this->unknownByte);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/MoveEntityPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass MoveEntityPacket extends DataPacket{\n\tconst NETWORK_ID = Info::MOVE_ENTITY_PACKET;\n\n\tpublic $eid;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $yaw;\n\tpublic $headYaw;\n\tpublic $pitch;\n\n\tpublic function decode(){\n\t\t$this->eid = $this->getEntityId();\n\t\t$this->getVector3f($this->x, $this->y, $this->z);\n\t\t$this->pitch = $this->getByte() * (360.0 / 256);\n\t\t$this->yaw = $this->getByte() * (360.0 / 256);\n\t\t$this->headYaw = $this->getByte() * (360.0 / 256);\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putByte($this->pitch / (360.0 / 256));\n\t\t$this->putByte($this->yaw / (360.0 / 256));\n\t\t$this->putByte($this->headYaw / (360.0 / 256));\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/MovePlayerPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass MovePlayerPacket extends DataPacket{\n\tconst NETWORK_ID = Info::MOVE_PLAYER_PACKET;\n\n\tconst MODE_NORMAL = 0;\n\tconst MODE_RESET = 1;\n\tconst MODE_ROTATION = 2;\n\n\tpublic $eid;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $yaw;\n\tpublic $bodyYaw;\n\tpublic $pitch;\n\tpublic $mode = self::MODE_NORMAL;\n\tpublic $onGround;\n\n\tpublic function clean(){\n\t\t$this->teleport = false;\n\t\treturn parent::clean();\n\t}\n\n\tpublic function decode(){\n\t\t$this->eid = $this->getEntityId(); //EntityRuntimeID\n\t\t$this->getVector3f($this->x, $this->y, $this->z);\n\t\t$this->pitch = $this->getLFloat();\n\t\t$this->yaw = $this->getLFloat();\n\t\t$this->bodyYaw = $this->getLFloat();\n\t\t$this->mode = $this->getByte();\n\t\t$this->onGround = $this->getBool();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid); //EntityRuntimeID\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putLFloat($this->pitch);\n\t\t$this->putLFloat($this->yaw);\n\t\t$this->putLFloat($this->bodyYaw); //TODO\n\t\t$this->putByte($this->mode);\n\t\t$this->putBool($this->onGround);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/PlayStatusPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass PlayStatusPacket extends DataPacket{\n\tconst NETWORK_ID = Info::PLAY_STATUS_PACKET;\n\t\n\tconst LOGIN_SUCCESS = 0;\n\tconst LOGIN_FAILED_CLIENT = 1;\n\tconst LOGIN_FAILED_SERVER = 2;\n\tconst PLAYER_SPAWN = 3;\n\n\tpublic $status;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putInt($this->status);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/PlayerActionPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass PlayerActionPacket extends DataPacket{\n\tconst NETWORK_ID = Info::PLAYER_ACTION_PACKET;\n\n\tconst ACTION_START_BREAK = 0;\n\tconst ACTION_ABORT_BREAK = 1;\n\tconst ACTION_STOP_BREAK = 2;\n\n\n\tconst ACTION_RELEASE_ITEM = 5;\n\tconst ACTION_STOP_SLEEPING = 6;\n\tconst ACTION_SPAWN_SAME_DIMENSION = 7;\n\tconst ACTION_JUMP = 8;\n\tconst ACTION_START_SPRINT = 9;\n\tconst ACTION_STOP_SPRINT = 10;\n\tconst ACTION_START_SNEAK = 11;\n\tconst ACTION_STOP_SNEAK = 12;\n\tconst ACTION_SPAWN_OVERWORLD = 13;\n\tconst ACTION_SPAWN_NETHER = 14;\n\n\tconst ACTION_START_GLIDE = 15;\n\tconst ACTION_STOP_GLIDE = 16;\n\n\tpublic $eid;\n\tpublic $action;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $face;\n\n\tpublic function decode(){\n\t\t$this->eid = $this->getEntityId();\n\t\t$this->action = $this->getVarInt();\n\t\t$this->getBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->face = $this->getVarInt();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t\t$this->putVarInt($this->action);\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->putVarInt($this->face);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/PlayerFallPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass PlayerFallPacket extends DataPacket{\n\tconst NETWORK_ID = Info::PLAYER_FALL_PACKET;\n\n\tpublic $unknown; //betting this is fall distance, but let's make sure first\n\n\tpublic function decode(){\n\t\t$this->unknown = $this->getLFloat();\n\t}\n\n\tpublic function encode(){\n\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/PlayerInputPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass PlayerInputPacket extends DataPacket{\n\tconst NETWORK_ID = Info::PLAYER_INPUT_PACKET;\n\n\tpublic $motionX;\n\tpublic $motionY;\n\tpublic $unknownBool1;\n\tpublic $unknownBool2;\n\n\tpublic function decode(){\n\t\t$this->motionX = $this->getLFloat();\n\t\t$this->motionY = $this->getLFloat();\n\t\t$this->unknownBool1 = $this->getBool();\n\t\t$this->unknownBool2 = $this->getBool();\n\t}\n\n\tpublic function encode(){\n\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/PlayerListPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass PlayerListPacket extends DataPacket{\n\tconst NETWORK_ID = Info::PLAYER_LIST_PACKET;\n\n\tconst TYPE_ADD = 0;\n\tconst TYPE_REMOVE = 1;\n\n\t//REMOVE: UUID, ADD: UUID, entity id, name, skinId, skin\n\t/** @var array[] */\n\tpublic $entries = [];\n\tpublic $type;\n\n\tpublic function clean(){\n\t\t$this->entries = [];\n\t\treturn parent::clean();\n\t}\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->type);\n\t\t$this->putUnsignedVarInt(count($this->entries));\n\t\tforeach($this->entries as $d){\n\t\t\tif($this->type === self::TYPE_ADD){\n\t\t\t\t$this->putUUID($d[0]);\n\t\t\t\t$this->putEntityId($d[1]);\n\t\t\t\t$this->putString($d[2]);\n\t\t\t\t$this->putString($d[3]);\n\t\t\t\t$this->putString($d[4]);\n\t\t\t}else{\n\t\t\t\t$this->putUUID($d[0]);\n\t\t\t}\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/RemoveBlockPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass RemoveBlockPacket extends DataPacket{\n\tconst NETWORK_ID = Info::REMOVE_BLOCK_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\n\tpublic function decode(){\n\t\t$this->getBlockCoords($this->x, $this->y, $this->z);\n\t}\n\n\tpublic function encode(){\n\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/RemoveEntityPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass RemoveEntityPacket extends DataPacket{\n\tconst NETWORK_ID = Info::REMOVE_ENTITY_PACKET;\n\n\tpublic $eid;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/ReplaceItemInSlotPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ReplaceItemInSlotPacket extends DataPacket{\n\tconst NETWORK_ID = Info::REPLACE_ITEM_IN_SLOT_PACKET;\n\n\tpublic $item;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putSlot($this->item);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/RequestChunkRadiusPacket.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\network\\protocol;\n\nclass RequestChunkRadiusPacket extends DataPacket{\n\tconst NETWORK_ID = Info::REQUEST_CHUNK_RADIUS_PACKET;\n\n\tpublic $radius;\n\n\tpublic function decode(){\n\t\t$this->radius = $this->getVarInt();\n\t}\n\n\tpublic function encode(){\n\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ResourcePackClientResponsePacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ResourcePackClientResponsePacket extends DataPacket{\n\tconst NETWORK_ID = Info::RESOURCE_PACK_CLIENT_RESPONSE_PACKET;\n\n\tpublic $unknownByte;\n\tpublic $unknownShort;\n\n\tpublic function decode(){\n\t\t$this->unknownByte = $this->getByte();\n\t\t$this->unknownShort = $this->getShort();\n\t}\n\n\tpublic function encode(){\n\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ResourcePacksInfoPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ResourcePacksInfoPacket extends DataPacket{\n\tconst NETWORK_ID = Info::RESOURCE_PACKS_INFO_PACKET;\n\n\tpublic $mustAccept = false; //force client to use selected resource packs\n\t/** @var ResourcePackInfoEntry */\n\tpublic $behaviourPackEntries = [];\n\t/** @var ResourcePackInfoEntry */\n\tpublic $resourcePackEntries = [];\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\n\t\t$this->putBool($this->mustAccept);\n\t\t$this->putShort(count($this->behaviourPackEntries));\n\t\tforeach($this->behaviourPackEntries as $entry){\n\t\t\t$this->putString($entry->getPackId());\n\t\t\t$this->putString($entry->getVersion());\n\t\t\t$this->putLong($entry->getPackSize());\n\t\t}\n\t\t$this->putShort(count($this->resourcePackEntries));\n\t\tforeach($this->resourcePackEntries as $entry){\n\t\t\t$this->putString($entry->getPackId());\n\t\t\t$this->putString($entry->getVersion());\n\t\t\t$this->putLong($entry->getPackSize());\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/RespawnPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass RespawnPacket extends DataPacket{\n\tconst NETWORK_ID = Info::RESPAWN_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\n\tpublic function decode(){\n\t\t$this->x = $this->getLFloat();\n\t\t$this->y = $this->getLFloat();\n\t\t$this->z = $this->getLFloat();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putLFloat($this->x);\n\t\t$this->putLFloat($this->y);\n\t\t$this->putLFloat($this->z);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/SetCommandsEnabledPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SetCommandsEnabledPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_COMMANDS_ENABLED_PACKET;\n\t\n\tpublic $enabled;\n\t\n\tpublic function decode(){\n\t\n\t}\n\t\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putBool($this->enabled);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/SetDifficultyPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SetDifficultyPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_DIFFICULTY_PACKET;\n\n\tpublic $difficulty;\n\n\tpublic function decode(){\n\t\t$this->difficulty = $this->getUnsignedVarInt();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putUnsignedVarInt($this->difficulty);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/SetEntityDataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n#ifndef COMPILE\nuse pocketmine\\utils\\Binary;\n\n#endif\n\nclass SetEntityDataPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_ENTITY_DATA_PACKET;\n\n\tpublic $eid;\n\tpublic $metadata;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t\t$meta = Binary::writeMetadata($this->metadata);\n\t\t$this->put($meta);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/SetEntityLinkPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SetEntityLinkPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_ENTITY_LINK_PACKET;\n\t\n\tconst TYPE_REMOVE = 0;\n\tconst TYPE_RIDE = 1;\n\tconst TYPE_PASSENGER = 2;\n\n\n\tpublic $from;\n\tpublic $to;\n\tpublic $type;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->from);\n\t\t$this->putEntityId($this->to);\n\t\t$this->putByte($this->type);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/SetEntityMotionPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SetEntityMotionPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_ENTITY_MOTION_PACKET;\n\n\tpublic $eid;\n\tpublic $motionX;\n\tpublic $motionY;\n\tpublic $motionZ;\n\n\tpublic function clean(){\n\t\t$this->entities = [];\n\t\treturn parent::clean();\n\t}\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid);\n\t\t$this->putVector3f($this->motionX, $this->motionY, $this->motionZ);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/SetHealthPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SetHealthPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_HEALTH_PACKET;\n\n\tpublic $health;\n\n\tpublic function decode(){\n\t\t$this->health = $this->getVarInt();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->health);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/SetPlayerGameTypePacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SetPlayerGameTypePacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_PLAYER_GAME_TYPE_PACKET;\n\n\tpublic $gamemode;\n\n\tpublic function decode(){\n\t\t$this->gamemode = $this->getVarInt();\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->gamemode);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/SetSpawnPositionPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SetSpawnPositionPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_SPAWN_POSITION_PACKET;\n\n\tpublic $unknown;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $unknownBool;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->unknown);\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->putBool($this->unknownBool);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/SetTimePacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\n\n\nclass SetTimePacket extends DataPacket{\n\tconst NETWORK_ID = Info::SET_TIME_PACKET;\n\n\tpublic $time;\n\tpublic $started = true;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVarInt($this->time);\n\t\t$this->putBool($this->started);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/ShowCreditsPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass ShowCreditsPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SHOW_CREDITS_PACKET;\n\n\tpublic $eid;\n\n\tpublic function decode(){\n\t\t$this->eid = $this->getEntityId(); //EntityRuntimeID\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->eid); //EntityRuntimeID\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/SpawnExperienceOrbPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass SpawnExperienceOrbPacket extends DataPacket{\n\tconst NETWORK_ID = Info::SPAWN_EXPERIENCE_ORB_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $amount;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putVarInt($this->amount);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/StartGamePacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass StartGamePacket extends DataPacket{\n\tconst NETWORK_ID = Info::START_GAME_PACKET;\n\n\tpublic $entityUniqueId;\n\tpublic $entityRuntimeId;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $seed;\n\tpublic $dimension;\n\tpublic $generator = 1; //default infinite - 0 old, 1 infinite, 2 flat\n\tpublic $gamemode;\n\tpublic $difficulty;\n\tpublic $spawnX;\n\tpublic $spawnY;\n\tpublic $spawnZ;\n\tpublic $hasAchievementsDisabled = 1;\n\tpublic $dayCycleStopTime = -1; //-1 = not stopped, any positive value = stopped at that time\n\tpublic $eduMode = 0;\n\tpublic $rainLevel;\n\tpublic $lightningLevel;\n\tpublic $commandsEnabled;\n\tpublic $isTexturePacksRequired = 0;\n\tpublic $unknown;\n\tpublic $worldName;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->entityUniqueId); //EntityUniqueID\n\t\t$this->putEntityId($this->entityRuntimeId); //EntityRuntimeID\n\t\t$this->putVector3f($this->x, $this->y, $this->z);\n\t\t$this->putLFloat(0); //TODO: find out what these are (yaw/pitch?)\n\t\t$this->putLFloat(0);\n\t\t$this->putVarInt($this->seed);\n\t\t$this->putVarInt($this->dimension);\n\t\t$this->putVarInt($this->generator);\n\t\t$this->putVarInt($this->gamemode);\n\t\t$this->putVarInt($this->difficulty);\n\t\t$this->putBlockCoords($this->spawnX, $this->spawnY, $this->spawnZ);\n\t\t$this->putBool($this->hasAchievementsDisabled);\n\t\t$this->putVarInt($this->dayCycleStopTime);\n\t\t$this->putBool($this->eduMode);\n\t\t$this->putLFloat($this->rainLevel);\n\t\t$this->putLFloat($this->lightningLevel);\n\t\t$this->putBool($this->commandsEnabled);\n\t\t$this->putBool($this->isTexturePacksRequired);\n\t\t$this->putString($this->unknown);\n\t\t$this->putString($this->worldName);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/StrangePacket.php",
    "content": "<?php\n\n/*\n * FastTransfer plugin for PocketMine-MP\n * Copyright (C) 2015 Shoghi Cervantes <https://github.com/shoghicp/FastTransfer>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n */\n\nnamespace pocketmine\\network\\protocol;\n\nclass StrangePacket extends DataPacket{\n\tconst NETWORK_ID = 0x1b;\n\n\tpublic $address;\n\tpublic $port = 19132;\n\n\tpublic function pid(){\n\t\treturn 0x1b;\n\t}\n\n\tprotected function putAddress($addr, $port, $version = 4){\n\t\t$this->putByte($version);\n\t\tif($version === 4){\n\t\t\tforeach(explode(\".\", $addr) as $b){\n\t\t\t\t$this->putByte((~((int) $b)) & 0xff);\n\t\t\t}\n\t\t\t$this->putShort($port);\n\t\t}else{\n\t\t\t//IPv6\n\t\t}\n\t}\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putAddress($this->address, $this->port);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/TakeItemEntityPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass TakeItemEntityPacket extends DataPacket{\n\tconst NETWORK_ID = Info::TAKE_ITEM_ENTITY_PACKET;\n\n\tpublic $target;\n\tpublic $eid;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->target);\n\t\t$this->putEntityId($this->eid);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/TextPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass TextPacket extends DataPacket{\n\tconst NETWORK_ID = Info::TEXT_PACKET;\n\n\tconst TYPE_RAW = 0;\n\tconst TYPE_CHAT = 1;\n\tconst TYPE_TRANSLATION = 2;\n\tconst TYPE_POPUP = 3;\n\tconst TYPE_TIP = 4;\n\tconst TYPE_SYSTEM = 5;\n\tconst TYPE_WHISPER = 6;\n\n\tpublic $type;\n\tpublic $source;\n\tpublic $message;\n\tpublic $parameters = [];\n\n\tpublic function decode(){\n\t\t$this->type = $this->getByte();\n\t\tswitch($this->type){\n\t\t\tcase self::TYPE_POPUP:\n\t\t\tcase self::TYPE_CHAT:\n\t\t\t/** @noinspection PhpMissingBreakStatementInspection */\n\t\t\tcase self::TYPE_WHISPER:\n\t\t\t\t$this->source = $this->getString();\n\t\t\tcase self::TYPE_RAW:\n\t\t\tcase self::TYPE_TIP:\n\t\t\tcase self::TYPE_SYSTEM:\n\t\t\t\t$this->message = $this->getString();\n\t\t\t\tbreak;\n\n\t\t\tcase self::TYPE_TRANSLATION:\n\t\t\t\t$this->message = $this->getString();\n\t\t\t\t$count = $this->getUnsignedVarInt();\n\t\t\t\tfor($i = 0; $i < $count; ++$i){\n\t\t\t\t\t$this->parameters[] = $this->getString();\n\t\t\t\t}\n\t\t}\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putByte($this->type);\n\t\tswitch($this->type){\n\t\t\tcase self::TYPE_POPUP:\n\t\t\tcase self::TYPE_CHAT:\n\t\t\t/** @noinspection PhpMissingBreakStatementInspection */\n\t\t\tcase self::TYPE_WHISPER:\n\t\t\t\t$this->putString($this->source);\n\t\t\tcase self::TYPE_RAW:\n\t\t\tcase self::TYPE_TIP:\n\t\t\tcase self::TYPE_SYSTEM:\n\t\t\t\t$this->putString($this->message);\n\t\t\t\tbreak;\n\n\t\t\tcase self::TYPE_TRANSLATION:\n\t\t\t\t$this->putString($this->message);\n\t\t\t\t$this->putUnsignedVarInt(count($this->parameters));\n\t\t\t\tforeach($this->parameters as $p){\n\t\t\t\t\t$this->putString($p);\n\t\t\t\t}\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/TransferPacket.php",
    "content": "<?php\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nclass TransferPacket extends DataPacket{\n\t\n\tconst NETWORK_ID = Info::TRANSFER_PACKET;\n\t\n\tpublic $address;\n\tpublic $port = 19132;\n\t\n\tpublic function decode(){\n\t}\n\t\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putString($this->address);\n\t\t$this->putLShort($this->port);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/protocol/UpdateAttributesPacket.php",
    "content": "<?php\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\nuse pocketmine\\entity\\Attribute;\n\n\nclass UpdateAttributesPacket extends DataPacket{\n\n\tconst NETWORK_ID = Info::UPDATE_ATTRIBUTES_PACKET;\n\n\tpublic $entityId;\n\n\t/** @var Attribute[] */\n\tpublic $entries = [];\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putEntityId($this->entityId);\n\t\t$this->putUnsignedVarInt(count($this->entries));\n\t\tforeach($this->entries as $entry){\n\t\t\t$this->putLFloat($entry->getMinValue());\n\t\t\t$this->putLFloat($entry->getMaxValue());\n\t\t\t$this->putLFloat($entry->getValue());\n\t\t\t$this->putLFloat($entry->getDefaultValue());\n\t\t\t$this->putString($entry->getName());\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/UpdateBlockPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass UpdateBlockPacket extends DataPacket{\n\tconst NETWORK_ID = Info::UPDATE_BLOCK_PACKET;\n\n\tconst FLAG_NONE      = 0b0000;\n\tconst FLAG_NEIGHBORS = 0b0001;\n    const FLAG_NETWORK   = 0b0010;\n\tconst FLAG_NOGRAPHIC = 0b0100;\n\tconst FLAG_PRIORITY  = 0b1000;\n\n\tconst FLAG_ALL = (self::FLAG_NEIGHBORS | self::FLAG_NETWORK);\n\tconst FLAG_ALL_PRIORITY = (self::FLAG_ALL | self::FLAG_PRIORITY);\n\n\tpublic $x;\n\tpublic $z;\n\tpublic $y;\n\tpublic $blockId;\n\tpublic $blockData;\n\tpublic $flags;\n\n\tpublic function decode(){\n\n\t}\n\n\tpublic function encode(){\n\t\t$this->reset();\n\t\t$this->putBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->putUnsignedVarInt($this->blockId);\n\t\t$this->putUnsignedVarInt(($this->flags << 4) | $this->blockData);\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/network/protocol/UseItemPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\protocol;\n\n#include <rules/DataPacket.h>\n\n\nclass UseItemPacket extends DataPacket{\n\tconst NETWORK_ID = Info::USE_ITEM_PACKET;\n\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $blockId;\n\tpublic $face;\n\tpublic $item;\n\tpublic $fx;\n\tpublic $fy;\n\tpublic $fz;\n\tpublic $posX;\n\tpublic $posY;\n\tpublic $posZ;\n\tpublic $slot;\n\n\tpublic function decode(){\n\t\t$this->getBlockCoords($this->x, $this->y, $this->z);\n\t\t$this->blockId = $this->getUnsignedVarInt();\n\t\t$this->face = $this->getVarInt();\n\t\t$this->getVector3f($this->fx, $this->fy, $this->fz);\n\t\t$this->getVector3f($this->posX, $this->posY, $this->posZ);\n\t\t$this->slot = $this->getVarInt();\n\t\t$this->item = $this->getSlot();\n\t}\n\n\tpublic function encode(){\n\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/network/query/QueryHandler.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Implementation of the UT3 Query Protocol (GameSpot)\n * Source: http://wiki.unrealadmin.org/UT3_query_protocol\n */\nnamespace pocketmine\\network\\query;\n\nuse pocketmine\\Server;\nuse pocketmine\\utils\\Binary;\n\nclass QueryHandler{\n\tprivate $server, $lastToken, $token, $longData, $shortData, $timeout;\n\n\tconst HANDSHAKE = 9;\n\tconst STATISTICS = 0;\n\n\tpublic function __construct(){\n\t\t$this->server = Server::getInstance();\n\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.server.query.start\"));\n\t\t$addr = ($ip = $this->server->getIp()) != \"\" ? $ip : \"0.0.0.0\";\n\t\t$port = $this->server->getPort();\n\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.server.query.info\", [$port]));\n\t\t/*\n\t\tThe Query protocol is built on top of the existing Minecraft PE UDP network stack.\n\t\tBecause the 0xFE packet does not exist in the MCPE protocol,\n\t\twe can identify\tQuery packets and remove them from the packet queue.\n\t\t\n\t\tThen, the Query class handles itself sending the packets in raw form, because\n\t\tpackets can conflict with the MCPE ones.\n\t\t*/\n\n\t\t$this->regenerateToken();\n\t\t$this->lastToken = $this->token;\n\t\t$this->regenerateInfo();\n\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.server.query.running\", [$addr, $port]));\n\t}\n\n\tpublic function regenerateInfo(){\n\t\t$ev = $this->server->getQueryInformation();\n\t\t$this->longData = $ev->getLongQuery();\n\t\t$this->shortData = $ev->getShortQuery();\n\t\t$this->timeout = microtime(true) + $ev->getTimeout();\n\t}\n\n\tpublic function regenerateToken(){\n\t\t$this->lastToken = $this->token;\n\t\t$this->token = random_bytes(16);\n\t}\n\n\tpublic static function getTokenString($token, $salt){\n\t\treturn Binary::readInt(substr(hash(\"sha512\", $salt . \":\" . $token, true), 7, 4));\n\t}\n\n\tpublic function handle($address, $port, $packet){\n\t\t$offset = 2;\n\t\t$packetType = ord($packet{$offset++});\n\t\t$sessionID = Binary::readInt(substr($packet, $offset, 4));\n\t\t$offset += 4;\n\t\t$payload = substr($packet, $offset);\n\n\t\tswitch($packetType){\n\t\t\tcase self::HANDSHAKE: //Handshake\n\t\t\t\t$reply = chr(self::HANDSHAKE);\n\t\t\t\t$reply .= Binary::writeInt($sessionID);\n\t\t\t\t$reply .= self::getTokenString($this->token, $address) . \"\\x00\";\n\n\t\t\t\t$this->server->getNetwork()->sendPacket($address, $port, $reply);\n\t\t\t\tbreak;\n\t\t\tcase self::STATISTICS: //Stat\n\t\t\t\t$token = Binary::readInt(substr($payload, 0, 4));\n\t\t\t\tif($token !== self::getTokenString($this->token, $address) and $token !== self::getTokenString($this->lastToken, $address)){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$reply = chr(self::STATISTICS);\n\t\t\t\t$reply .= Binary::writeInt($sessionID);\n\n\t\t\t\tif($this->timeout < microtime(true)){\n\t\t\t\t\t$this->regenerateInfo();\n\t\t\t\t}\n\n\t\t\t\tif(strlen($payload) === 8){\n\t\t\t\t\t$reply .= $this->longData;\n\t\t\t\t}else{\n\t\t\t\t\t$reply .= $this->shortData;\n\t\t\t\t}\n\t\t\t\t$this->server->getNetwork()->sendPacket($address, $port, $reply);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/rcon/RCON.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Implementation of the Source RCON Protocol to allow remote console commands\n * Source: https://developer.valvesoftware.com/wiki/Source_RCON_Protocol\n *\n * Implementation of the GeniRCON Protocol to allow full remote console access\n * Source: https://github.com/iTXTech/GeniRCON\n */\nnamespace pocketmine\\network\\rcon;\n\nuse pocketmine\\command\\RemoteConsoleCommandSender;\nuse pocketmine\\event\\server\\RemoteServerCommandEvent;\nuse pocketmine\\utils\\Utils;\nuse pocketmine\\Server;\n\nclass RCON{\n\tconst PROTOCOL_VERSION = 3;\n\n\t/** @var Server */\n\tprivate $server;\n\tprivate $socket;\n\tprivate $password;\n\t/** @var RCONInstance[] */\n\tprivate $workers = [];\n\tprivate $clientsPerThread;\n\n\tpublic function __construct(Server $server, $password, $port = 19132, $interface = \"0.0.0.0\", $threads = 1, $clientsPerThread = 50){\n\t\t$this->server = $server;\n\t\t$this->workers = [];\n\t\t$this->password = (string) $password;\n\t\t$this->server->getLogger()->info(\"Starting remote control listener\");\n\t\tif($this->password === \"\"){\n\t\t\t$this->server->getLogger()->critical(\"RCON can't be started: Empty password\");\n\n\t\t\treturn;\n\t\t}\n\t\t$this->threads = (int) max(1, $threads);\n\t\t$this->clientsPerThread = (int) max(1, $clientsPerThread);\n\t\t$this->socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);\n\t\tif($this->socket === false or !socket_bind($this->socket, $interface, (int) $port) or !socket_listen($this->socket)){\n\t\t\t$this->server->getLogger()->critical(\"RCON can't be started: \" . socket_strerror(socket_last_error()));\n\t\t\t$this->threads = 0;\n\t\t\treturn;\n\t\t}\n\t\tsocket_set_block($this->socket);\n\n\t\tfor($n = 0; $n < $this->threads; ++$n){\n\t\t\t$this->workers[$n] = new RCONInstance($this->server->getLogger(), $this->socket, $this->password, $this->clientsPerThread);\n\t\t}\n\t\tsocket_getsockname($this->socket, $addr, $port);\n\t\t$this->server->getLogger()->info(\"RCON running on $addr:$port\");\n\t}\n\n\tpublic function stop(){\n\t\tfor($n = 0; $n < $this->threads; ++$n){\n\t\t\t$this->workers[$n]->close();\n\t\t\tServer::microSleep(50000);\n\t\t\t$this->workers[$n]->close();\n\t\t\t$this->workers[$n]->quit();\n\t\t}\n\t\t@socket_close($this->socket);\n\t\t$this->threads = 0;\n\t}\n\n\tpublic function check(){\n\t\t$d = Utils::getRealMemoryUsage();\n\n\t\t$u = Utils::getMemoryUsage(true);\n\t\t$usage = round(($u[0] / 1024) / 1024, 2) . \"/\" . round(($d[0] / 1024) / 1024, 2) . \"/\" . round(($u[1] / 1024) / 1024, 2) . \"/\" . round(($u[2] / 1024) / 1024, 2) . \" MB @ \" . Utils::getThreadCount() . \" threads\";\n\t\t$serverStatus = serialize([\n\t\t\t\"online\" => count($this->server->getOnlinePlayers()),\n\t\t\t\"max\" => $this->server->getMaxPlayers(),\n\t\t\t\"upload\" => round($this->server->getNetwork()->getUpload() / 1024, 2),\n\t\t\t\"download\" => round($this->server->getNetwork()->getDownload() / 1024, 2),\n\t\t\t\"tps\" => $this->server->getTicksPerSecondAverage(),\n\t\t\t\"load\" => $this->server->getTickUsageAverage(),\n\t\t\t\"usage\" => $usage\n\t\t]);\n\t\tfor($n = 0; $n < $this->threads; ++$n){\n\t\t\tif(!$this->workers[$n]->isTerminated()){\n\t\t\t\t$this->workers[$n]->serverStatus = $serverStatus;\n\t\t\t}\n\t\t\tif($this->workers[$n]->isTerminated() === true){\n\t\t\t\t$this->workers[$n] = new RCONInstance($this->socket, $this->password, $this->clientsPerThread);\n\t\t\t}elseif($this->workers[$n]->isWaiting()){\n\t\t\t\tif($this->workers[$n]->response !== \"\"){\n\t\t\t\t\t$this->server->getLogger()->info($this->workers[$n]->response);\n\t\t\t\t\t$this->workers[$n]->synchronized(function(RCONInstance $thread){\n\t\t\t\t\t\t$thread->notify();\n\t\t\t\t\t}, $this->workers[$n]);\n\t\t\t\t}else{\n\n\t\t\t\t\t$response = new RemoteConsoleCommandSender();\n\t\t\t\t\t$command = $this->workers[$n]->cmd;\n\n\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new RemoteServerCommandEvent($response, $command));\n\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->server->dispatchCommand($ev->getSender(), $ev->getCommand());\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->workers[$n]->response = $response->getMessage();\n\t\t\t\t\t$this->workers[$n]->synchronized(function(RCONInstance $thread){\n\t\t\t\t\t\t$thread->notify();\n\t\t\t\t\t}, $this->workers[$n]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/network/rcon/RCONInstance.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\network\\rcon;\n\nuse pocketmine\\Thread;\nuse pocketmine\\utils\\Binary;\nuse pocketmine\\utils\\MainLogger;\n\nclass RCONInstance extends Thread{\n\tpublic $stop;\n\tpublic $cmd;\n\tpublic $response;\n\tprivate $socket;\n\tprivate $password;\n\tprivate $maxClients;\n\tprivate $waiting;\n\n\t/** @var MainLogger */\n\tprivate $logger;\n\n\tpublic $serverStatus;\n\n\tpublic function isWaiting(){\n\t\treturn $this->waiting === true;\n\t}\n\n\n\tpublic function __construct($logger, $socket, $password, $maxClients = 50){\n\t\t$this->logger = $logger;\n\t\t$this->stop = false;\n\t\t$this->cmd = \"\";\n\t\t$this->response = \"\";\n\t\t$this->socket = $socket;\n\t\t$this->password = $password;\n\t\t$this->maxClients = (int) $maxClients;\n\t\tfor($n = 0; $n < $this->maxClients; ++$n){\n\t\t\t$this->{\"client\" . $n} = null;\n\t\t\t$this->{\"status\" . $n} = 0;\n\t\t\t$this->{\"timeout\" . $n} = 0;\n\t\t}\n\n\t\t$this->start();\n\t}\n\n\tprivate function writePacket($client, $requestID, $packetType, $payload){\n\t\t$pk = Binary::writeLInt((int) $requestID)\n\t\t\t. Binary::writeLInt((int) $packetType)\n\t\t\t. $payload\n\t\t\t. \"\\x00\\x00\"; //Terminate payload and packet\n\t\treturn socket_write($client, Binary::writeLInt(strlen($pk)) . $pk);\n\t}\n\n\tprivate function readPacket($client, &$size, &$requestID, &$packetType, &$payload){\n\t\tsocket_set_nonblock($client);\n\t\t$d = @socket_read($client, 4);\n\t\tif($this->stop === true){\n\t\t\treturn false;\n\t\t}elseif($d === false){\n\t\t\treturn null;\n\t\t}elseif($d === \"\" or strlen($d) < 4){\n\t\t\treturn false;\n\t\t}\n\t\tsocket_set_block($client);\n\t\t$size = Binary::readLInt($d);\n\t\tif($size < 0 or $size > 65535){\n\t\t\treturn false;\n\t\t}\n\t\t$requestID = Binary::readLInt(socket_read($client, 4));\n\t\t$packetType = Binary::readLInt(socket_read($client, 4));\n\t\t$payload = rtrim(socket_read($client, $size + 2)); //Strip two null bytes\n\t\treturn true;\n\t}\n\n\tpublic function close(){\n\t\t$this->stop = true;\n\t}\n\n\tpublic function run(){\n\n\t\twhile($this->stop !== true){\n\t\t\t$this->synchronized(function(){\n\t\t\t\t$this->wait(2000);\n\t\t\t});\n\t\t\t$r = [$socket = $this->socket];\n\t\t\t$w = null;\n\t\t\t$e = null;\n\t\t\tif(socket_select($r, $w, $e, 0) === 1){\n\t\t\t\tif(($client = socket_accept($this->socket)) !== false){\n\t\t\t\t\tsocket_set_block($client);\n\t\t\t\t\tsocket_set_option($client, SOL_SOCKET, SO_KEEPALIVE, 1);\n\t\t\t\t\t$done = false;\n\t\t\t\t\tfor($n = 0; $n < $this->maxClients; ++$n){\n\t\t\t\t\t\tif($this->{\"client\" . $n} === null){\n\t\t\t\t\t\t\t$this->{\"client\" . $n} = $client;\n\t\t\t\t\t\t\t$this->{\"status\" . $n} = 0;\n\t\t\t\t\t\t\t$this->{\"timeout\" . $n} = microtime(true) + 5;\n\t\t\t\t\t\t\t$done = true;\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif($done === false){\n\t\t\t\t\t\t@socket_close($client);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfor($n = 0; $n < $this->maxClients; ++$n){\n\t\t\t\t$client = &$this->{\"client\" . $n};\n\t\t\t\tif($client !== null){\n\t\t\t\t\tif($this->{\"status\" . $n} !== -1 and $this->stop !== true){\n\t\t\t\t\t\tif($this->{\"status\" . $n} === 0 and $this->{\"timeout\" . $n} < microtime(true)){ //Timeout\n\t\t\t\t\t\t\t$this->{\"status\" . $n} = -1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$p = $this->readPacket($client, $size, $requestID, $packetType, $payload);\n\t\t\t\t\t\tif($p === false){\n\t\t\t\t\t\t\t$this->{\"status\" . $n} = -1;\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}elseif($p === null){\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tswitch($packetType){\n\t\t\t\t\t\t\tcase 9: //Protocol check\n\t\t\t\t\t\t\t\tif($this->{\"status\" . $n} !== 1){\n\t\t\t\t\t\t\t\t\t$this->{\"status\" . $n} = -1;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$this->writePacket($client, $requestID, 0, RCON::PROTOCOL_VERSION);\n\t\t\t\t\t\t\t\t$this->response = \"\";\n\n\t\t\t\t\t\t\t\tif($payload == RCON::PROTOCOL_VERSION) $this->logger->setSendMsg(true); //GeniRCON output\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 4: //Logger\n\t\t\t\t\t\t\t\tif($this->{\"status\" . $n} !== 1){\n\t\t\t\t\t\t\t\t\t$this->{\"status\" . $n} = -1;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t$res = (array) [\n\t\t\t\t\t\t\t\t\t\"serverStatus\" => unserialize($this->serverStatus),\n\t\t\t\t\t\t\t\t\t\"logger\" => str_replace(\"\\n\", \"\\r\\n\", trim($this->logger->getMessages()))\n\t\t\t\t\t\t\t\t];\n\t\t\t\t\t\t\t\t$this->writePacket($client, $requestID, 0, serialize($res));\n\t\t\t\t\t\t\t\t$this->response = \"\";\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 3: //Login\n\t\t\t\t\t\t\t\tif($this->{\"status\" . $n} !== 0){\n\t\t\t\t\t\t\t\t\t$this->{\"status\" . $n} = -1;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif($payload === $this->password){\n\t\t\t\t\t\t\t\t\tsocket_getpeername($client, $addr, $port);\n\t\t\t\t\t\t\t\t\t$this->response = \"[INFO] Successful Rcon connection from: /$addr:$port\";\n\t\t\t\t\t\t\t\t\t$this->response = \"\";\n\t\t\t\t\t\t\t\t\t$this->writePacket($client, $requestID, 2, \"\");\n\t\t\t\t\t\t\t\t\t$this->{\"status\" . $n} = 1;\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$this->{\"status\" . $n} = -1;\n\t\t\t\t\t\t\t\t\t$this->writePacket($client, -1, 2, \"\");\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\tcase 2: //Command\n\t\t\t\t\t\t\t\tif($this->{\"status\" . $n} !== 1){\n\t\t\t\t\t\t\t\t\t$this->{\"status\" . $n} = -1;\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tif(strlen($payload) > 0){\n\t\t\t\t\t\t\t\t\t$this->cmd = ltrim($payload);\n\t\t\t\t\t\t\t\t\t$this->synchronized(function(){\n\t\t\t\t\t\t\t\t\t\t$this->waiting = true;\n\t\t\t\t\t\t\t\t\t\t$this->wait();\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\t$this->waiting = false;\n\t\t\t\t\t\t\t\t\t$this->writePacket($client, $requestID, 0, str_replace(\"\\n\", \"\\r\\n\", trim($this->response)));\n\t\t\t\t\t\t\t\t\t$this->response = \"\";\n\t\t\t\t\t\t\t\t\t$this->cmd = \"\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t}else{\n\t\t\t\t\t\t@socket_set_option($client, SOL_SOCKET, SO_LINGER, [\"l_onoff\" => 1, \"l_linger\" => 1]);\n\t\t\t\t\t\t@socket_shutdown($client, 2);\n\t\t\t\t\t\t@socket_set_block($client);\n\t\t\t\t\t\t@socket_read($client, 1);\n\t\t\t\t\t\t@socket_close($client);\n\t\t\t\t\t\t$this->{\"status\" . $n} = 0;\n\t\t\t\t\t\t$this->{\"client\" . $n} = null;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tunset($this->socket, $this->cmd, $this->response, $this->stop);\n\t\texit(0);\n\t}\n\n\tpublic function getThreadName(){\n\t\treturn \"RCON\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/network/upnp/UPnP.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * UPnP port forwarding support. Only for Windows\n */\nnamespace pocketmine\\network\\upnp;\n\nuse pocketmine\\utils\\Utils;\n\nabstract class UPnP{\n\tpublic static function PortForward($port){\n\t\tif(Utils::$online === false){\n\t\t\treturn false;\n\t\t}\n\t\tif(Utils::getOS() != \"win\" or !class_exists(\"COM\", false)){\n\t\t\treturn false;\n\t\t}\n\t\t$port = (int) $port;\n\t\t$myLocalIP = gethostbyname(trim(`hostname`));\n\t\ttry{\n\t\t\t$com = new \\COM(\"HNetCfg.NATUPnP\");\n\t\t\tif($com === false or !is_object($com->StaticPortMappingCollection)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$com->StaticPortMappingCollection->Add($port, \"UDP\", $port, $myLocalIP, true, \"PocketMine-MP\");\n\t\t}catch(\\Throwable $e){\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic static function RemovePortForward($port){\n\t\tif(Utils::$online === false){\n\t\t\treturn false;\n\t\t}\n\t\tif(Utils::getOS() != \"win\" or !class_exists(\"COM\")){\n\t\t\treturn false;\n\t\t}\n\t\t$port = (int) $port;\n\t\ttry{\n\t\t\t$com = new \\COM(\"HNetCfg.NATUPnP\") or false;\n\t\t\tif($com === false or !is_object($com->StaticPortMappingCollection)){\n\t\t\t\treturn false;\n\t\t\t}\n\t\t\t$com->StaticPortMappingCollection->Remove($port, \"UDP\");\n\t\t}catch(\\Throwable $e){\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/permission/BanEntry.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\nuse pocketmine\\utils\\MainLogger;\n\nclass BanEntry{\n\tpublic static $format = \"Y-m-d H:i:s O\";\n\n\tprivate $name;\n\t/** @var \\DateTime */\n\tprivate $creationDate = null;\n\tprivate $source = \"(Unknown)\";\n\t/** @var \\DateTime */\n\tprivate $expirationDate = null;\n\tprivate $reason = \"Banned by an operator.\";\n\n\tpublic function __construct($name){\n\t\t$this->name = strtolower($name);\n\t\t$this->creationDate = new \\DateTime();\n\t}\n\n\tpublic function getName(){\n\t\treturn $this->name;\n\t}\n\n\tpublic function getCreated(){\n\t\treturn $this->creationDate;\n\t}\n\n\tpublic function setCreated(\\DateTime $date){\n\t\t$this->creationDate = $date;\n\t}\n\n\tpublic function getSource(){\n\t\treturn $this->source;\n\t}\n\n\tpublic function setSource($source){\n\t\t$this->source = $source;\n\t}\n\n\tpublic function getExpires(){\n\t\treturn $this->expirationDate;\n\t}\n\n\t/**\n\t * @param \\DateTime $date\n\t */\n\tpublic function setExpires($date){\n\t\t$this->expirationDate = $date;\n\t}\n\n\tpublic function hasExpired(){\n\t\t$now = new \\DateTime();\n\n\t\treturn $this->expirationDate === null ? false : $this->expirationDate < $now;\n\t}\n\n\tpublic function getReason(){\n\t\treturn $this->reason;\n\t}\n\n\tpublic function setReason($reason){\n\t\t$this->reason = $reason;\n\t}\n\n\tpublic function getString(){\n\t\t$str = \"\";\n\t\t$str .= $this->getName();\n\t\t$str .= \"|\";\n\t\t$str .= $this->getCreated()->format(self::$format);\n\t\t$str .= \"|\";\n\t\t$str .= $this->getSource();\n\t\t$str .= \"|\";\n\t\t$str .= $this->getExpires() === null ? \"Forever\" : $this->getExpires()->format(self::$format);\n\t\t$str .= \"|\";\n\t\t$str .= $this->getReason();\n\n\t\treturn $str;\n\t}\n\n\t/**\n\t * @param string $str\n\t *\n\t * @return BanEntry\n\t */\n\tpublic static function fromString($str){\n\t\tif(strlen($str) < 2){\n\t\t\treturn null;\n\t\t}else{\n\t\t\t$str = explode(\"|\", trim($str));\n\t\t\t$entry = new BanEntry(trim(array_shift($str)));\n\t\t\tif(count($str) > 0){\n\t\t\t\t$datetime = \\DateTime::createFromFormat(self::$format, array_shift($str));\n\t\t\t\tif(!($datetime instanceof \\DateTime)){\n\t\t\t\t\tMainLogger::getLogger()->alert(\"Error parsing date for BanEntry for player \\\"\" . $entry->getName() . \"\\\", the format may be invalid!\");\n\t\t\t\t\treturn $entry;\n\t\t\t\t}\n\t\t\t\t$entry->setCreated($datetime);\n\t\t\t\tif(count($str) > 0){\n\t\t\t\t\t$entry->setSource(trim(array_shift($str)));\n\t\t\t\t\tif(count($str) > 0){\n\t\t\t\t\t\t$expire = trim(array_shift($str));\n\t\t\t\t\t\tif(strtolower($expire) !== \"forever\" and strlen($expire) > 0){\n\t\t\t\t\t\t\t$entry->setExpires(\\DateTime::createFromFormat(self::$format, $expire));\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif(count($str) > 0){\n\t\t\t\t\t\t\t$entry->setReason(trim(array_shift($str)));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $entry;\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/permission/BanList.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\nuse pocketmine\\Server;\nuse pocketmine\\utils\\MainLogger;\n\nclass BanList{\n\n\t/** @var BanEntry[] */\n\tprivate $list = [];\n\n\t/** @var string */\n\tprivate $file;\n\n\t/** @var bool */\n\tprivate $enabled = true;\n\n\t/**\n\t * @param string $file\n\t */\n\tpublic function __construct($file){\n\t\t$this->file = $file;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isEnabled(){\n\t\treturn $this->enabled === true;\n\t}\n\n\t/**\n\t * @param bool $flag\n\t */\n\tpublic function setEnabled($flag){\n\t\t$this->enabled = (bool) $flag;\n\t}\n\n\t/**\n\t * @return BanEntry[]\n\t */\n\tpublic function getEntries(){\n\t\t$this->removeExpired();\n\n\t\treturn $this->list;\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isBanned($name){\n\t\t$name = strtolower($name);\n\t\tif(!$this->isEnabled()){\n\t\t\treturn false;\n\t\t}else{\n\t\t\t$this->removeExpired();\n\n\t\t\treturn isset($this->list[$name]);\n\t\t}\n\t}\n\n\t/**\n\t * @param BanEntry $entry\n\t */\n\tpublic function add(BanEntry $entry){\n\t\t$this->list[$entry->getName()] = $entry;\n\t\t$this->save();\n\t}\n\n\t/**\n\t * @param string    $target\n\t * @param string    $reason\n\t * @param \\DateTime $expires\n\t * @param string    $source\n\t *\n\t * @return BanEntry\n\t */\n\tpublic function addBan($target, $reason = null, $expires = null, $source = null){\n\t\t$entry = new BanEntry($target);\n\t\t$entry->setSource($source != null ? $source : $entry->getSource());\n\t\t$entry->setExpires($expires);\n\t\t$entry->setReason($reason != null ? $reason : $entry->getReason());\n\n\t\t$this->list[$entry->getName()] = $entry;\n\t\t$this->save();\n\n\t\treturn $entry;\n\t}\n\n\t/**\n\t * @param string $name\n\t */\n\tpublic function remove($name){\n\t\t$name = strtolower($name);\n\t\tif(isset($this->list[$name])){\n\t\t\tunset($this->list[$name]);\n\t\t\t$this->save();\n\t\t}\n\t}\n\n\tpublic function removeExpired(){\n\t\tforeach($this->list as $name => $entry){\n\t\t\tif($entry->hasExpired()){\n\t\t\t\tunset($this->list[$name]);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function load(){\n\t\t$this->list = [];\n\t\t$fp = @fopen($this->file, \"r\");\n\t\tif(is_resource($fp)){\n\t\t\twhile(($line = fgets($fp)) !== false){\n\t\t\t\tif($line{0} !== \"#\"){\n\t\t\t\t\t$entry = BanEntry::fromString($line);\n\t\t\t\t\tif($entry instanceof BanEntry){\n\t\t\t\t\t\t$this->list[$entry->getName()] = $entry;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tfclose($fp);\n\t\t}else{\n\t\t\tMainLogger::getLogger()->error(\"Could not load ban list\");\n\t\t}\n\t}\n\n\tpublic function save($flag = true){\n\t\t$this->removeExpired();\n\t\t$fp = @fopen($this->file, \"w\");\n\t\tif(is_resource($fp)){\n\t\t\tif($flag === true){\n\t\t\t\tfwrite($fp, \"# Updated \" . strftime(\"%x %H:%M\", time()) . \" by \" . Server::getInstance()->getName() . \" \" . Server::getInstance()->getPocketMineVersion() . \"\\n\");\n\t\t\t\tfwrite($fp, \"# victim name | ban date | banned by | banned until | reason\\n\\n\");\n\t\t\t}\n\n\t\t\tforeach($this->list as $entry){\n\t\t\t\tfwrite($fp, $entry->getString() . \"\\n\");\n\t\t\t}\n\t\t\tfclose($fp);\n\t\t}else{\n\t\t\tMainLogger::getLogger()->error(\"Could not save ban list\");\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/permission/DefaultPermissions.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\nuse pocketmine\\Server;\n\nabstract class DefaultPermissions{\n\tconst ROOT = \"pocketmine\";\n\n\t/**\n\t * @param Permission $perm\n\t * @param Permission $parent\n\t *\n\t * @return Permission\n\t */\n\tpublic static function registerPermission(Permission $perm, Permission $parent = null){\n\t\tif($parent instanceof Permission){\n\t\t\t$parent->getChildren()[$perm->getName()] = true;\n\n\t\t\treturn self::registerPermission($perm);\n\t\t}\n\t\tServer::getInstance()->getPluginManager()->addPermission($perm);\n\n\t\treturn Server::getInstance()->getPluginManager()->getPermission($perm->getName());\n\t}\n\n\tpublic static function registerCorePermissions(){\n\t\t$parent = self::registerPermission(new Permission(self::ROOT, \"Allows using all PocketMine commands and utilities\"));\n\n\t\t$broadcasts = self::registerPermission(new Permission(self::ROOT . \".broadcast\", \"Allows the user to receive all broadcast messages\"), $parent);\n\n\t\tself::registerPermission(new Permission(self::ROOT . \".broadcast.admin\", \"Allows the user to receive administrative broadcasts\", Permission::DEFAULT_OP), $broadcasts);\n\t\tself::registerPermission(new Permission(self::ROOT . \".broadcast.user\", \"Allows the user to receive user broadcasts\", Permission::DEFAULT_TRUE), $broadcasts);\n\n\t\t$broadcasts->recalculatePermissibles();\n\n\t\t$commands = self::registerPermission(new Permission(self::ROOT . \".command\", \"Allows using all PocketMine commands\"), $parent);\n\n\t\t$whitelist = self::registerPermission(new Permission(self::ROOT . \".command.whitelist\", \"Allows the user to modify the server whitelist\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.whitelist.add\", \"Allows the user to add a player to the server whitelist\"), $whitelist);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.whitelist.remove\", \"Allows the user to remove a player to the server whitelist\"), $whitelist);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.whitelist.reload\", \"Allows the user to reload the server whitelist\"), $whitelist);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.whitelist.enable\", \"Allows the user to enable the server whitelist\"), $whitelist);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.whitelist.disable\", \"Allows the user to disable the server whitelist\"), $whitelist);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.whitelist.list\", \"Allows the user to list all the players on the server whitelist\"), $whitelist);\n\t\t$whitelist->recalculatePermissibles();\n\n\t\t$ban = self::registerPermission(new Permission(self::ROOT . \".command.ban\", \"Allows the user to ban people\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.ban.player\", \"Allows the user to ban players\"), $ban);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.ban.ip\", \"Allows the user to ban IP addresses\"), $ban);\n\t\t$ban->recalculatePermissibles();\n\n\t\t$unban = self::registerPermission(new Permission(self::ROOT . \".command.unban\", \"Allows the user to unban people\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.unban.player\", \"Allows the user to unban players\"), $unban);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.unban.ip\", \"Allows the user to unban IP addresses\"), $unban);\n\t\t$unban->recalculatePermissibles();\n\n\t\t$op = self::registerPermission(new Permission(self::ROOT . \".command.op\", \"Allows the user to change operators\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.op.give\", \"Allows the user to give a player operator status\"), $op);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.op.take\", \"Allows the user to take a players operator status\"), $op);\n\t\t$op->recalculatePermissibles();\n\n\t\t$save = self::registerPermission(new Permission(self::ROOT . \".command.save\", \"Allows the user to save the worlds\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.save.enable\", \"Allows the user to enable automatic saving\"), $save);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.save.disable\", \"Allows the user to disable automatic saving\"), $save);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.save.perform\", \"Allows the user to perform a manual save\"), $save);\n\t\t$save->recalculatePermissibles();\n\n\t\t$time = self::registerPermission(new Permission(self::ROOT . \".command.time\", \"Allows the user to alter the time\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.time.add\", \"Allows the user to fast-forward time\"), $time);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.time.set\", \"Allows the user to change the time\"), $time);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.time.start\", \"Allows the user to restart the time\"), $time);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.time.stop\", \"Allows the user to stop the time\"), $time);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.time.query\", \"Allows the user query the time\"), $time);\n\t\t$time->recalculatePermissibles();\n\n\t\t$kill = self::registerPermission(new Permission(self::ROOT . \".command.kill\", \"Allows the user to kill players\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.kill.self\", \"Allows the user to commit suicide\", Permission::DEFAULT_TRUE), $kill);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.kill.other\", \"Allows the user to kill other players\"), $kill);\n\t\t$kill->recalculatePermissibles();\n\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.me\", \"Allows the user to perform a chat action\", Permission::DEFAULT_TRUE), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.tell\", \"Allows the user to privately message another player\", Permission::DEFAULT_TRUE), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.say\", \"Allows the user to talk as the console\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.give\", \"Allows the user to give items to players\", Permission::DEFAULT_OP), $commands);\n\t\t\n\t\t$effect = self::registerPermission(new Permission(self::ROOT . \".command.effect\", \"Allows the user to give/take potion effects\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.effect.other\", \"Allows the user to give/take potion effects for other\", Permission::DEFAULT_OP), $commands);\n\t\t$effect->recalculatePermissibles();\n\t\t\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.enchant\", \"Allows the user to enchant items\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.particle\", \"Allows the user to create particle effects\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.teleport\", \"Allows the user to teleport players\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.kick\", \"Allows the user to kick players\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.stop\", \"Allows the user to stop the server\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.list\", \"Allows the user to list all online players\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.help\", \"Allows the user to view the help menu\", Permission::DEFAULT_TRUE), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.plugins\", \"Allows the user to view the list of plugins\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.reload\", \"Allows the user to reload the server settings\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.version\", \"Allows the user to view the version of the server\", Permission::DEFAULT_TRUE), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.gamemode\", \"Allows the user to change the gamemode of players\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.defaultgamemode\", \"Allows the user to change the default gamemode\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.seed\", \"Allows the user to view the seed of the world\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.status\", \"Allows the user to view the server performance\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.gc\", \"Allows the user to fire garbage collection tasks\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.dumpmemory\", \"Allows the user to dump memory contents\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.timings\", \"Allows the user to records timings for all plugin events\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.spawnpoint\", \"Allows the user to change player's spawnpoint\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.setworldspawn\", \"Allows the user to change the world spawn\", Permission::DEFAULT_OP), $commands);\n\t\t\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.extractphar\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.extractplugin\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.makeplugin\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.makeserver\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.bancid\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.pardoncid\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.bancidbyname\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.banipbyname\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.weather\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.loadplugin\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.lvdat\", \"\", Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.biome\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.cave\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.setblock\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.fill\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.summon\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.xp\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.chunkinfo\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\tself::registerPermission(new Permission(self::ROOT . \".command.transfer\", \"\" , Permission::DEFAULT_OP), $commands);\n\t\t\n\t\t$commands->recalculatePermissibles();\n\n\t\t$parent->recalculatePermissibles();\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/permission/Permissible.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\nuse pocketmine\\plugin\\Plugin;\n\ninterface Permissible extends ServerOperator{\n\n\t/**\n\t * Checks if this instance has a permission overridden\n\t *\n\t * @param string|Permission $name\n\t *\n\t * @return boolean\n\t */\n\tpublic function isPermissionSet($name);\n\n\t/**\n\t * Returns the permission value if overridden, or the default value if not\n\t *\n\t * @param string|Permission $name\n\t *\n\t * @return mixed\n\t */\n\tpublic function hasPermission($name);\n\n\t/**\n\t * @param Plugin $plugin\n\t * @param string $name\n\t * @param bool   $value\n\t *\n\t * @return PermissionAttachment\n\t */\n\tpublic function addAttachment(Plugin $plugin, $name = null, $value = null);\n\n\t/**\n\t * @param PermissionAttachment $attachment\n\t *\n\t * @return void\n\t */\n\tpublic function removeAttachment(PermissionAttachment $attachment);\n\n\n\t/**\n\t * @return void\n\t */\n\tpublic function recalculatePermissions();\n\n\t/**\n\t * @return Permission[]\n\t */\n\tpublic function getEffectivePermissions();\n\n}"
  },
  {
    "path": "src/pocketmine/permission/PermissibleBase.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\nuse pocketmine\\event\\Timings;\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\PluginException;\n\nclass PermissibleBase implements Permissible{\n\t/** @var ServerOperator */\n\tprivate $opable = null;\n\n\t/** @var Permissible */\n\tprivate $parent = null;\n\n\t/**\n\t * @var PermissionAttachment[]\n\t */\n\tprivate $attachments = [];\n\n\t/**\n\t * @var PermissionAttachmentInfo[]\n\t */\n\tprivate $permissions = [];\n\n\t/**\n\t * @param ServerOperator $opable\n\t */\n\tpublic function __construct(ServerOperator $opable){\n\t\t$this->opable = $opable;\n\t\tif($opable instanceof Permissible){\n\t\t\t$this->parent = $opable;\n\t\t}\n\t}\n\n\tpublic function __destruct(){\n\t\t$this->parent = null;\n\t\t$this->opable = null;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isOp(){\n\t\tif($this->opable === null){\n\t\t\treturn false;\n\t\t}else{\n\t\t\treturn $this->opable->isOp();\n\t\t}\n\t}\n\n\t/**\n\t * @param bool $value\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function setOp($value){\n\t\tif($this->opable === null){\n\t\t\tthrow new \\LogicException(\"Cannot change op value as no ServerOperator is set\");\n\t\t}else{\n\t\t\t$this->opable->setOp($value);\n\t\t}\n\t}\n\n\t/**\n\t * @param Permission|string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function isPermissionSet($name){\n\t\treturn isset($this->permissions[$name instanceof Permission ? $name->getName() : $name]);\n\t}\n\n\t/**\n\t * @param Permission|string $name\n\t *\n\t * @return bool\n\t */\n\tpublic function hasPermission($name){\n\t\tif($name instanceof Permission){\n\t\t\t$name = $name->getName();\n\t\t}\n\n\t\tif($this->isPermissionSet($name)){\n\t\t\treturn $this->permissions[$name]->getValue();\n\t\t}\n\n\t\tif(($perm = Server::getInstance()->getPluginManager()->getPermission($name)) !== null){\n\t\t\t$perm = $perm->getDefault();\n\n\t\t\treturn $perm === Permission::DEFAULT_TRUE or ($this->isOp() and $perm === Permission::DEFAULT_OP) or (!$this->isOp() and $perm === Permission::DEFAULT_NOT_OP);\n\t\t}else{\n\t\t\treturn Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_TRUE or ($this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_OP) or (!$this->isOp() and Permission::$DEFAULT_PERMISSION === Permission::DEFAULT_NOT_OP);\n\t\t}\n\n\t}\n\n\t/**\n\t * //TODO: tick scheduled attachments\n\t *\n\t * @param Plugin $plugin\n\t * @param string $name\n\t * @param bool   $value\n\t *\n\t * @return PermissionAttachment\n\t *\n\t * @throws PluginException\n\t */\n\tpublic function addAttachment(Plugin $plugin, $name = null, $value = null){\n\t\tif($plugin === null){\n\t\t\tthrow new PluginException(\"Plugin cannot be null\");\n\t\t}elseif(!$plugin->isEnabled()){\n\t\t\tthrow new PluginException(\"Plugin \" . $plugin->getDescription()->getName() . \" is disabled\");\n\t\t}\n\n\t\t$result = new PermissionAttachment($plugin, $this->parent !== null ? $this->parent : $this);\n\t\t$this->attachments[spl_object_hash($result)] = $result;\n\t\tif($name !== null and $value !== null){\n\t\t\t$result->setPermission($name, $value);\n\t\t}\n\n\t\t$this->recalculatePermissions();\n\n\t\treturn $result;\n\t}\n\n\t/**\n\t * @param PermissionAttachment $attachment\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function removeAttachment(PermissionAttachment $attachment){\n\t\tif($attachment === null){\n\t\t\tthrow new \\InvalidStateException(\"Attachment cannot be null\");\n\t\t}\n\n\t\tif(isset($this->attachments[spl_object_hash($attachment)])){\n\t\t\tunset($this->attachments[spl_object_hash($attachment)]);\n\t\t\tif(($ex = $attachment->getRemovalCallback()) !== null){\n\t\t\t\t$ex->attachmentRemoved($attachment);\n\t\t\t}\n\n\t\t\t$this->recalculatePermissions();\n\n\t\t}\n\n\t}\n\n\tpublic function recalculatePermissions(){\n\t\tTimings::$permissibleCalculationTimer->startTiming();\n\n\t\t$this->clearPermissions();\n\t\t$defaults = Server::getInstance()->getPluginManager()->getDefaultPermissions($this->isOp());\n\t\tServer::getInstance()->getPluginManager()->subscribeToDefaultPerms($this->isOp(), $this->parent !== null ? $this->parent : $this);\n\n\t\tforeach($defaults as $perm){\n\t\t\t$name = $perm->getName();\n\t\t\t$this->permissions[$name] = new PermissionAttachmentInfo($this->parent !== null ? $this->parent : $this, $name, null, true);\n\t\t\tServer::getInstance()->getPluginManager()->subscribeToPermission($name, $this->parent !== null ? $this->parent : $this);\n\t\t\t$this->calculateChildPermissions($perm->getChildren(), false, null);\n\t\t}\n\n\t\tforeach($this->attachments as $attachment){\n\t\t\t$this->calculateChildPermissions($attachment->getPermissions(), false, $attachment);\n\t\t}\n\n\t\tTimings::$permissibleCalculationTimer->stopTiming();\n\t}\n\n\tpublic function clearPermissions(){\n\t\tforeach(array_keys($this->permissions) as $name){\n\t\t\tServer::getInstance()->getPluginManager()->unsubscribeFromPermission($name, $this->parent !== null ? $this->parent : $this);\n\t\t}\n\n\t\tServer::getInstance()->getPluginManager()->unsubscribeFromDefaultPerms(false, $this->parent !== null ? $this->parent : $this);\n\t\tServer::getInstance()->getPluginManager()->unsubscribeFromDefaultPerms(true, $this->parent !== null ? $this->parent : $this);\n\n\t\t$this->permissions = [];\n\t}\n\n\t/**\n\t * @param bool[]               $children\n\t * @param bool                 $invert\n\t * @param PermissionAttachment $attachment\n\t */\n\tprivate function calculateChildPermissions(array $children, $invert, $attachment){\n\t\tforeach($children as $name => $v){\n\t\t\t$perm = Server::getInstance()->getPluginManager()->getPermission($name);\n\t\t\t$value = ($v xor $invert);\n\t\t\t$this->permissions[$name] = new PermissionAttachmentInfo($this->parent !== null ? $this->parent : $this, $name, $attachment, $value);\n\t\t\tServer::getInstance()->getPluginManager()->subscribeToPermission($name, $this->parent !== null ? $this->parent : $this);\n\n\t\t\tif($perm instanceof Permission){\n\t\t\t\t$this->calculateChildPermissions($perm->getChildren(), !$value, $attachment);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return PermissionAttachmentInfo[]\n\t */\n\tpublic function getEffectivePermissions(){\n\t\treturn $this->permissions;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/permission/Permission.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Permission related classes\n */\nnamespace pocketmine\\permission;\n\nuse pocketmine\\Server;\n\n/**\n * Represents a permission\n */\nclass Permission{\n\tconst DEFAULT_OP = \"op\";\n\tconst DEFAULT_NOT_OP = \"notop\";\n\tconst DEFAULT_TRUE = \"true\";\n\tconst DEFAULT_FALSE = \"false\";\n\n\tpublic static $DEFAULT_PERMISSION = self::DEFAULT_OP;\n\n\t/**\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function getByName($value){\n\t\tif(is_bool($value)){\n\t\t\tif($value === true){\n\t\t\t\treturn \"true\";\n\t\t\t}else{\n\t\t\t\treturn \"false\";\n\t\t\t}\n\t\t}\n\t\tswitch(strtolower($value)){\n\t\t\tcase \"op\":\n\t\t\tcase \"isop\":\n\t\t\tcase \"operator\":\n\t\t\tcase \"isoperator\":\n\t\t\tcase \"admin\":\n\t\t\tcase \"isadmin\":\n\t\t\t\treturn self::DEFAULT_OP;\n\n\t\t\tcase \"!op\":\n\t\t\tcase \"notop\":\n\t\t\tcase \"!operator\":\n\t\t\tcase \"notoperator\":\n\t\t\tcase \"!admin\":\n\t\t\tcase \"notadmin\":\n\t\t\t\treturn self::DEFAULT_NOT_OP;\n\n\t\t\tcase \"true\":\n\t\t\t\treturn self::DEFAULT_TRUE;\n\n\t\t\tdefault:\n\t\t\t\treturn self::DEFAULT_FALSE;\n\t\t}\n\t}\n\n\t/** @var string */\n\tprivate $name;\n\n\t/** @var string */\n\tprivate $description;\n\n\t/**\n\t * @var string[]\n\t */\n\tprivate $children = [];\n\n\t/** @var string */\n\tprivate $defaultValue;\n\n\t/**\n\t * Creates a new Permission object to be attached to Permissible objects\n\t *\n\t * @param string       $name\n\t * @param string       $description\n\t * @param string       $defaultValue\n\t * @param Permission[] $children\n\t */\n\tpublic function __construct($name, $description = null, $defaultValue = null, array $children = []){\n\t\t$this->name = $name;\n\t\t$this->description = $description !== null ? $description : \"\";\n\t\t$this->defaultValue = $defaultValue !== null ? $defaultValue : self::$DEFAULT_PERMISSION;\n\t\t$this->children = $children;\n\n\t\t$this->recalculatePermissibles();\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName(){\n\t\treturn $this->name;\n\t}\n\n\t/**\n\t * @return string[]\n\t */\n\tpublic function &getChildren(){\n\t\treturn $this->children;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getDefault(){\n\t\treturn $this->defaultValue;\n\t}\n\n\t/**\n\t * @param string $value\n\t */\n\tpublic function setDefault($value){\n\t\tif($value !== $this->defaultValue){\n\t\t\t$this->defaultValue = $value;\n\t\t\t$this->recalculatePermissibles();\n\t\t}\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getDescription(){\n\t\treturn $this->description;\n\t}\n\n\t/**\n\t * @param string $value\n\t */\n\tpublic function setDescription($value){\n\t\t$this->description = $value;\n\t}\n\n\t/**\n\t * @return Permissible[]\n\t */\n\tpublic function getPermissibles(){\n\t\treturn Server::getInstance()->getPluginManager()->getPermissionSubscriptions($this->name);\n\t}\n\n\tpublic function recalculatePermissibles(){\n\t\t$perms = $this->getPermissibles();\n\n\t\tServer::getInstance()->getPluginManager()->recalculatePermissionDefaults($this);\n\n\t\tforeach($perms as $p){\n\t\t\t$p->recalculatePermissions();\n\t\t}\n\t}\n\n\n\t/**\n\t * @param string|Permission $name\n\t * @param                   $value\n\t *\n\t * @return Permission|void Permission if $name is a string, void if it's a Permission\n\t */\n\tpublic function addParent($name, $value){\n\t\tif($name instanceof Permission){\n\t\t\t$name->getChildren()[$this->getName()] = $value;\n\t\t\t$name->recalculatePermissibles();\n\t\t\treturn;\n\t\t}else{\n\t\t\t$perm = Server::getInstance()->getPluginManager()->getPermission($name);\n\t\t\tif($perm === null){\n\t\t\t\t$perm = new Permission($name);\n\t\t\t\tServer::getInstance()->getPluginManager()->addPermission($perm);\n\t\t\t}\n\n\t\t\t$this->addParent($perm, $value);\n\n\t\t\treturn $perm;\n\t\t}\n\t}\n\n\t/**\n\t * @param array $data\n\t * @param       $default\n\t *\n\t * @return Permission[]\n\t */\n\tpublic static function loadPermissions(array $data, $default = self::DEFAULT_OP){\n\t\t$result = [];\n\t\tforeach($data as $key => $entry){\n\t\t\t$result[] = self::loadPermission($key, $entry, $default, $result);\n\t\t}\n\n\t\treturn $result;\n\t}\n\n\t/**\n\t * @param string $name\n\t * @param array  $data\n\t * @param string $default\n\t * @param array  $output\n\t *\n\t * @return Permission\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic static function loadPermission($name, array $data, $default = self::DEFAULT_OP, &$output = []){\n\t\t$desc = null;\n\t\t$children = [];\n\t\tif(isset($data[\"default\"])){\n\t\t\t$value = Permission::getByName($data[\"default\"]);\n\t\t\tif($value !== null){\n\t\t\t\t$default = $value;\n\t\t\t}else{\n\t\t\t\tthrow new \\InvalidStateException(\"'default' key contained unknown value\");\n\t\t\t}\n\t\t}\n\n\t\tif(isset($data[\"children\"])){\n\t\t\tif(is_array($data[\"children\"])){\n\t\t\t\tforeach($data[\"children\"] as $k => $v){\n\t\t\t\t\tif(is_array($v)){\n\t\t\t\t\t\tif(($perm = self::loadPermission($k, $v, $default, $output)) !== null){\n\t\t\t\t\t\t\t$output[] = $perm;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$children[$k] = true;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tthrow new \\InvalidStateException(\"'children' key is of wrong type\");\n\t\t\t}\n\t\t}\n\n\t\tif(isset($data[\"description\"])){\n\t\t\t$desc = $data[\"description\"];\n\t\t}\n\n\t\treturn new Permission($name, $desc, $default, $children);\n\n\t}\n\n\n}"
  },
  {
    "path": "src/pocketmine/permission/PermissionAttachment.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\utils\\PluginException;\n\nclass PermissionAttachment{\n\t/** @var PermissionRemovedExecutor */\n\tprivate $removed = null;\n\n\t/**\n\t * @var bool[]\n\t */\n\tprivate $permissions = [];\n\n\t/** @var Permissible */\n\tprivate $permissible;\n\n\t/** @var Plugin */\n\tprivate $plugin;\n\n\t/**\n\t * @param Plugin      $plugin\n\t * @param Permissible $permissible\n\t *\n\t * @throws PluginException\n\t */\n\tpublic function __construct(Plugin $plugin, Permissible $permissible){\n\t\tif(!$plugin->isEnabled()){\n\t\t\tthrow new PluginException(\"Plugin \" . $plugin->getDescription()->getName() . \" is disabled\");\n\t\t}\n\n\t\t$this->permissible = $permissible;\n\t\t$this->plugin = $plugin;\n\t}\n\n\t/**\n\t * @return Plugin\n\t */\n\tpublic function getPlugin(){\n\t\treturn $this->plugin;\n\t}\n\n\t/**\n\t * @param PermissionRemovedExecutor $ex\n\t */\n\tpublic function setRemovalCallback(PermissionRemovedExecutor $ex){\n\t\t$this->removed = $ex;\n\t}\n\n\t/**\n\t * @return PermissionRemovedExecutor\n\t */\n\tpublic function getRemovalCallback(){\n\t\treturn $this->removed;\n\t}\n\n\t/**\n\t * @return Permissible\n\t */\n\tpublic function getPermissible(){\n\t\treturn $this->permissible;\n\t}\n\n\t/**\n\t * @return bool[]\n\t */\n\tpublic function getPermissions(){\n\t\treturn $this->permissions;\n\t}\n\n\t/**\n\t * @return bool[]\n\t */\n\tpublic function clearPermissions(){\n\t\t$this->permissions = [];\n\t\t$this->permissible->recalculatePermissions();\n\t}\n\n\t/**\n\t * @param bool[] $permissions\n\t */\n\tpublic function setPermissions(array $permissions){\n\t\tforeach($permissions as $key => $value){\n\t\t\t$this->permissions[$key] = (bool) $value;\n\t\t}\n\t\t$this->permissible->recalculatePermissions();\n\t}\n\n\t/**\n\t * @param string[] $permissions\n\t */\n\tpublic function unsetPermissions(array $permissions){\n\t\tforeach($permissions as $node){\n\t\t\tunset($this->permissions[$node]);\n\t\t}\n\t\t$this->permissible->recalculatePermissions();\n\t}\n\n\t/**\n\t * @param string|Permission $name\n\t * @param bool              $value\n\t */\n\tpublic function setPermission($name, $value){\n\t\t$name = $name instanceof Permission ? $name->getName() : $name;\n\t\tif(isset($this->permissions[$name])){\n\t\t\tif($this->permissions[$name] === $value){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tunset($this->permissions[$name]); //Fixes children getting overwritten\n\t\t}\n\t\t$this->permissions[$name] = $value;\n\t\t$this->permissible->recalculatePermissions();\n\t}\n\n\t/**\n\t * @param string|Permission $name\n\t */\n\tpublic function unsetPermission($name){\n\t\t$name = $name instanceof Permission ? $name->getName() : $name;\n\t\tif(isset($this->permissions[$name])){\n\t\t\tunset($this->permissions[$name]);\n\t\t\t$this->permissible->recalculatePermissions();\n\t\t}\n\t}\n\n\t/**\n\t * @return void\n\t */\n\tpublic function remove(){\n\t\t$this->permissible->removeAttachment($this);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/permission/PermissionAttachmentInfo.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\n\nclass PermissionAttachmentInfo{\n\t/** @var Permissible */\n\tprivate $permissible;\n\n\t/** @var string */\n\tprivate $permission;\n\n\t/** @var PermissionAttachment */\n\tprivate $attachment;\n\n\t/** @var bool */\n\tprivate $value;\n\n\t/**\n\t * @param Permissible          $permissible\n\t * @param string               $permission\n\t * @param PermissionAttachment $attachment\n\t * @param bool                 $value\n\t *\n\t * @throws \\InvalidStateException\n\t */\n\tpublic function __construct(Permissible $permissible, $permission, $attachment, $value){\n\t\tif($permission === null){\n\t\t\tthrow new \\InvalidStateException(\"Permission may not be null\");\n\t\t}\n\n\t\t$this->permissible = $permissible;\n\t\t$this->permission = $permission;\n\t\t$this->attachment = $attachment;\n\t\t$this->value = $value;\n\t}\n\n\t/**\n\t * @return Permissible\n\t */\n\tpublic function getPermissible(){\n\t\treturn $this->permissible;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getPermission(){\n\t\treturn $this->permission;\n\t}\n\n\t/**\n\t * @return PermissionAttachment\n\t */\n\tpublic function getAttachment(){\n\t\treturn $this->attachment;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function getValue(){\n\t\treturn $this->value;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/permission/PermissionRemovedExecutor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\n\ninterface PermissionRemovedExecutor{\n\n\t/**\n\t * @param PermissionAttachment $attachment\n\t *\n\t * @return void\n\t */\n\tpublic function attachmentRemoved(PermissionAttachment $attachment);\n}"
  },
  {
    "path": "src/pocketmine/permission/ServerOperator.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\permission;\n\n\ninterface ServerOperator{\n\t/**\n\t * Checks if the current object has operator permissions\n\t *\n\t * @return bool\n\t */\n\tpublic function isOp();\n\n\t/**\n\t * Sets the operator permission for the current object\n\t *\n\t * @param bool $value\n\t *\n\t * @return void\n\t */\n\tpublic function setOp($value);\n}"
  },
  {
    "path": "src/pocketmine/plugin/EventExecutor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\event\\Event;\nuse pocketmine\\event\\Listener;\n\ninterface EventExecutor{\n\n\t/**\n\t * @param Listener $listener\n\t * @param Event    $event\n\t *\n\t * @return void\n\t */\n\tpublic function execute(Listener $listener, Event $event);\n}"
  },
  {
    "path": "src/pocketmine/plugin/MethodEventExecutor.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\event\\Event;\nuse pocketmine\\event\\Listener;\n\nclass MethodEventExecutor implements EventExecutor{\n\n\tprivate $method;\n\n\tpublic function __construct($method){\n\t\t$this->method = $method;\n\t}\n\n\tpublic function execute(Listener $listener, Event $event){\n\t\t$listener->{$this->getMethod()}($event);\n\t}\n\n\tpublic function getMethod(){\n\t\treturn $this->method;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/plugin/PharPluginLoader.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\event\\plugin\\PluginDisableEvent;\nuse pocketmine\\event\\plugin\\PluginEnableEvent;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\PluginException;\n\n/**\n * Handles different types of plugins\n */\nclass PharPluginLoader implements PluginLoader{\n\n\t/** @var Server */\n\tprivate $server;\n\n\t/**\n\t * @param Server $server\n\t */\n\tpublic function __construct(Server $server){\n\t\t$this->server = $server;\n\t}\n\n\t/**\n\t * Loads the plugin contained in $file\n\t *\n\t * @param string $file\n\t *\n\t * @return Plugin\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function loadPlugin($file){\n\t\tif(($description = $this->getPluginDescription($file)) instanceof PluginDescription){\n\t\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.plugin.load\", [$description->getFullName()]));\n\t\t\t$dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();\n\t\t\tif(file_exists($dataFolder) and !is_dir($dataFolder)){\n\t\t\t\tthrow new \\InvalidStateException(\"Projected dataFolder '\" . $dataFolder . \"' for \" . $description->getName() . \" exists and is not a directory\");\n\t\t\t}\n\t\t\t$file = \"phar://$file\";\n\t\t\t$className = $description->getMain();\n\t\t\t$this->server->getLoader()->addPath(\"$file/src\");\n\n\t\t\tif(class_exists($className, true)){\n\t\t\t\t$plugin = new $className();\n\t\t\t\t$this->initPlugin($plugin, $description, $dataFolder, $file);\n\n\t\t\t\treturn $plugin;\n\t\t\t}else{\n\t\t\t\tthrow new PluginException(\"Couldn't load plugin \" . $description->getName() . \": main class not found\");\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Gets the PluginDescription from the file\n\t *\n\t * @param string $file\n\t *\n\t * @return PluginDescription\n\t */\n\tpublic function getPluginDescription($file){\n\t\t$phar = new \\Phar($file);\n\t\tif(isset($phar[\"plugin.yml\"])){\n\t\t\t$pluginYml = $phar[\"plugin.yml\"];\n\t\t\tif($pluginYml instanceof \\PharFileInfo){\n\t\t\t\treturn new PluginDescription($pluginYml->getContent());\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Returns the filename patterns that this loader accepts\n\t *\n\t * @return array\n\t */\n\tpublic function getPluginFilters(){\n\t\treturn \"/\\\\.phar$/i\";\n\t}\n\n\t/**\n\t * @param PluginBase        $plugin\n\t * @param PluginDescription $description\n\t * @param string            $dataFolder\n\t * @param string            $file\n\t */\n\tprivate function initPlugin(PluginBase $plugin, PluginDescription $description, $dataFolder, $file){\n\t\t$plugin->init($this, $this->server, $description, $dataFolder, $file);\n\t\t$plugin->onLoad();\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function enablePlugin(Plugin $plugin){\n\t\tif($plugin instanceof PluginBase and !$plugin->isEnabled()){\n\t\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.plugin.enable\", [$plugin->getDescription()->getFullName()]));\n\n\t\t\t$plugin->setEnabled(true);\n\n\t\t\t$this->server->getPluginManager()->callEvent(new PluginEnableEvent($plugin));\n\t\t}\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function disablePlugin(Plugin $plugin){\n\t\tif($plugin instanceof PluginBase and $plugin->isEnabled()){\n\t\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.plugin.disable\", [$plugin->getDescription()->getFullName()]));\n\n\t\t\t$this->server->getPluginManager()->callEvent(new PluginDisableEvent($plugin));\n\n\t\t\t$plugin->setEnabled(false);\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/plugin/Plugin.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Plugin related classes\n */\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\command\\CommandExecutor;\n\n\n/**\n * It is recommended to use PluginBase for the actual plugin\n *\n */\ninterface Plugin extends CommandExecutor{\n\n\t/**\n\t * Called when the plugin is loaded, before calling onEnable()\n\t */\n\tpublic function onLoad();\n\n\t/**\n\t * Called when the plugin is enabled\n\t */\n\tpublic function onEnable();\n\n\tpublic function isEnabled();\n\n\t/**\n\t * Called when the plugin is disabled\n\t * Use this to free open things and finish actions\n\t */\n\tpublic function onDisable();\n\n\tpublic function isDisabled();\n\n\t/**\n\t * Gets the plugin's data folder to save files and configuration\n\t */\n\tpublic function getDataFolder();\n\n\t/**\n\t * @return PluginDescription\n\t */\n\tpublic function getDescription();\n\n\t/**\n\t * Gets an embedded resource in the plugin file.\n\t *\n\t * @param string $filename\n\t */\n\tpublic function getResource($filename);\n\n\t/**\n\t * Saves an embedded resource to its relative location in the data folder\n\t *\n\t * @param string $filename\n\t * @param bool   $replace\n\t */\n\tpublic function saveResource($filename, $replace = false);\n\n\t/**\n\t * Returns all the resources packaged with the plugin\n\t */\n\tpublic function getResources();\n\n\t/**\n\t * @return \\pocketmine\\utils\\Config\n\t */\n\tpublic function getConfig();\n\n\tpublic function saveConfig();\n\n\tpublic function saveDefaultConfig();\n\n\tpublic function reloadConfig();\n\n\t/**\n\t * @return \\pocketmine\\Server\n\t */\n\tpublic function getServer();\n\n\tpublic function getName();\n\n\t/**\n\t * @return PluginLogger\n\t */\n\tpublic function getLogger();\n\n\t/**\n\t * @return PluginLoader\n\t */\n\tpublic function getPluginLoader();\n\n}"
  },
  {
    "path": "src/pocketmine/plugin/PluginBase.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\command\\Command;\nuse pocketmine\\command\\CommandSender;\nuse pocketmine\\command\\PluginIdentifiableCommand;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\Config;\n\nabstract class PluginBase implements Plugin{\n\n\t/** @var PluginLoader */\n\tprivate $loader;\n\n\t/** @var \\pocketmine\\Server */\n\tprivate $server;\n\n\t/** @var bool */\n\tprivate $isEnabled = false;\n\n\t/** @var bool */\n\tprivate $initialized = false;\n\n\t/** @var PluginDescription */\n\tprivate $description;\n\n\t/** @var string */\n\tprivate $dataFolder;\n\tprivate $config;\n\t/** @var string */\n\tprivate $configFile;\n\tprivate $file;\n\n\t/** @var PluginLogger */\n\tprivate $logger;\n\n\t/**\n\t * Called when the plugin is loaded, before calling onEnable()\n\t */\n\tpublic function onLoad(){\n\n\t}\n\n\tpublic function onEnable(){\n\n\t}\n\n\tpublic function onDisable(){\n\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic final function isEnabled(){\n\t\treturn $this->isEnabled === true;\n\t}\n\n\t/**\n\t * @param bool $boolean\n\t */\n\tpublic final function setEnabled($boolean = true){\n\t\tif($this->isEnabled !== $boolean){\n\t\t\t$this->isEnabled = $boolean;\n\t\t\tif($this->isEnabled === true){\n\t\t\t\t$this->onEnable();\n\t\t\t}else{\n\t\t\t\t$this->onDisable();\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic final function isDisabled(){\n\t\treturn $this->isEnabled === false;\n\t}\n\n\tpublic final function getDataFolder(){\n\t\treturn $this->dataFolder;\n\t}\n\n\tpublic final function getDescription(){\n\t\treturn $this->description;\n\t}\n\n\tpublic final function init(PluginLoader $loader, Server $server, PluginDescription $description, $dataFolder, $file){\n\t\tif($this->initialized === false){\n\t\t\t$this->initialized = true;\n\t\t\t$this->loader = $loader;\n\t\t\t$this->server = $server;\n\t\t\t$this->description = $description;\n\t\t\t$this->dataFolder = rtrim($dataFolder, \"\\\\/\") . \"/\";\n\t\t\t$this->file = rtrim($file, \"\\\\/\") . \"/\";\n\t\t\t$this->configFile = $this->dataFolder . \"config.yml\";\n\t\t\t$this->logger = new PluginLogger($this);\n\t\t}\n\t}\n\n\t/**\n\t * @return PluginLogger\n\t */\n\tpublic function getLogger(){\n\t\treturn $this->logger;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic final function isInitialized(){\n\t\treturn $this->initialized;\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return Command|PluginIdentifiableCommand\n\t */\n\tpublic function getCommand($name){\n\t\t$command = $this->getServer()->getPluginCommand($name);\n\t\tif($command === null or $command->getPlugin() !== $this){\n\t\t\t$command = $this->getServer()->getPluginCommand(strtolower($this->description->getName()) . \":\" . $name);\n\t\t}\n\n\t\tif($command instanceof PluginIdentifiableCommand and $command->getPlugin() === $this){\n\t\t\treturn $command;\n\t\t}else{\n\t\t\treturn null;\n\t\t}\n\t}\n\n\t/**\n\t * @param CommandSender $sender\n\t * @param Command       $command\n\t * @param string        $label\n\t * @param array         $args\n\t *\n\t * @return bool\n\t */\n\tpublic function onCommand(CommandSender $sender, Command $command, $label, array $args){\n\t\treturn false;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tprotected function isPhar(){\n\t\treturn substr($this->file, 0, 7) === \"phar://\";\n\t}\n\n\t/**\n\t * Gets an embedded resource on the plugin file.\n\t * WARNING: You must close the resource given using fclose()\n\t *\n\t * @param string $filename\n\t *\n\t * @return resource Resource data, or null\n\t */\n\tpublic function getResource($filename){\n\t\t$filename = rtrim(str_replace(\"\\\\\", \"/\", $filename), \"/\");\n\t\tif(file_exists($this->file . \"resources/\" . $filename)){\n\t\t\treturn fopen($this->file . \"resources/\" . $filename, \"rb\");\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param string $filename\n\t * @param bool   $replace\n\t *\n\t * @return bool\n\t */\n\tpublic function saveResource($filename, $replace = false){\n\t\tif(trim($filename) === \"\"){\n\t\t\treturn false;\n\t\t}\n\n\t\tif(($resource = $this->getResource($filename)) === null){\n\t\t\treturn false;\n\t\t}\n\n\t\t$out = $this->dataFolder . $filename;\n\t\tif(!file_exists(dirname($out))){\n\t\t\tmkdir(dirname($out), 0755, true);\n\t\t}\n\n\t\tif(file_exists($out) and $replace !== true){\n\t\t\treturn false;\n\t\t}\n\n\t\t$ret = stream_copy_to_stream($resource, $fp = fopen($out, \"wb\")) > 0;\n\t\tfclose($fp);\n\t\tfclose($resource);\n\t\treturn $ret;\n\t}\n\n\t/**\n\t * Returns all the resources packaged with the plugin\n\t *\n\t * @return string[]\n\t */\n\tpublic function getResources(){\n\t\t$resources = [];\n\t\tif(is_dir($this->file . \"resources/\")){\n\t\t\tforeach(new \\RecursiveIteratorIterator(new \\RecursiveDirectoryIterator($this->file . \"resources/\")) as $resource){\n\t\t\t\t$resources[] = $resource;\n\t\t\t}\n\t\t}\n\n\t\treturn $resources;\n\t}\n\n\t/**\n\t * @return Config\n\t */\n\tpublic function getConfig(){\n\t\tif(!isset($this->config)){\n\t\t\t$this->reloadConfig();\n\t\t}\n\n\t\treturn $this->config;\n\t}\n\n\tpublic function saveConfig(){\n\t\tif($this->getConfig()->save() === false){\n\t\t\t$this->getLogger()->critical(\"Could not save config to \" . $this->configFile);\n\t\t}\n\t}\n\n\tpublic function saveDefaultConfig(){\n\t\tif(!file_exists($this->configFile)){\n\t\t\t$this->saveResource(\"config.yml\", false);\n\t\t}\n\t}\n\n\tpublic function reloadConfig(){\n\t\t$this->config = new Config($this->configFile);\n\t\tif(($configStream = $this->getResource(\"config.yml\")) !== null){\n\t\t\t$this->config->setDefaults(yaml_parse(config::fixYAMLIndexes(stream_get_contents($configStream))));\n\t\t\tfclose($configStream);\n\t\t}\n\t}\n\n\t/**\n\t * @return Server\n\t */\n\tpublic final function getServer(){\n\t\treturn $this->server;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic final function getName(){\n\t\treturn $this->description->getName();\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic final function getFullName(){\n\t\treturn $this->description->getFullName();\n\t}\n\n\tprotected function getFile(){\n\t\treturn $this->file;\n\t}\n\n\t/**\n\t * @return PluginLoader\n\t */\n\tpublic function getPluginLoader(){\n\t\treturn $this->loader;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/plugin/PluginDescription.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\permission\\Permission;\nuse pocketmine\\utils\\PluginException;\n\nclass PluginDescription{\n\tprivate $name;\n\tprivate $main;\n\tprivate $api;\n\tprivate $depend = [];\n\tprivate $softDepend = [];\n\tprivate $loadBefore = [];\n\tprivate $version;\n\tprivate $commands = [];\n\tprivate $description = null;\n\tprivate $authors = [];\n\tprivate $website = null;\n\tprivate $prefix = null;\n\tprivate $order = PluginLoadOrder::POSTWORLD;\n\n\tprivate $geniapi;\n\n\t/**\n\t * @var Permission[]\n\t */\n\tprivate $permissions = [];\n\n\t/**\n\t * @param string|array $yamlString\n\t */\n\tpublic function __construct($yamlString){\n\t\t$this->loadMap(!is_array($yamlString) ? \\yaml_parse($yamlString) : $yamlString);\n\t}\n\n\t/**\n\t * @param array $plugin\n\t *\n\t * @throws PluginException\n\t */\n\tprivate function loadMap(array $plugin){\n\t\t$this->name = preg_replace(\"[^A-Za-z0-9 _.-]\", \"\", $plugin[\"name\"]);\n\t\tif($this->name === \"\"){\n\t\t\tthrow new PluginException(\"Invalid PluginDescription name\");\n\t\t}\n\t\t$this->name = str_replace(\" \", \"_\", $this->name);\n\t\t$this->version = $plugin[\"version\"];\n\t\t$this->main = $plugin[\"main\"];\n\t\t$this->api = !is_array($plugin[\"api\"]) ? [$plugin[\"api\"]] : $plugin[\"api\"];\n\t\tif(!isset($plugin[\"geniapi\"])){\n\t\t\t$this->geniapi = [\"1.0.0\"];\n\t\t}else{\n\t\t\t$this->geniapi = !is_array($plugin[\"geniapi\"]) ? [$plugin[\"geniapi\"]] : $plugin[\"geniapi\"];\n\t\t}\n\n\t\tif(stripos($this->main, \"pocketmine\\\\\") === 0){\n\t\t\tthrow new PluginException(\"Invalid PluginDescription main, cannot start within the PocketMine namespace\");\n\t\t}\n\n\t\tif(isset($plugin[\"commands\"]) and is_array($plugin[\"commands\"])){\n\t\t\t$this->commands = $plugin[\"commands\"];\n\t\t}\n\n\t\tif(isset($plugin[\"depend\"])){\n\t\t\t$this->depend = (array) $plugin[\"depend\"];\n\t\t}\n\t\tif(isset($plugin[\"softdepend\"])){\n\t\t\t$this->softDepend = (array) $plugin[\"softdepend\"];\n\t\t}\n\t\tif(isset($plugin[\"loadbefore\"])){\n\t\t\t$this->loadBefore = (array) $plugin[\"loadbefore\"];\n\t\t}\n\n\t\tif(isset($plugin[\"website\"])){\n\t\t\t$this->website = $plugin[\"website\"];\n\t\t}\n\t\tif(isset($plugin[\"description\"])){\n\t\t\t$this->description = $plugin[\"description\"];\n\t\t}\n\t\tif(isset($plugin[\"prefix\"])){\n\t\t\t$this->prefix = $plugin[\"prefix\"];\n\t\t}\n\t\tif(isset($plugin[\"load\"])){\n\t\t\t$order = strtoupper($plugin[\"load\"]);\n\t\t\tif(!defined(PluginLoadOrder::class . \"::\" . $order)){\n\t\t\t\tthrow new PluginException(\"Invalid PluginDescription load\");\n\t\t\t}else{\n\t\t\t\t$this->order = constant(PluginLoadOrder::class . \"::\" . $order);\n\t\t\t}\n\t\t}\n\t\t$this->authors = [];\n\t\tif(isset($plugin[\"author\"])){\n\t\t\t$this->authors[] = $plugin[\"author\"];\n\t\t}\n\t\tif(isset($plugin[\"authors\"])){\n\t\t\tforeach($plugin[\"authors\"] as $author){\n\t\t\t\t$this->authors[] = $author;\n\t\t\t}\n\t\t}\n\n\t\tif(isset($plugin[\"permissions\"])){\n\t\t\t$this->permissions = Permission::loadPermissions($plugin[\"permissions\"]);\n\t\t}\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getFullName(){\n\t\treturn $this->name . \" v\" . $this->version;\n\t}\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getCompatibleApis(){\n\t\treturn $this->api;\n\t}\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getCompatibleGeniApis(){\n\t\treturn $this->geniapi;\n\t}\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getAuthors(){\n\t\treturn $this->authors;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getPrefix(){\n\t\treturn $this->prefix;\n\t}\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getCommands(){\n\t\treturn $this->commands;\n\t}\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getDepend(){\n\t\treturn $this->depend;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getDescription(){\n\t\treturn $this->description;\n\t}\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getLoadBefore(){\n\t\treturn $this->loadBefore;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getMain(){\n\t\treturn $this->main;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName(){\n\t\treturn $this->name;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getOrder(){\n\t\treturn $this->order;\n\t}\n\n\t/**\n\t * @return Permission[]\n\t */\n\tpublic function getPermissions(){\n\t\treturn $this->permissions;\n\t}\n\n\t/**\n\t * @return array\n\t */\n\tpublic function getSoftDepend(){\n\t\treturn $this->softDepend;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getVersion(){\n\t\treturn $this->version;\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getWebsite(){\n\t\treturn $this->website;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/plugin/PluginLoadOrder.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\n\nabstract class PluginLoadOrder{\n\t/*\n\t * The plugin will be loaded at startup\n\t */\n\tconst STARTUP = 0;\n\n\t/*\n\t * The plugin will be loaded after the first world has been loaded/created.\n\t */\n\tconst POSTWORLD = 1;\n}"
  },
  {
    "path": "src/pocketmine/plugin/PluginLoader.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\n/**\n * Handles different types of plugins\n */\ninterface PluginLoader{\n\n\t/**\n\t * Loads the plugin contained in $file\n\t *\n\t * @param string $file\n\t *\n\t * @return Plugin\n\t */\n\tpublic function loadPlugin($file);\n\n\t/**\n\t * Gets the PluginDescription from the file\n\t *\n\t * @param string $file\n\t *\n\t * @return PluginDescription\n\t */\n\tpublic function getPluginDescription($file);\n\n\t/**\n\t * Returns the filename patterns that this loader accepts\n\t *\n\t * @return string[]\n\t */\n\tpublic function getPluginFilters();\n\n\t/**\n\t * @param Plugin $plugin\n\t *\n\t * @return void\n\t */\n\tpublic function enablePlugin(Plugin $plugin);\n\n\t/**\n\t * @param Plugin $plugin\n\t *\n\t * @return void\n\t */\n\tpublic function disablePlugin(Plugin $plugin);\n\n\n}"
  },
  {
    "path": "src/pocketmine/plugin/PluginLogger.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse LogLevel;\nuse pocketmine\\Server;\n\nclass PluginLogger implements \\AttachableLogger{\n\n\tprivate $pluginName;\n\n\t/** @var \\LoggerAttachment[] */\n\tprivate $attachments = [];\n\n\tpublic function addAttachment(\\LoggerAttachment $attachment){\n\t\t$this->attachments[spl_object_hash($attachment)] = $attachment;\n\t}\n\n\tpublic function removeAttachment(\\LoggerAttachment $attachment){\n\t\tunset($this->attachments[spl_object_hash($attachment)]);\n\t}\n\n\tpublic function removeAttachments(){\n\t\t$this->attachments = [];\n\t}\n\n\tpublic function getAttachments(){\n\t\treturn $this->attachments;\n\t}\n\n\t/**\n\t * @param Plugin $context\n\t */\n\tpublic function __construct(Plugin $context){\n\t\t$prefix = $context->getDescription()->getPrefix();\n\t\t$this->pluginName = $prefix != null ? \"[$prefix] \" : \"[\" . $context->getDescription()->getName() . \"] \";\n\t}\n\n\tpublic function emergency($message){\n\t\t$this->log(LogLevel::EMERGENCY, $message);\n\t}\n\n\tpublic function alert($message){\n\t\t$this->log(LogLevel::ALERT, $message);\n\t}\n\n\tpublic function critical($message){\n\t\t$this->log(LogLevel::CRITICAL, $message);\n\t}\n\n\tpublic function error($message){\n\t\t$this->log(LogLevel::ERROR, $message);\n\t}\n\n\tpublic function warning($message){\n\t\t$this->log(LogLevel::WARNING, $message);\n\t}\n\n\tpublic function notice($message){\n\t\t$this->log(LogLevel::NOTICE, $message);\n\t}\n\n\tpublic function info($message){\n\t\t$this->log(LogLevel::INFO, $message);\n\t}\n\n\tpublic function debug($message){\n\t\t$this->log(LogLevel::DEBUG, $message);\n\t}\n\n\tpublic function logException(\\Throwable $e, $trace = null){\n\t\tServer::getInstance()->getLogger()->logException($e, $trace);\n\t}\n\n\tpublic function log($level, $message){\n\t\tServer::getInstance()->getLogger()->log($level, $this->pluginName . $message);\n\t\tforeach($this->attachments as $attachment){\n\t\t\t$attachment->log($level, $message);\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/plugin/PluginManager.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\command\\defaults\\TimingsCommand;\nuse pocketmine\\command\\PluginCommand;\nuse pocketmine\\command\\SimpleCommandMap;\nuse pocketmine\\event\\Event;\nuse pocketmine\\event\\EventPriority;\nuse pocketmine\\event\\HandlerList;\nuse pocketmine\\event\\Listener;\nuse pocketmine\\event\\Timings;\nuse pocketmine\\event\\TimingsHandler;\nuse pocketmine\\permission\\Permissible;\nuse pocketmine\\permission\\Permission;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\MainLogger;\nuse pocketmine\\utils\\PluginException;\n\n/**\n * Manages all the plugins, Permissions and Permissibles\n */\nclass PluginManager{\n\n\t/** @var Server */\n\tprivate $server;\n\n\t/** @var SimpleCommandMap */\n\tprivate $commandMap;\n\n\t/**\n\t * @var Plugin[]\n\t */\n\tprotected $plugins = [];\n\n\t/**\n\t * @var Permission[]\n\t */\n\tprotected $permissions = [];\n\n\t/**\n\t * @var Permission[]\n\t */\n\tprotected $defaultPerms = [];\n\n\t/**\n\t * @var Permission[]\n\t */\n\tprotected $defaultPermsOp = [];\n\n\t/**\n\t * @var Permissible[][]\n\t */\n\tprotected $permSubs = [];\n\n\t/**\n\t * @var Permissible[]\n\t */\n\tprotected $defSubs = [];\n\n\t/**\n\t * @var Permissible[]\n\t */\n\tprotected $defSubsOp = [];\n\n\t/**\n\t * @var PluginLoader[]\n\t */\n\tprotected $fileAssociations = [];\n\n\t/** @var TimingsHandler */\n\tpublic static $pluginParentTimer;\n\n\tpublic static $useTimings = false;\n\n\t/**\n\t * @param Server           $server\n\t * @param SimpleCommandMap $commandMap\n\t */\n\tpublic function __construct(Server $server, SimpleCommandMap $commandMap){\n\t\t$this->server = $server;\n\t\t$this->commandMap = $commandMap;\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return null|Plugin\n\t */\n\tpublic function getPlugin($name){\n\t\tif(isset($this->plugins[$name])){\n\t\t\treturn $this->plugins[$name];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param string $loaderName A PluginLoader class name\n\t *\n\t * @return boolean\n\t */\n\tpublic function registerInterface($loaderName){\n\t\tif(is_subclass_of($loaderName, PluginLoader::class)){\n\t\t\t$loader = new $loaderName($this->server);\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->fileAssociations[$loaderName] = $loader;\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return Plugin[]\n\t */\n\tpublic function getPlugins(){\n\t\treturn $this->plugins;\n\t}\n\n\t/**\n\t * @param string         $path\n\t * @param PluginLoader[] $loaders\n\t *\n\t * @return Plugin\n\t */\n\tpublic function loadPlugin($path, $loaders = null){\n\t\tforeach(($loaders === null ? $this->fileAssociations : $loaders) as $loader){\n\t\t\tif(preg_match($loader->getPluginFilters(), basename($path)) > 0){\n\t\t\t\t$description = $loader->getPluginDescription($path);\n\t\t\t\tif($description instanceof PluginDescription){\n\t\t\t\t\tif(($plugin = $loader->loadPlugin($path)) instanceof Plugin){\n\t\t\t\t\t\t$this->plugins[$plugin->getDescription()->getName()] = $plugin;\n\n\t\t\t\t\t\t$pluginCommands = $this->parseYamlCommands($plugin);\n\n\t\t\t\t\t\tif(count($pluginCommands) > 0){\n\t\t\t\t\t\t\t$this->commandMap->registerAll($plugin->getDescription()->getName(), $pluginCommands);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn $plugin;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param string $directory\n\t * @param array  $newLoaders\n\t *\n\t * @return Plugin[]\n\t */\n\tpublic function loadPlugins($directory, $newLoaders = null){\n\n\t\tif(is_dir($directory)){\n\t\t\t$plugins = [];\n\t\t\t$loadedPlugins = [];\n\t\t\t$dependencies = [];\n\t\t\t$softDependencies = [];\n\t\t\tif(is_array($newLoaders)){\n\t\t\t\t$loaders = [];\n\t\t\t\tforeach($newLoaders as $key){\n\t\t\t\t\tif(isset($this->fileAssociations[$key])){\n\t\t\t\t\t\t$loaders[$key] = $this->fileAssociations[$key];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$loaders = $this->fileAssociations;\n\t\t\t}\n\t\t\tforeach($loaders as $loader){\n\t\t\t\tforeach(new \\RegexIterator(new \\DirectoryIterator($directory), $loader->getPluginFilters()) as $file){\n\t\t\t\t\tif($file === \".\" or $file === \"..\"){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$file = $directory . $file;\n\t\t\t\t\ttry{\n\t\t\t\t\t\t$description = $loader->getPluginDescription($file);\n\t\t\t\t\t\tif($description instanceof PluginDescription){\n\t\t\t\t\t\t\t$name = $description->getName();\n\t\t\t\t\t\t\tif(stripos($name, \"pocketmine\") !== false or stripos($name, \"minecraft\") !== false or stripos($name, \"mojang\") !== false){\n\t\t\t\t\t\t\t\t$this->server->getLogger()->error($this->server->getLanguage()->translateString(\"pocketmine.plugin.loadError\", [$name, \"%pocketmine.plugin.restrictedName\"]));\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}elseif(strpos($name, \" \") !== false){\n\t\t\t\t\t\t\t\t$this->server->getLogger()->warning($this->server->getLanguage()->translateString(\"pocketmine.plugin.spacesDiscouraged\", [$name]));\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif(isset($plugins[$name]) or $this->getPlugin($name) instanceof Plugin){\n\t\t\t\t\t\t\t\t$this->server->getLogger()->error($this->server->getLanguage()->translateString(\"pocketmine.plugin.duplicateError\", [$name]));\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$compatible = false;\n\t\t\t\t\t\t\t//Check multiple dependencies\n\t\t\t\t\t\t\tforeach($description->getCompatibleApis() as $version){\n\t\t\t\t\t\t\t\t//Format: majorVersion.minorVersion.patch\n\t\t\t\t\t\t\t\t$version = array_map(\"intval\", explode(\".\", $version));\n\t\t\t\t\t\t\t\t$apiVersion = array_map(\"intval\", explode(\".\", $this->server->getApiVersion()));\n\t\t\t\t\t\t\t\t//Completely different API version\n\t\t\t\t\t\t\t\tif($version[0] > $apiVersion[0]){\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//If the plugin uses new API\n\t\t\t\t\t\t\t\tif($version[0] < $apiVersion[0]){\n\t\t\t\t\t\t\t\t\t$compatible = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//If the plugin requires new API features, being backwards compatible\n\t\t\t\t\t\t\t\tif($version[1] > $apiVersion[1]){\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$compatible = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$compatiblegeniapi = false;\n\t\t\t\t\t\t\tforeach($description->getCompatibleGeniApis() as $version){\n\t\t\t\t\t\t\t\t//Format: majorVersion.minorVersion.patch\n\t\t\t\t\t\t\t\t$version = array_map(\"intval\", explode(\".\", $version));\n\t\t\t\t\t\t\t\t$apiVersion = array_map(\"intval\", explode(\".\", $this->server->getGeniApiVersion()));\n\t\t\t\t\t\t\t\t//Completely different API version\n\t\t\t\t\t\t\t\tif($version[0] > $apiVersion[0]){\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//If the plugin uses new API\n\t\t\t\t\t\t\t\tif($version[0] < $apiVersion[0]){\n\t\t\t\t\t\t\t\t\t$compatiblegeniapi = true;\n\t\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t//If the plugin requires new API features, being backwards compatible\n\t\t\t\t\t\t\t\tif($version[1] > $apiVersion[1]){\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tif($version[1] == $apiVersion[1] and $version[2] > $apiVersion[2]){\n\t\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t$compatiblegeniapi = true;\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif($compatible === false){\n\t\t\t\t\t\t\t\t$this->server->getLogger()->error($this->server->getLanguage()->translateString(\"pocketmine.plugin.loadError\", [$name, \"%pocketmine.plugin.incompatibleAPI\"]));\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tif($compatiblegeniapi === false){\n\t\t\t\t\t\t\t\t$this->server->getLogger()->error(\"Could not load plugin '{$description->getName()}': Incompatible GeniAPI version\");\n\t\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t$plugins[$name] = $file;\n\n\t\t\t\t\t\t\t$softDependencies[$name] = (array) $description->getSoftDepend();\n\t\t\t\t\t\t\t$dependencies[$name] = (array) $description->getDepend();\n\n\t\t\t\t\t\t\tforeach($description->getLoadBefore() as $before){\n\t\t\t\t\t\t\t\tif(isset($softDependencies[$before])){\n\t\t\t\t\t\t\t\t\t$softDependencies[$before][] = $name;\n\t\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t\t$softDependencies[$before] = [$name];\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}catch(\\Throwable $e){\n\t\t\t\t\t\t$this->server->getLogger()->error($this->server->getLanguage()->translateString(\"pocketmine.plugin.fileError\", [$file, $directory, $e->getMessage()]));\n\t\t\t\t\t\t$this->server->getLogger()->logException($e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\n\t\t\twhile(count($plugins) > 0){\n\t\t\t\t$missingDependency = true;\n\t\t\t\tforeach($plugins as $name => $file){\n\t\t\t\t\tif(isset($dependencies[$name])){\n\t\t\t\t\t\tforeach($dependencies[$name] as $key => $dependency){\n\t\t\t\t\t\t\tif(isset($loadedPlugins[$dependency]) or $this->getPlugin($dependency) instanceof Plugin){\n\t\t\t\t\t\t\t\tunset($dependencies[$name][$key]);\n\t\t\t\t\t\t\t}elseif(!isset($plugins[$dependency])){\n\t\t\t\t\t\t\t\t$this->server->getLogger()->critical($this->server->getLanguage()->translateString(\"pocketmine.plugin.loadError\", [$name, \"%pocketmine.plugin.unknownDependency\"]));\n\t\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(count($dependencies[$name]) === 0){\n\t\t\t\t\t\t\tunset($dependencies[$name]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(isset($softDependencies[$name])){\n\t\t\t\t\t\tforeach($softDependencies[$name] as $key => $dependency){\n\t\t\t\t\t\t\tif(isset($loadedPlugins[$dependency]) or $this->getPlugin($dependency) instanceof Plugin){\n\t\t\t\t\t\t\t\tunset($softDependencies[$name][$key]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif(count($softDependencies[$name]) === 0){\n\t\t\t\t\t\t\tunset($softDependencies[$name]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(!isset($dependencies[$name]) and !isset($softDependencies[$name])){\n\t\t\t\t\t\tunset($plugins[$name]);\n\t\t\t\t\t\t$missingDependency = false;\n\t\t\t\t\t\tif($plugin = $this->loadPlugin($file, $loaders) and $plugin instanceof Plugin){\n\t\t\t\t\t\t\t$loadedPlugins[$name] = $plugin;\n\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t$this->server->getLogger()->critical($this->server->getLanguage()->translateString(\"pocketmine.plugin.genericLoadError\", [$name]));\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif($missingDependency === true){\n\t\t\t\t\tforeach($plugins as $name => $file){\n\t\t\t\t\t\tif(!isset($dependencies[$name])){\n\t\t\t\t\t\t\tunset($softDependencies[$name]);\n\t\t\t\t\t\t\tunset($plugins[$name]);\n\t\t\t\t\t\t\t$missingDependency = false;\n\t\t\t\t\t\t\tif($plugin = $this->loadPlugin($file, $loaders) and $plugin instanceof Plugin){\n\t\t\t\t\t\t\t\t$loadedPlugins[$name] = $plugin;\n\t\t\t\t\t\t\t}else{\n\t\t\t\t\t\t\t\t$this->server->getLogger()->critical($this->server->getLanguage()->translateString(\"pocketmine.plugin.genericLoadError\", [$name]));\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\t//No plugins loaded :(\n\t\t\t\t\tif($missingDependency === true){\n\t\t\t\t\t\tforeach($plugins as $name => $file){\n\t\t\t\t\t\t\t$this->server->getLogger()->critical($this->server->getLanguage()->translateString(\"pocketmine.plugin.loadError\", [$name, \"%pocketmine.plugin.circularDependency\"]));\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$plugins = [];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tTimingsCommand::$timingStart = microtime(true);\n\n\t\t\treturn $loadedPlugins;\n\t\t}else{\n\t\t\tTimingsCommand::$timingStart = microtime(true);\n\n\t\t\treturn [];\n\t\t}\n\t}\n\n\t/**\n\t * @param string $name\n\t *\n\t * @return null|Permission\n\t */\n\tpublic function getPermission($name){\n\t\tif(isset($this->permissions[$name])){\n\t\t\treturn $this->permissions[$name];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param Permission $permission\n\t *\n\t * @return bool\n\t */\n\tpublic function addPermission(Permission $permission){\n\t\tif(!isset($this->permissions[$permission->getName()])){\n\t\t\t$this->permissions[$permission->getName()] = $permission;\n\t\t\t$this->calculatePermissionDefault($permission);\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * @param string|Permission $permission\n\t */\n\tpublic function removePermission($permission){\n\t\tif($permission instanceof Permission){\n\t\t\tunset($this->permissions[$permission->getName()]);\n\t\t}else{\n\t\t\tunset($this->permissions[$permission]);\n\t\t}\n\t}\n\n\t/**\n\t * @param boolean $op\n\t *\n\t * @return Permission[]\n\t */\n\tpublic function getDefaultPermissions($op){\n\t\tif($op === true){\n\t\t\treturn $this->defaultPermsOp;\n\t\t}else{\n\t\t\treturn $this->defaultPerms;\n\t\t}\n\t}\n\n\t/**\n\t * @param Permission $permission\n\t */\n\tpublic function recalculatePermissionDefaults(Permission $permission){\n\t\tif(isset($this->permissions[$permission->getName()])){\n\t\t\tunset($this->defaultPermsOp[$permission->getName()]);\n\t\t\tunset($this->defaultPerms[$permission->getName()]);\n\t\t\t$this->calculatePermissionDefault($permission);\n\t\t}\n\t}\n\n\t/**\n\t * @param Permission $permission\n\t */\n\tprivate function calculatePermissionDefault(Permission $permission){\n\t\tTimings::$permissionDefaultTimer->startTiming();\n\t\tif($permission->getDefault() === Permission::DEFAULT_OP or $permission->getDefault() === Permission::DEFAULT_TRUE){\n\t\t\t$this->defaultPermsOp[$permission->getName()] = $permission;\n\t\t\t$this->dirtyPermissibles(true);\n\t\t}\n\n\t\tif($permission->getDefault() === Permission::DEFAULT_NOT_OP or $permission->getDefault() === Permission::DEFAULT_TRUE){\n\t\t\t$this->defaultPerms[$permission->getName()] = $permission;\n\t\t\t$this->dirtyPermissibles(false);\n\t\t}\n\t\tTimings::$permissionDefaultTimer->stopTiming();\n\t}\n\n\t/**\n\t * @param boolean $op\n\t */\n\tprivate function dirtyPermissibles($op){\n\t\tforeach($this->getDefaultPermSubscriptions($op) as $p){\n\t\t\t$p->recalculatePermissions();\n\t\t}\n\t}\n\n\t/**\n\t * @param string      $permission\n\t * @param Permissible $permissible\n\t */\n\tpublic function subscribeToPermission($permission, Permissible $permissible){\n\t\tif(!isset($this->permSubs[$permission])){\n\t\t\t$this->permSubs[$permission] = [];\n\t\t}\n\t\t$this->permSubs[$permission][spl_object_hash($permissible)] = $permissible;\n\t}\n\n\t/**\n\t * @param string      $permission\n\t * @param Permissible $permissible\n\t */\n\tpublic function unsubscribeFromPermission($permission, Permissible $permissible){\n\t\tif(isset($this->permSubs[$permission])){\n\t\t\tunset($this->permSubs[$permission][spl_object_hash($permissible)]);\n\t\t\tif(count($this->permSubs[$permission]) === 0){\n\t\t\t\tunset($this->permSubs[$permission]);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param string $permission\n\t *\n\t * @return Permissible[]\n\t */\n\tpublic function getPermissionSubscriptions($permission){\n\t\tif(isset($this->permSubs[$permission])){\n\t\t\treturn $this->permSubs[$permission];//Return and ignore the further code\n\t\t\t$subs = [];\n\t\t\tforeach($this->permSubs[$permission] as $k => $perm){\n\t\t\t\t/** @var \\WeakRef $perm */\n\t\t\t\tif($perm->acquire()){\n\t\t\t\t\t$subs[] = $perm->get();\n\t\t\t\t\t$perm->release();\n\t\t\t\t}else{\n\t\t\t\t\tunset($this->permSubs[$permission][$k]);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn $subs;\n\t\t}\n\n\t\treturn [];\n\t}\n\n\t/**\n\t * @param boolean     $op\n\t * @param Permissible $permissible\n\t */\n\tpublic function subscribeToDefaultPerms($op, Permissible $permissible){\n\t\tif($op === true){\n\t\t\t$this->defSubsOp[spl_object_hash($permissible)] = $permissible;\n\t\t}else{\n\t\t\t$this->defSubs[spl_object_hash($permissible)] = $permissible;\n\t\t}\n\t}\n\n\t/**\n\t * @param boolean     $op\n\t * @param Permissible $permissible\n\t */\n\tpublic function unsubscribeFromDefaultPerms($op, Permissible $permissible){\n\t\tif($op === true){\n\t\t\tunset($this->defSubsOp[spl_object_hash($permissible)]);\n\t\t}else{\n\t\t\tunset($this->defSubs[spl_object_hash($permissible)]);\n\t\t}\n\t}\n\n\t/**\n\t * @param boolean $op\n\t *\n\t * @return Permissible[]\n\t */\n\tpublic function getDefaultPermSubscriptions($op){\n\t\t$subs = [];\n\n\t\tif($op === true){\n\t\t\treturn $this->defSubsOp;//Return and ignore further code\n\t\t\tforeach($this->defSubsOp as $k => $perm){\n\t\t\t\t/** @var \\WeakRef $perm */\n\t\t\t\tif($perm->acquire()){\n\t\t\t\t\t$subs[] = $perm->get();\n\t\t\t\t\t$perm->release();\n\t\t\t\t}else{\n\t\t\t\t\tunset($this->defSubsOp[$k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\treturn $this->defSubs;//Return and ignore further code\n\t\t\tforeach($this->defSubs as $k => $perm){\n\t\t\t\t/** @var \\WeakRef $perm */\n\t\t\t\tif($perm->acquire()){\n\t\t\t\t\t$subs[] = $perm->get();\n\t\t\t\t\t$perm->release();\n\t\t\t\t}else{\n\t\t\t\t\tunset($this->defSubs[$k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn $subs;\n\t}\n\n\t/**\n\t * @return Permission[]\n\t */\n\tpublic function getPermissions(){\n\t\treturn $this->permissions;\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t *\n\t * @return bool\n\t */\n\tpublic function isPluginEnabled(Plugin $plugin){\n\t\tif($plugin instanceof Plugin and isset($this->plugins[$plugin->getDescription()->getName()])){\n\t\t\treturn $plugin->isEnabled();\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function enablePlugin(Plugin $plugin){\n\t\tif(!$plugin->isEnabled()){\n\t\t\ttry{\n\t\t\t\tforeach($plugin->getDescription()->getPermissions() as $perm){\n\t\t\t\t\t$this->addPermission($perm);\n\t\t\t\t}\n\t\t\t\t$plugin->getPluginLoader()->enablePlugin($plugin);\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$this->server->getLogger()->logException($e);\n\t\t\t\t$this->disablePlugin($plugin);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t *\n\t * @return PluginCommand[]\n\t */\n\tprotected function parseYamlCommands(Plugin $plugin){\n\t\t$pluginCmds = [];\n\n\t\tforeach($plugin->getDescription()->getCommands() as $key => $data){\n\t\t\tif(strpos($key, \":\") !== false){\n\t\t\t\t$this->server->getLogger()->critical($this->server->getLanguage()->translateString(\"pocketmine.plugin.commandError\", [$key, $plugin->getDescription()->getFullName()]));\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(is_array($data)){\n\t\t\t\t$newCmd = new PluginCommand($key, $plugin);\n\t\t\t\tif(isset($data[\"description\"])){\n\t\t\t\t\t$newCmd->setDescription($data[\"description\"]);\n\t\t\t\t}\n\n\t\t\t\tif(isset($data[\"usage\"])){\n\t\t\t\t\t$newCmd->setUsage($data[\"usage\"]);\n\t\t\t\t}\n\n\t\t\t\tif(isset($data[\"aliases\"]) and is_array($data[\"aliases\"])){\n\t\t\t\t\t$aliasList = [];\n\t\t\t\t\tforeach($data[\"aliases\"] as $alias){\n\t\t\t\t\t\tif(strpos($alias, \":\") !== false){\n\t\t\t\t\t\t\t$this->server->getLogger()->critical($this->server->getLanguage()->translateString(\"pocketmine.plugin.aliasError\", [$alias, $plugin->getDescription()->getFullName()]));\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$aliasList[] = $alias;\n\t\t\t\t\t}\n\n\t\t\t\t\t$newCmd->setAliases($aliasList);\n\t\t\t\t}\n\n\t\t\t\tif(isset($data[\"permission\"])){\n\t\t\t\t\t$newCmd->setPermission($data[\"permission\"]);\n\t\t\t\t}\n\n\t\t\t\tif(isset($data[\"permission-message\"])){\n\t\t\t\t\t$newCmd->setPermissionMessage($data[\"permission-message\"]);\n\t\t\t\t}\n\n\t\t\t\t$pluginCmds[] = $newCmd;\n\t\t\t}\n\t\t}\n\n\t\treturn $pluginCmds;\n\t}\n\n\tpublic function disablePlugins(){\n\t\tforeach($this->getPlugins() as $plugin){\n\t\t\t$this->disablePlugin($plugin);\n\t\t}\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function disablePlugin(Plugin $plugin){\n\t\tif($plugin->isEnabled()){\n\t\t\ttry{\n\t\t\t\t$plugin->getPluginLoader()->disablePlugin($plugin);\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$this->server->getLogger()->logException($e);\n\t\t\t}\n\n\t\t\t$this->server->getScheduler()->cancelTasks($plugin);\n\t\t\tHandlerList::unregisterAll($plugin);\n\t\t\tforeach($plugin->getDescription()->getPermissions() as $perm){\n\t\t\t\t$this->removePermission($perm);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function clearPlugins(){\n\t\t$this->disablePlugins();\n\t\t$this->plugins = [];\n\t\t$this->fileAssociations = [];\n\t\t$this->permissions = [];\n\t\t$this->defaultPerms = [];\n\t\t$this->defaultPermsOp = [];\n\t}\n\n\t/**\n\t * Calls an event\n\t *\n\t * @param Event $event\n\t */\n\tpublic function callEvent(Event $event){\n\t\tforeach($event->getHandlers()->getRegisteredListeners() as $registration){\n\t\t\tif(!$registration->getPlugin()->isEnabled()){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\ttry{\n\t\t\t\t$registration->callEvent($event);\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$this->server->getLogger()->critical(\n\t\t\t\t\t$this->server->getLanguage()->translateString(\"pocketmine.plugin.eventError\", [\n\t\t\t\t\t\t$event->getEventName(),\n\t\t\t\t\t\t$registration->getPlugin()->getDescription()->getFullName(),\n\t\t\t\t\t\t$e->getMessage(),\n\t\t\t\t\t\tget_class($registration->getListener())\n\t\t\t\t\t]));\n\t\t\t\t$this->server->getLogger()->logException($e);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Registers all the events in the given Listener class\n\t *\n\t * @param Listener $listener\n\t * @param Plugin   $plugin\n\t *\n\t * @throws PluginException\n\t */\n\tpublic function registerEvents(Listener $listener, Plugin $plugin){\n\t\tif(!$plugin->isEnabled()){\n\t\t\tthrow new PluginException(\"Plugin attempted to register \" . get_class($listener) . \" while not enabled\");\n\t\t}\n\n\t\t$reflection = new \\ReflectionClass(get_class($listener));\n\t\tforeach($reflection->getMethods(\\ReflectionMethod::IS_PUBLIC) as $method){\n\t\t\tif(!$method->isStatic()){\n\t\t\t\t$priority = EventPriority::NORMAL;\n\t\t\t\t$ignoreCancelled = false;\n\t\t\t\tif(preg_match(\"/^[\\t ]*\\\\* @priority[\\t ]{1,}([a-zA-Z]{1,})/m\", (string) $method->getDocComment(), $matches) > 0){\n\t\t\t\t\t$matches[1] = strtoupper($matches[1]);\n\t\t\t\t\tif(defined(EventPriority::class . \"::\" . $matches[1])){\n\t\t\t\t\t\t$priority = constant(EventPriority::class . \"::\" . $matches[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif(preg_match(\"/^[\\t ]*\\\\* @ignoreCancelled[\\t ]{1,}([a-zA-Z]{1,})/m\", (string) $method->getDocComment(), $matches) > 0){\n\t\t\t\t\t$matches[1] = strtolower($matches[1]);\n\t\t\t\t\tif($matches[1] === \"false\"){\n\t\t\t\t\t\t$ignoreCancelled = false;\n\t\t\t\t\t}elseif($matches[1] === \"true\"){\n\t\t\t\t\t\t$ignoreCancelled = true;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$parameters = $method->getParameters();\n\t\t\t\tif(count($parameters) === 1 and $parameters[0]->getClass() instanceof \\ReflectionClass and is_subclass_of($parameters[0]->getClass()->getName(), Event::class)){\n\t\t\t\t\t$class = $parameters[0]->getClass()->getName();\n\t\t\t\t\t$reflection = new \\ReflectionClass($class);\n\t\t\t\t\tif(strpos((string) $reflection->getDocComment(), \"@deprecated\") !== false and $this->server->getProperty(\"settings.deprecated-verbose\", true)){\n\t\t\t\t\t\t$this->server->getLogger()->warning($this->server->getLanguage()->translateString(\"pocketmine.plugin.deprecatedEvent\", [\n\t\t\t\t\t\t\t$plugin->getName(),\n\t\t\t\t\t\t\t$class,\n\t\t\t\t\t\t\tget_class($listener) . \"->\" . $method->getName() . \"()\"\n\t\t\t\t\t\t]));\n\t\t\t\t\t}\n\t\t\t\t\t$this->registerEvent($class, $listener, $priority, new MethodEventExecutor($method->getName()), $plugin, $ignoreCancelled);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param string        $event Class name that extends Event\n\t * @param Listener      $listener\n\t * @param int           $priority\n\t * @param EventExecutor $executor\n\t * @param Plugin        $plugin\n\t * @param bool          $ignoreCancelled\n\t *\n\t * @throws PluginException\n\t */\n\tpublic function registerEvent($event, Listener $listener, $priority, EventExecutor $executor, Plugin $plugin, $ignoreCancelled = false){\n\t\tif(!is_subclass_of($event, Event::class)){\n\t\t\tthrow new PluginException($event . \" is not an Event\");\n\t\t}\n\t\t$class = new \\ReflectionClass($event);\n\t\tif($class->isAbstract()){\n\t\t\tthrow new PluginException($event . \" is an abstract Event\");\n\t\t}\n\t\tif($class->getProperty(\"handlerList\")->getDeclaringClass()->getName() !== $event){\n\t\t\tthrow new PluginException($event . \" does not have a handler list\");\n\t\t}\n\n\t\tif(!$plugin->isEnabled()){\n\t\t\tthrow new PluginException(\"Plugin attempted to register \" . $event . \" while not enabled\");\n\t\t}\n\n\t\t$timings = new TimingsHandler(\"Plugin: \" . $plugin->getDescription()->getFullName() . \" Event: \" . get_class($listener) . \"::\" . ($executor instanceof MethodEventExecutor ? $executor->getMethod() : \"???\") . \"(\" . (new \\ReflectionClass($event))->getShortName() . \")\", self::$pluginParentTimer);\n\n\t\t$this->getEventListeners($event)->register(new RegisteredListener($listener, $executor, $priority, $plugin, $ignoreCancelled, $timings));\n\t}\n\n\t/**\n\t * @param $event\n\t *\n\t * @return HandlerList\n\t */\n\tprivate function getEventListeners($event){\n\t\tif($event::$handlerList === null){\n\t\t\t$event::$handlerList = new HandlerList();\n\t\t}\n\n\t\treturn $event::$handlerList;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function useTimings(){\n\t\treturn self::$useTimings;\n\t}\n\n\t/**\n\t * @param bool $use\n\t */\n\tpublic function setUseTimings($use){\n\t\tself::$useTimings = (bool) $use;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/plugin/RegisteredListener.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\event\\Cancellable;\nuse pocketmine\\event\\Event;\nuse pocketmine\\event\\Listener;\nuse pocketmine\\event\\TimingsHandler;\n\nclass RegisteredListener{\n\n\t/** @var Listener */\n\tprivate $listener;\n\n\t/** @var int */\n\tprivate $priority;\n\n\t/** @var Plugin */\n\tprivate $plugin;\n\n\t/** @var EventExecutor */\n\tprivate $executor;\n\n\t/** @var bool */\n\tprivate $ignoreCancelled;\n\n\t/** @var TimingsHandler */\n\tprivate $timings;\n\n\n\t/**\n\t * @param Listener       $listener\n\t * @param EventExecutor  $executor\n\t * @param int            $priority\n\t * @param Plugin         $plugin\n\t * @param boolean        $ignoreCancelled\n\t * @param TimingsHandler $timings\n\t */\n\tpublic function __construct(Listener $listener, EventExecutor $executor, $priority, Plugin $plugin, $ignoreCancelled, TimingsHandler $timings){\n\t\t$this->listener = $listener;\n\t\t$this->priority = $priority;\n\t\t$this->plugin = $plugin;\n\t\t$this->executor = $executor;\n\t\t$this->ignoreCancelled = $ignoreCancelled;\n\t\t$this->timings = $timings;\n\t}\n\n\t/**\n\t * @return Listener\n\t */\n\tpublic function getListener(){\n\t\treturn $this->listener;\n\t}\n\n\t/**\n\t * @return Plugin\n\t */\n\tpublic function getPlugin(){\n\t\treturn $this->plugin;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getPriority(){\n\t\treturn $this->priority;\n\t}\n\n\t/**\n\t * @param Event $event\n\t */\n\tpublic function callEvent(Event $event){\n\t\tif($event instanceof Cancellable and $event->isCancelled() and $this->isIgnoringCancelled()){\n\t\t\treturn;\n\t\t}\n\t\t$this->timings->startTiming();\n\t\t$this->executor->execute($this->listener, $event);\n\t\t$this->timings->stopTiming();\n\t}\n\n\tpublic function __destruct(){\n\t\t$this->timings->remove();\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isIgnoringCancelled(){\n\t\treturn $this->ignoreCancelled === true;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/plugin/ScriptPluginLoader.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\plugin;\n\nuse pocketmine\\event\\plugin\\PluginDisableEvent;\nuse pocketmine\\event\\plugin\\PluginEnableEvent;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\PluginException;\n\n/**\n * Simple script loader, not for plugin development\n * For an example see https://gist.github.com/shoghicp/516105d470cf7d140757\n */\nclass ScriptPluginLoader implements PluginLoader{\n\n\t/** @var Server */\n\tprivate $server;\n\n\t/**\n\t * @param Server $server\n\t */\n\tpublic function __construct(Server $server){\n\t\t$this->server = $server;\n\t}\n\n\t/**\n\t * Loads the plugin contained in $file\n\t *\n\t * @param string $file\n\t *\n\t * @return Plugin\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function loadPlugin($file){\n\t\tif(($description = $this->getPluginDescription($file)) instanceof PluginDescription){\n\t\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.plugin.load\", [$description->getFullName()]));\n\t\t\t$dataFolder = dirname($file) . DIRECTORY_SEPARATOR . $description->getName();\n\t\t\tif(file_exists($dataFolder) and !is_dir($dataFolder)){\n\t\t\t\tthrow new \\InvalidStateException(\"Projected dataFolder '\" . $dataFolder . \"' for \" . $description->getName() . \" exists and is not a directory\");\n\t\t\t}\n\n\t\t\tinclude_once($file);\n\n\t\t\t$className = $description->getMain();\n\n\t\t\tif(class_exists($className, true)){\n\t\t\t\t$plugin = new $className();\n\t\t\t\t$this->initPlugin($plugin, $description, $dataFolder, $file);\n\n\t\t\t\treturn $plugin;\n\t\t\t}else{\n\t\t\t\tthrow new PluginException(\"Couldn't load plugin \" . $description->getName() . \": main class not found\");\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Gets the PluginDescription from the file\n\t *\n\t * @param string $file\n\t *\n\t * @return PluginDescription\n\t */\n\tpublic function getPluginDescription($file){\n\t\t$content = file($file, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);\n\n\t\t$data = [];\n\n\t\t$insideHeader = false;\n\t\tforeach($content as $line){\n\t\t\tif(!$insideHeader and strpos($line, \"/**\") !== false){\n\t\t\t\t$insideHeader = true;\n\t\t\t}\n\n\t\t\tif(preg_match(\"/^[ \\t]+\\\\*[ \\t]+@([a-zA-Z]+)([ \\t]+(.*))?$/\", $line, $matches) > 0){\n\t\t\t\t$key = $matches[1];\n\t\t\t\t$content = trim($matches[3] ?? \"\");\n\n\t\t\t\tif($key === \"notscript\"){\n\t\t\t\t\treturn null;\n \t\t\t\t}\n\n\t\t\t\t$data[$key] = $content;\n\t\t\t}\n\n\t\t\tif($insideHeader and strpos($line, \"*/\") !== false){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif($insideHeader){\n\t\t\treturn new PluginDescription($data);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * Returns the filename patterns that this loader accepts\n\t *\n\t * @return array\n\t */\n\tpublic function getPluginFilters(){\n\t\treturn \"/\\\\.php$/i\";\n\t}\n\n\t/**\n\t * @param PluginBase        $plugin\n\t * @param PluginDescription $description\n\t * @param string            $dataFolder\n\t * @param string            $file\n\t */\n\tprivate function initPlugin(PluginBase $plugin, PluginDescription $description, $dataFolder, $file){\n\t\t$plugin->init($this, $this->server, $description, $dataFolder, $file);\n\t\t$plugin->onLoad();\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function enablePlugin(Plugin $plugin){\n\t\tif($plugin instanceof PluginBase and !$plugin->isEnabled()){\n\t\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.plugin.enable\", [$plugin->getDescription()->getFullName()]));\n\n\t\t\t$plugin->setEnabled(true);\n\n\t\t\t$this->server->getPluginManager()->callEvent(new PluginEnableEvent($plugin));\n\t\t}\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function disablePlugin(Plugin $plugin){\n\t\tif($plugin instanceof PluginBase and $plugin->isEnabled()){\n\t\t\t$this->server->getLogger()->info($this->server->getLanguage()->translateString(\"pocketmine.plugin.disable\", [$plugin->getDescription()->getFullName()]));\n\n\t\t\t$this->server->getPluginManager()->callEvent(new PluginDisableEvent($plugin));\n\n\t\t\t$plugin->setEnabled(false);\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/resourcepacks/ResourcePackInfoEntry.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\resourcepacks;\n\nclass ResourcePackInfoEntry{\n\tprotected $packId; //UUID\n\tprotected $version;\n\tprotected $packSize;\n\n\tpublic function __construct(string $packId, string $version, $packSize){\n\t\t$this->packId = $packId;\n\t\t$this->version = $version;\n\t\t$this->packSize = $packSize;\n\t}\n\n\tpublic function getPackId() : string{\n\t\treturn $this->packId;\n\t}\n\n\tpublic function getVersion() : string{\n\t\treturn $this->version;\n\t}\n\n\tpublic function getPackSize(){\n\t\treturn $this->packSize;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/resources/command_default.json",
    "content": "{\n  \"aliases\": [],\n  \"description\": \"insert_description_here\",\n  \"overloads\": {\n    \"default\": {\n      \"input\": {\n        \"parameters\": [\n          {\n            \"name\": \"args\",\n            \"type\": \"rawtext\",\n            \"optional\": true\n          }\n        ]\n      },\n      \"output\": {}\n    }\n  },\n  \"permission\": \"any\"\n}\n"
  },
  {
    "path": "src/pocketmine/resources/creativeitems.json",
    "content": "[\n    {\n        \"id\": 138,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 66,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 27,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 28,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 126,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 4,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 98,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 98,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 98,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 98,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 48,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 5,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 5,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 5,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 5,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 5,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 5,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 45,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 1,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 1,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 1,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 1,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 1,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 1,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 1,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 3,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 243,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 2,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 110,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 82,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 172,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 159,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 24,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 24,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 24,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 179,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 179,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 179,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 12,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 12,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 13,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 139,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 139,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 17,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 17,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 17,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 17,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 162,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 162,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 112,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 87,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 88,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 7,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 67,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 53,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 134,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 135,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 136,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 163,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 164,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 108,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 128,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 180,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 109,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 114,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 156,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 203,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 44,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 44,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 111,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 158,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 158,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 158,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 158,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 158,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 158,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 44,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 44,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 182,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 182,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 44,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 44,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 44,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 182,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 155,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 155,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 155,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 168,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 168,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 168,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 169,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 201,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 201,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 240,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 200,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 263,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 263,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 264,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 265,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 266,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 388,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 280,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 281,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 287,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 288,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 318,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 334,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 415,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 337,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 353,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 336,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 405,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 16,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 15,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 14,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 56,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 21,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 73,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 129,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 153,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 41,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 42,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 57,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 22,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 173,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 133,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 152,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 406,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 49,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 79,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 174,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 80,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 78,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 20,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 89,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 106,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 65,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 19,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 19,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 50,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 102,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 325,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 325,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 325,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 325,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 339,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 340,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 352,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 324,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 427,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 428,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 429,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 430,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 431,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 330,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 395,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 96,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 167,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 85,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 85,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 85,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 85,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 85,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 85,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 113,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 107,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 183,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 184,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 185,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 187,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 186,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 101,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 355,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 47,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 323,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 321,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 389,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 58,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 245,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 54,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 146,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 61,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 379,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 380,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 25,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 46,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 206,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 121,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 208,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 120,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 145,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 145,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 145,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 37,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 38,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 175,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 175,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 175,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 175,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 175,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 175,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 39,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 40,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 99,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 100,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 99,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 99,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 81,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 103,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 86,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 91,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 30,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 170,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 338,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 296,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 31,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 31,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 32,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 6,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 6,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 6,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 6,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 6,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 6,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 18,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 18,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 18,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 18,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 161,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 161,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 16,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 17,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 18,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 19,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 20,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 21,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 22,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 23,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 24,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 25,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 26,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 27,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 28,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 29,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 30,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 31,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 32,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 33,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 34,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 35,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 36,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 262,\n        \"damage\": 37,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 295,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 361,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 362,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 458,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 344,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 260,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 322,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 466,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 349,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 460,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 461,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 462,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 350,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 463,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 367,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 282,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 297,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 319,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 320,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 365,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 366,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 423,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 424,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 363,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 364,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 360,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 391,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 392,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 393,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 394,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 457,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 459,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 354,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 357,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 400,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 411,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 412,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 413,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 432,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 433,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 399,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 420,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 421,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 378,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 369,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 371,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 396,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 382,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 414,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 370,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 341,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 377,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 372,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 289,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 331,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 348,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 375,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 376,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 437,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 397,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 397,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 397,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 397,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 397,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 397,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 261,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 346,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 259,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 359,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 347,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 345,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 398,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 328,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 342,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 408,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 407,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 333,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 333,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 333,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 333,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 333,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 333,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 329,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 416,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 417,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 418,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 419,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 390,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 28,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 22,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 16,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 19,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 18,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 23,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 24,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 25,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 26,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 27,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 33,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 38,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 39,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 34,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 48,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 46,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 37,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 35,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 32,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 36,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 47,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 17,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 40,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 45,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 49,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 50,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 55,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 42,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 41,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 43,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 383,\n        \"damage\": 54,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 97,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 97,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 97,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 97,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 97,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 97,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 384,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 385,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 268,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 290,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 269,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 270,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 271,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 272,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 291,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 273,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 274,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 275,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 267,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 292,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 256,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 257,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 258,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 276,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 293,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 277,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 278,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 279,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 283,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 294,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 284,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 285,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 286,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 298,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 299,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 300,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 301,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 302,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 303,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 304,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 305,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 306,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 307,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 308,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 309,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 310,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 311,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 312,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 313,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 314,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 315,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 316,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 317,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 444,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 445,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 69,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 123,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 76,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 72,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 70,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 147,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 148,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 143,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 77,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 151,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 131,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 356,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 404,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 23,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 125,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 33,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 29,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 251,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 122,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 410,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 332,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 368,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 381,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 426,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 409,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 422,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 52,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 116,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 165,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 130,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0000\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0000\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0000\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0000\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0001\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0001\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0001\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0001\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0002\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0002\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0002\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0002\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0003\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0003\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0003\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0003\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0004\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0004\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0004\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0004\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0005\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0005\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0005\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0006\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0006\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0006\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0007\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0007\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0007\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\b\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\t\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\t\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\t\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\t\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\t\\u0000\\u0002\\u0003\\u0000lvl\\u0005\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\n\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\n\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\n\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\n\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\n\\u0000\\u0002\\u0003\\u0000lvl\\u0005\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000b\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000b\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000b\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000b\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000b\\u0000\\u0002\\u0003\\u0000lvl\\u0005\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\f\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\f\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\r\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\r\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000e\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000e\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000e\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000f\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000f\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000f\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000f\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u000f\\u0000\\u0002\\u0003\\u0000lvl\\u0005\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0010\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0011\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0011\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0011\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0012\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0012\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0012\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0013\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0013\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0013\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0013\\u0000\\u0002\\u0003\\u0000lvl\\u0004\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0013\\u0000\\u0002\\u0003\\u0000lvl\\u0005\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0014\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0014\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0015\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0016\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0017\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0017\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0017\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0018\\u0000\\u0002\\u0003\\u0000lvl\\u0001\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0018\\u0000\\u0002\\u0003\\u0000lvl\\u0002\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 403,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\\n\\u0000\\u0000\\t\\u0004\\u0000ench\\n\\u0001\\u0000\\u0000\\u0000\\u0002\\u0002\\u0000id\\u0018\\u0000\\u0002\\u0003\\u0000lvl\\u0003\\u0000\\u0000\\u0000\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 35,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 171,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 351,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 374,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 16,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 17,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 18,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 19,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 20,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 21,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 22,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 23,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 24,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 25,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 26,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 27,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 28,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 29,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 30,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 31,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 32,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 33,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 34,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 35,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 373,\n        \"damage\": 36,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 16,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 17,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 18,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 19,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 20,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 21,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 22,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 23,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 24,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 25,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 26,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 27,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 28,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 29,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 30,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 31,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 32,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 33,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 34,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 35,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 438,\n        \"damage\": 36,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 0,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 1,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 2,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 3,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 4,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 5,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 6,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 7,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 8,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 9,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 10,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 11,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 12,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 13,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 14,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 15,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 16,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 17,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 18,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 19,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 20,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 21,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 22,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 23,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 24,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 25,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 26,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 27,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 28,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 29,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 30,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 31,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 32,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 33,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 34,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 35,\n        \"count\": 1,\n        \"nbt\": \"\"\n    },\n    {\n        \"id\": 441,\n        \"damage\": 36,\n        \"count\": 1,\n        \"nbt\": \"\"\n    }\n]"
  },
  {
    "path": "src/pocketmine/resources/genisys_chs.yml",
    "content": "#Genisys高级配置文件\n\n#配置文件版本\nconfig:\n version: 22\n \nlevel:\n #设置是否变换天气\n weather: true\n #随机天气持续时长最小值，最大值\n weather-random-duration-min: 6000\n weather-random-duration-max: 12000\n #随机闪电间隔，默认10秒，0 = 禁用\n lightning-time: 200\n #是否启用闪电击中着火\n lightning-fire: false\n #是否启用火焰蔓延\n fire-spread: false\n \nplayer:\n #是否打开饥饿\n hunger: true\n #是否打开经验系统\n experience: true\n #是否开启死亡不掉落\n keep-inventory: false\n #是否开启切换模式自动清除背包\n auto-clear-inventory: true\n #是否开启死亡经验不掉落\n keep-experience: false\n #如果玩家进入游戏时崩溃, 请设置低于10的值. 禁用 = -1\n chunk-radius: -1\n \nnether:\n #是否允许地狱，打开此选项会自动生成地狱地图\n allow-nether: true\n #地狱地图名\n level-name: \"nether\"\n \nserver:\n #是否允许生成铁傀儡\n allow-iron-golem: false\n #是否允许生成雪傀儡\n allow-snow-golem: false\n #是否禁用server.log\n disable-log: false\n #是否启用反飞行作弊\n anti-fly: true\n #是否启用异步方式发送区块\n async-chunk-request: true\n #玩家进出服务器消息提醒方式。0为Message，1为Tip，2为Popup\n player-msg-type: 0\n login-msg: \"§3@player 加入了游戏\"\n logout-msg: \"§3@player 退出了游戏\"\n #是否进行移动检测(不再拉回了)\n check-movement: true\n #是否限制创造某些功能(禁止丢物品, 禁止操作箱子等等)\n limited-creative: true\n #是否开启方块破坏粒子\n destroy-block-particle: true\n #是否允许喷溅型药水\n allow-splash-potion: true\n #是否启用高级指令选择器\n advanced-command-selector: false\n allow-instabreak: false\n\nenchantment:\n #是否允许使用铁砧\n enable-anvil: true\n #是否允许使用附魔台\n enable-enchanting-table: true\n #是否启用计算附魔等级(计算书架数量)，可能造成服务器延迟\n #如果不启用本项, 附魔等级将在0-15间随机选取\n count-bookshelf: false\n\nredstone:\n ##############################\n #######是否开启红石系统#######\n ##############################\n #如果不改为true将无法使用红石#\n ##############################\n enable: false\n #是否允许频率脉冲\n frequency-pulse: false\n #设置脉冲频率, 默认: 1s\n pulse-frequency: 1\n \ndserver:\n #多服统统一人数\n enable: false\n #Query自动更新\n query-auto-update: false\n #Query周期更新\n query-tick-update: true\n #Motd最大人数，0为默认\n motd-max-players: 0\n #Query最大人数，0为默认\n query-max-players: 0\n #Motd显示总人数\n motd-all-players: false\n #Query显示总人数\n query-all-players: false\n #Motd显示人数\n motd-players: false\n #Query显示人数\n query-players: false\n #更新频率，20 = 1秒\n time: 40\n #获取失败自动重试次数\n retry-times: 3\n #服务器列表，用;隔开，例如 1.example.com:19132;2.example.com:19133\n server-list: \"\"\n\ninventory:\n #Set this to true if you have problems with anvils. Will process inventory transactions in a vanilla fashion with no anti-cheats or verification.\n allow-cheats: false\n"
  },
  {
    "path": "src/pocketmine/resources/genisys_eng.yml",
    "content": "#Genisys Advanced Configuration File\n\n#Version of this file\nconfig:\n version: 22\n\nlevel:\n #Set if weather is enabled (rain may cause lag to older devices)\n weather: true\n #Weather random duration\n weather-random-duration-min: 6000\n weather-random-duration-max: 12000\n #Random lightning interval，default as 10s, 0 = disable\n lightning-time: 200\n #Set if lightning strikes have fire afterwards\n lightning-fire: false\n #Set if fire should spread (trees, etc.)\n fire-spread: false\n\nplayer:\n #Set if hunger is enabled\n hunger: true\n #Choose if experience is enabled\n experience: true\n #Choose if to keep a player's inventory after they die\n keep-inventory: false\n #Clear the inventory of a player upon them changing their gamemode\n auto-clear-inventory : true\n #Choose if to keep a player's experience after they die\n keep-experience: false\n #If players crash when joining, change this to less than 10. disable=-1\n chunk-radius: -1\n\nnether:\n #Choose if the nether is allowed. The level of nether will generate automatically\n allow-nether: true\n #The name of nether's level\n level-name: \"nether\"\n\nserver:\n #Choose if spawning iron golem is allowed\n allow-iron-golem: false\n #Choose if spawning snow golem is allowed\n allow-snow-golem: false\n #Choose if server.log is disabled\n disable-log: false\n #Choose if to enable anti-fly\n anti-fly: true\n #Choose if async chunks request is enabled\n async-chunk-request: true\n #Choose how to remind players when someone joins the game\n #0 = Message, 1 = Tip, 2 = Popup\n player-msg-type: 0\n login-msg: \"§3@player joined the game\"\n logout-msg: \"§3@player left the game\"\n #Choose if movement check is enabled (no more pull backs when moving fast)\n check-movement: true\n #Set if limited creative is enabled (cannot drop items from hotbar, cannot open chests, and so on)\n limited-creative: true\n #Set if add DestroyBlockParticle\n destroy-block-particle: true\n #Set if splash potions are enabled\n allow-splash-potion: true\n #Set if Advanced Command Selector is enabled\n advanced-command-selector: false\n \n allow-instabreak: false\n\nenchantment:\n #Choose if anvils are enabled\n enable-anvil: true\n #Choose if enchantment tables are enabled\n enable-enchanting-table: true\n #Choose if to count bookshelves (may cause server lag)\n #If this option is false, the server will use a random count (0~15)\n count-bookshelf: false\n\nredstone:\n ################################################\n ####Choose if the redstone system is enabled####\n ################################################\n #If it is false, the redstone system won't work#\n ################################################\n enable: false\n #Choose if frequency pulses are enabled\n frequency-pulse: false\n #Set the frequency of pulse. Default = 1s\n pulse-frequency: 1\n\ndserver:\n #The count of all multi-server unified\n enable: false\n #Update Query automatically\n query-auto-update: false\n #Update Query periodically\n query-tick-update: true\n #The max players' on the MOTD\n motd-max-players: 0\n #The max players' on the Query. 0=Default\n query-max-players: 0\n #Show the number of all players on MOTD\n motd-all-players: false\n #Show the number of all players on Query\n query-all-players: false\n #Show the number of online players on MOTD\n motd-players: false\n #Show the number of online players on Query\n query-players: false\n #Update Frequency. 20=1s\n time: 40\n #Auto-retry # of times when server fails\n retry-times: 3\n #the server list，Separate by ';'，e.g. 1.example.com:19132;2.example.com:19133\n server-list: \"\"\n\ninventory:\n #Set this to true if you have problems with anvils. This will process inventory transactions in a vanilla fashion with no anti-cheats or verification.\n allow-cheats: false\n"
  },
  {
    "path": "src/pocketmine/resources/genisys_kor.yml",
    "content": "#Genisys 고급 구성 파일\n\n#Version 파일의 버전\nconfig:\n version: 22\n\nlevel:\n #날씨 시스템을 켜는 경우 설정하세요\n weather: true\n #날씨 랜덤 기간\n weather-random-duration-min: 6000\n weather-random-duration-max: 12000\n #랜덤 번개 치는 주기，기본은 10초, 0 = 비활성화\n lightning-time: 200\n #번개가 불과 함께 치게 하려는 경우 설정하세요\n lightning-fire: false\n #불이 번지는 것을 활성화 하려는 경우 설정하세요\n fire-spread: false\n \nplayer:\n #배고픔 시스템 스위치\n hunger: true\n #경험치 시스템을 켜는 경우 고르세요\n experience: true\n #플레이어가 사망하였을때 인벤토리를 유지하려는 경우 고르세요\n keep-inventory: false\n #게임 모드를 크리에이티브로 변경하는 경우 자동으로 인벤토리를 비웁니다\n auto-clear-inventory : true\n #플레이어가 사망하였을때 경험치를 유지하려는 경우 고르세요\n keep-experience: false\n #플레이어들이 참여했을때 크래시가 발생하는 경우, 이 값을 10 이하로 설정하세요. 비활성화=-1\n chunk-radius: -1\n\nnether:\n #지옥이 허용된 경우 고르세요. 지옥 레벨이 자동으로 생성됩니다.\n allow-nether: true\n #지옥 레벨의 이름\n level-name: \"nether\"\n \nserver:\n #철 골램을 생성하는 것이 허용된 경우 고르세요\n allow-iron-golem: false\n #눈 골렘을 생성하는 것이 허용된 경우 고르세요\n allow-snow-golem: false\n #server.log를 비활성화 하는 경우 고르세요\n disable-log: false\n #자동 비행 방지를 활성화 하는 경우 고르세요\n anti-fly: true\n #비동기 청크 요청을 활성화 하는 경우 고르세요\n async-chunk-request: true\n #플레이어가 참여할 때 뜨는 메시지를 고릅니다\n #0 = 메시지, 1 = 팁, 2 = 팝업\n player-msg-type: 0\n login-msg: \"§3@player님이 게임에 참여했습니다\"\n logout-msg: \"§3@player님이 게임을 떠났습니다\"\n #움직임 확인을 활성화 하는 경우 고르세요 (더 이상 뒤로 당겨지지 않음)\n check-movement: true\n #제한된 크리에이티브를 활성화 하는 경우 설정하세요 (아이템 드롭 불가, 상자 열기 불가 등)\n limited-creative: true\n #블럭 파괴 파티클을 추가하는 경우 설정하세요\n destroy-block-particle: true\n #투척용 포션을 활성화 하는 경우 고르세요\n allow-splash-potion: true\n #고급 명령어 선택기를 활성화 하는 경우 설정하세요\n advanced-command-selector: false\n allow-instabreak: false\n\nenchantment:\n #모루가 허용된 경우 고르세요\n enable-anvil: true\n #마법 부여대가 허용된 경우 고르세요\n enable-enchanting-table: true\n #책장의 수를 세려는 경우 활성화 하세요. 서버 랙을 유발할 수도 있습니다.\n #만약 이 옵션이 false인 경우, 서버는 랜덤 카운트를 사용할 것 입니다 (0~15)\n count-bookshelf: false\n\nredstone:\n #####################################\n ######레드스톤 시스템이 허용된 경우 고르세요######\n #####################################\n #만약 true가 아닌 경우 레드스톤이 작동하지 않습니다#\n #####################################\n enable: false\n #주파수 펄스를 허용하는 경우 고르세요\n frequency-pulse: false\n #펄스 주파수 설정, 기본: 1초\n pulse-frequency: 1\n\ndserver:\n #모든 멀티 (다중) 서버의 수 통합\n enable: false\n #자동으로 쿼리 업데이트\n query-auto-update: false\n #쿼리 업데이트 주기\n query-tick-update: true\n #Motd 최대 플레이어 숫자\n motd-max-players: 0\n #쿼리 최대 플레이어 숫자，0=기본\n query-max-players: 0\n #motd에서 모든 플레이어의 숫자 표시\n motd-all-players: false\n #쿼리에서 모든 플레이어의 숫자 표시\n query-all-players: false\n #motd에서 온라인 플레이어의 숫자 표시\n motd-players: false\n #쿼리에서 온라인 플레이어의 숫자 표시\n query-players: false\n #업데이트 주기, 20=1초\n time: 40\n #실패한 경우 다시 시도할 빈도\n retry-times: 3\n #서버 목록，';'를 사용하여 분리하세요，예시: 1.example.com:19132;2.example.com:19133\n server-list: \"\"\n\ninventory:\n #모루와 관련된 문제가 있는 경우 true로 설정하세요. 인벤토리 처리를 vanila fashion (기본 방식)으로 치트 방지나 확인 없이 진행합니다.\n allow-cheats: false"
  },
  {
    "path": "src/pocketmine/resources/genisys_vie.yml",
    "content": "#Cài đặt Genisys cho server (Genisys VN Version)\n\n#Phiên bản file cài đặt\nconfig:\n version: 22\n\nlevel:\n #Chỉnh nếu muốn bật/tắt thời tiết (true/false)\n weather: true\n #Thời gian ngẫu nhiên điều chỉnh thời tiết\n weather-random-duration-min: 6000\n weather-random-duration-max: 12000\n #Thời gian đánh sấm sét ngẫu nhiên，mặc định là 10s, 0 = huỷ sấm sét\n lightning-time: 200\n #Bật/tắt nếu sấm sét đánh có lửa (true/false)\n lightning-fire: false\n #Bật/tắt nếu muốn lửa lan (true/false)\n fire-spread: false\n \nplayer:\n #Bật/tắt nếu muốn thêm chế độ đói (true/false)\n hunger: true\n #Bật/tắt nếu muốn thêm chế độ điểm kinh nghiệm (true/false)\n experience: true\n #Bật/tắt nếu muốn server chết không mất đồ (true/false)\n keep-inventory: false\n #Bật/tắt nếu tự động quét hết đồ trong kho đồ khi chuyển sang chế độ sáng tạo (true/false)\n auto-clear-inventory : true\n #Bật/tắt nếu muốn chết không mất kinh nghiệm (true/false)\n keep-experience: false\n #Nếu người chơi vào game bị crash, đặt nó là 10. Hủy chế độ=-1\n chunk-radius: -1\n\nnether:\n #Bật/tắt nếu muốn thêm địa ngục vào server, khi bật server hệ thống sẽ tự tạo thế giới địa ngục (true/false)\n allow-nether: true\n #Đặt tên cho thế giới địa ngục của bạn.\n level-name: \"nether\"\n \nserver:\n #Bật/tắt nếu muốn thêm Iron Golem vào server (true/false)\n allow-iron-golem: false\n #Bật/tắt nếu muốn thêm Snow Golem vào server (true/false)\n allow-snow-golem: false\n #Bật/tắt nếu muốn hủy server.log <file theo dõi lệnh và người chơi trong server> (true/false)\n disable-log: false\n #Bật/tắt nếu muốn hủy chế độ bay (true/false)\n anti-fly: true\n #Bật/tắt nếu muốn yêu cầu khối Async (mặc định: true) (true/false)\n async-chunk-request: true\n #Chọn để thông báo người chơi đã vào hoặc rời (nếu bạn không biết có thể bỏ qua)\n #0 = Tin nhắn, 1 = Mẹo, 2 = Thanh nổi ở thanh chọn đồ\n player-msg-type: 0\n login-msg: \"§3@player joined the game\"\n logout-msg: \"§3@player left the game\"\n #Bật/tắt nếu muốn kiểm tra tốc độ (không còn đẩy lùi mỗi khi đi) (true/false)\n check-movement: true\n #Bật/tắt nếu kích hoạt chế độ sáng tạo giới hạn (Không thể rớt đồ, mở rương và hơn thế nữa) (mặc định: false) (true/false)\n limited-creative: true\n #Bật/tắt nếu muốn kích hoạt DestroyBlockParticle (phá block tự nhiên) (true/false)\n destroy-block-particle: true\n #Bật/tắt nếu muốn thêm chai ném (true/false)\n allow-splash-potion: true\n #Bật/tắt nếu muốn thêm Lệnh Nâng Cao (mặc định: false) (true/false)\n advanced-command-selector: false\n allow-instabreak: false\n \nenchantment:\n #Bật/tắt nếu muốn kích hoạt Cái Đe\n enable-anvil: true\n #Bật/tắt nếu muốn kích hoạt Bàn Phù Phép\n enable-enchanting-table: true\n #Bật/tắt nếu muốn đếm sách trong tủ sách, có thể gây server lag\n #Nếu để false, server sẽ tự động đếm từ (0~15)\n count-bookshelf: false\n \nredstone:\n ##########################################\n ###Bật/tắt nếu muốn thêm chế độ đá đỏ###\n ##########################################\n #Nếu không bật thì sẽ không hoạt động#\n ##########################################\n enable: false\n #Bật/tắt nếu muốn chia tỷ lệ hoạt động\n frequency-pulse: false\n #Đánh số tỷ lệ hoạt động, mặc định: 1 giây\n pulse-frequency: 1\n\ndserver:\n #Tất cả các server gộp vào. Bật/tắt để hoạt động (true/false)\n enable: false\n #Query update automatically\n query-auto-update: false\n #Query update periodical\n query-tick-update: true\n #The max players' number of Motd\n motd-max-players: 0\n #The max players' number of query，0=Default\n query-max-players: 0\n #Show the number of all players on motd\n motd-all-players: false\n #Show the number of all players on Query\n query-all-players: false\n #Show the number of online players on motd\n motd-players: false\n #Show the number of online players on Query\n query-players: false\n #Update Frequency ,20=1s\n time: 40\n #Auto-retry times when failed\n retry-times: 3\n #the server list，Separate by ';'，e.g. 1.example.com:19132;2.example.com:19133\n server-list: \"\"\n\ninventory:\n #Set this to true if you have problems with anvils. Will process inventory transactions in a vanilla fashion with no anti-cheats or verification.\n allow-cheats: false\n"
  },
  {
    "path": "src/pocketmine/resources/genisys_zho.yml",
    "content": "#Genisys進階設定檔案\n\n#設定檔案版本\nconfig:\n version: 22\n\nlevel:\n #設定是否變換天氣\n weather: true\n #隨機天氣持續時長最小值，最大值\n weather-random-duration-min: 6000\n weather-random-duration-max: 12000\n #隨機閃電間隔，預設10秒，0=不啟用\n lightning-time: 200\n #設定是否閃電擊中起火\n lightning-fire: false\n #設定是否火焰蔓延\n fire-spread: false\n \nplayer:\n #是否打開飢餓\n hunger: true\n #是否打開經驗系統\n experience: true\n #是否開啟死亡不掉落\n keep-inventory: false\n #是否開啟切換模式自動清除背包\n auto-clear-inventory: true\n #是否開啟死亡經驗不掉落\n keep-experience: false\n #如果玩家進入遊戲時崩潰, 請設置該值低於10. 禁用 = -1\n chunk-radius: -1\n\nnether:\n #是否允許地獄，打開此選項會自動生成地獄地圖\n allow-nether: true\n #地獄地圖名\n level-name: \"nether\"\n \nserver:\n #是否允許生成鐵傀儡\n allow-iron-golem: false\n #是否允許生成雪傀儡\n allow-snow-golem: false\n #是否停用server.log\n disable-log: false\n #是否啟用反飛行作弊\n anti-fly: true\n #是否啟用異步發送區塊\n async-chunk-request: true\n #玩家進出伺服器訊息提醒方式。0為Message，1為Tip，2為Popup\n player-msg-type: 0\n login-msg: \"§3@player 加入了遊戲\"\n logout-msg: \"§3@player 離開了遊戲\"\n #是否進行移動檢測(不再拉回了)\n check-movement: true\n #是否限制創造某些功能(禁止丟物品, 禁止操作箱子等等)\n limited-creative: true\n #是否開啟方塊破壞粒子效果\n destroy-block-particle: true\n #是否啟用噴濺型藥水\n allow-splash-potion: true\n #是否啟用進階指令選擇器\n advanced-command-selector: false\n allow-instabreak: false\n\nenchantment:\n #是否允許使用鐵砧\n enable-anvil: true\n #是否允許使用附魔台\n enable-enchanting-table: true\n #是否啟用計算附魔等級(計算書架數量)，可能造成伺服器延遲\n #如果不啟用本項, 附魔等級將在0-15間隨機選取\n count-bookshelf: false\n\n\nredstone:\n ##############################\n #######是否開啟紅石系統#######\n ##############################\n #如果不改為true將無法使用紅石#\n ##############################\n enable: false\n #是否允許頻率脈衝\n frequency-pulse: false\n #設定脈衝頻率, 預設: 1s\n pulse-frequency: 1\n\ndserver:\n #多服統一人數\n enable: false\n #Query自動更新\n query-auto-update: false\n #Query週期更新\n query-tick-update: true\n #Motd最大人數，0為預設\n motd-max-players: 0\n #Query最大人數，0為預設\n query-max-players: 0\n #Motd顯示總人數\n motd-all-players: false\n #Query顯示總人數\n query-all-players: false\n #Motd顯示人數\n motd-players: false\n #Query顯示人數\n query-players: false\n #更新頻率，20 = 1秒\n time: 40\n #獲取失敗自動重試次數\n retry-times: 3\n #伺服器列表，用;隔開，例如 1.example.com:19132;2.example.com:19133\n server-list: \"\"\n\ninventory:\n #Set this to true if you have problems with anvils. Will process inventory transactions in a vanilla fashion with no anti-cheats or verification.\n allow-cheats: false\n"
  },
  {
    "path": "src/pocketmine/resources/pocketmine.yml",
    "content": "# Main configuration file for PocketMine-MP\n# These settings are the ones that cannot be included in server.properties\n# Some of these settings are safe, others can break your server if modified incorrectly\n# New settings/defaults won't appear automatically on this file when upgrading.\n\nsettings:\n #Three-letter language code for server-side localization\n #Check your language code on https://en.wikipedia.org/wiki/List_of_ISO_639-2_codes\n language: \"eng\"\n #Whether to send all strings translated to server locale or let the device handle them\n force-language: false\n #When server shut down, the players will get kicked and this is what will show on there screen.\n shutdown-message: \"Server closed\"\n #Allow listing plugins via Query\n query-plugins: true\n #Show a console message when a plugin uses deprecated API methods\n deprecated-verbose: true\n #Enable plugin and core profiling by default\n enable-profiling: false\n #Will only add results when tick measurement is below or equal to given value (default 20)\n profile-report-trigger: 20\n #Number of AsyncTask workers.\n #Used for plugin asynchronous tasks, world generation, compression and web communication.\n #Set this approximately to your number of cores.\n #If set to auto, it'll try to detect the number of cores (or use 2)\n async-workers: 4\n #Enables use of non-production, development builds. WARNING: DO NOT enable this unless you are sure you know what you are doing.\n enable-testing: false\n\nmemory:\n #Global soft memory limit in megabytes. Set to 0 to disable\n #This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this\n global-limit: 0\n\n #Main thread soft memory limit in megabytes. Set to 0 to disable\n #This will trigger low-memory-triggers and fire an event to free memory when the usage goes over this\n main-limit: 0\n\n #Main thread hard memory limit in megabytes. Set to 0 to disable\n #This will stop the server when the limit is surpassed\n main-hard-limit: 1024\n\n #Period in ticks to check memory (default 1 second)\n check-rate: 20\n\n #Continue firing low-memory-triggers and event while on low memory\n continuous-trigger: true\n\n #Only if memory.continuous-trigger is enabled. Specifies the rate in memory.check-rate steps (default 30 seconds)\n continuous-trigger-rate: 30\n\n garbage-collection:\n  #Period in ticks to fire the garbage collector manually (default 30 minutes), set to 0 to disable\n  #This only affect the main thread. Other threads should fire their own collections\n  period: 36000\n\n  #Fire asynchronous tasks to collect garbage from workers\n  collect-async-worker: true\n\n  #Trigger on low memory\n  low-memory-trigger: true\n\n max-chunks:\n  #Limit of chunks to load per player, overrides chunk-sending.max-chunks\n  trigger-limit: 28\n\n  #Do chunk garbage collection on trigger\n  trigger-chunk-collect: true\n\n  #Trigger on low memory\n  low-memory-trigger: true\n\n world-caches:\n  disable-chunk-cache: true\n  low-memory-trigger: true\n\n\nnetwork:\n #Threshold for batching packets, in bytes. Only these packets will be compressed\n #Set to 0 to compress everything, -1 to disable.\n batch-threshold: 256\n #Compression level used when sending batched packets. Higher = Uses More CPU, Less = More Bandwidth Usage\n compression-level: 2\n #Use AsyncTasks for compression. Adds half/one tick delay, less CPU load on main thread\n async-compression: true\n #Experimental, only for Windows. Tries to use UPnP to automatically port forward\n upnp-forwarding: false\n\ndebug:\n #If > 1, it will show debug messages in the console\n level: 1\n #Enables /status, /gc\n commands: true\n\nplayer:\n #Choose whether to enable player data saving.\n save-player-data: true\n\nlevel-settings:\n #The default format that levels will use when created\n convert-format: false\n default-format: pmanvil\n #Automatically change levels tick rate to maintain 20 ticks per second\n auto-tick-rate: false\n auto-tick-rate-limit: 20\n #Sets the base tick rate (1 = 20 ticks per second, 2 = 10 ticks per second, etc.)\n base-tick-rate: 1\n #Tick all players each tick even when other settings disallow this.\n always-tick-players: false\n\nchunk-sending:\n #Amount of chunks sent to players per tick\n per-tick: 1\n #Amount of chunks sent around each player\n max-chunks: 32\n #Amount of chunks that need to be sent before spawning the player\n spawn-threshold: 28\n #Save a serialized copy of the chunk in memory for faster sending\n #Useful in mostly-static worlds where lots of players join at the same time\n cache-chunks: true\n\nchunk-ticking:\n #Max amount of chunks processed each tick\n per-tick: 16\n #Radius of chunks around a player to tick\n tick-radius: 3\n light-updates: false\n clear-tick-list: true\n\nchunk-generation:\n #Max. amount of chunks in the waiting queue to be generated\n queue-size: 2\n #Max. amount of chunks in the waiting queue to be populated\n population-queue-size: 2\n\nticks-per:\n animal-spawns: 400\n monster-spawns: 1\n autosave: 6000\n cache-cleanup: 900\nspawn-limits:\n  monsters: 70\n  animals: 15\n  water-animals: 5\n  ambient: 15\n\nauto-report:\n #Send crash reports for processing\n enabled: false\n send-code: true\n send-settings: true\n send-phpinfo: false\n host: crash.pocketmine.net\n\nanonymous-statistics:\n #Sends anonymous statistics for data aggregation, plugin usage tracking\n enabled: true\n host: stats.pocketmine.net\n\ncommands:\n #Here you can customize server commands\n #Specify command names to override the default set here.\n #If no custom value is defined for a command, the default will be used.\n #NOTE: Some commands cannot be disabled here, such as the important ones like /stop, /reload, etc.\n default: true\n #Set override values per command here\n #For example, uncommenting the below will disable /plugins and /version\n #version: false\n #plugins: false\n\naliases:\n #Examples:\n #showtheversion: version\n #savestop: [save-all, stop]\n\nworlds:\n #These settings will override the generator set in server.properties and allows loading multiple levels\n #Example:\n #world:\n # seed: 404\n # generator: FLAT:2;7,59x1,3x3,2;1;decoration(treecount=80 grasscount=45)\n"
  },
  {
    "path": "src/pocketmine/resources/recipes.json",
    "content": "[\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 270,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2a364c43-857c-4fe2-8826-9aebe0d640ba\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 269,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5f3e5e58-fff0-1e20-8b19-1f8fa069c29a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 271,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"033e3209-67be-3064-8ee0-4c1df9e3efb0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 290,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f039cee0-8ada-16b43-83c2-dba415934cb3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 274,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1630d261-e294-3398-88c3-33223a3f3192\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 273,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2136462f-b302-0288-8658-b9822c17c6b9\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 275,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"82389a40-f1e0-18c31-8c11-5cc451283a9e\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 291,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e638df84-d1fa-01d1-80ff-1ccfe9e881b5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 257,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fc3a9a88-1430-874a-802b-be8f0a2ecba0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 256,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"21365028-8729-7afa-847a-98b2080703a9\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 258,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"49323a6f-e1f7-831f-898e-fb306e405395\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 292,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f93f8b91-2310-19b39-89aa-9279360cf6ab\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 278,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"45345231-2070-17dc6-8a48-cc6cb27e2691\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 277,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2739bac0-3867-33a3-8d9e-1e62754ae4ae\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 279,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7b333b8c-80f3-192ed-8546-55b2736127b9\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 293,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"323b5a12-bd8b-1a1b-850e-473b0aafc0b9\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 285,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7839adb8-b73c-8a3b-89fc-44ea4377ac87\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 284,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"cc3b13b7-8176-1867b-8086-3fc9539cd9af\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 286,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b53b05c1-485c-7198-86fa-85432f4e23b5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 294,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"823849df-0e00-20fb2-8a2a-2f1637090fb0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 359,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"073cfc0b-2c8f-122f-829e-1ccfc2911790\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 268,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c63a607b-8953-4cf2-84d6-89907977aaa9\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 272,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2436a89b-13a4-867d-8af3-445883ad0e87\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 267,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4637ec4d-0660-1656b-8347-0a97df65b5ab\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 276,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"413a3a8c-4d3d-196c-897c-8330933081b0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 283,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0b3cfd7d-8458-8b42-8cb2-ff773171d496\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 261,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"883ff9ac-dd0a-6b07-8612-927b6ec06dbb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 318,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 288,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6c3a21ce-d85e-6f9d-8004-3b78e848129b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"073120b7-bdb4-9e06-83a4-569ec2a4b2be\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 1,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2b3b2e14-3ed4-216e2-80ee-0363f331618e\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 2,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5a319d66-a842-16b7f-84b0-3710270db3a0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 3,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"033cae74-338a-9f98-8b5b-0ee01b17e69a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 4,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c93d9615-e637-1639b-824c-f34b656789b3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 5,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"bc3fcd5f-b589-37a1-832f-9fe8f482ba8f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 6,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6a34dd19-cb6d-21416-8028-f95c7be96ba2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 7,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f5383a27-c47f-0659-8c8e-346f8a3e678d\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 8,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1436a1ae-bba9-8425-8d15-83b22e13e993\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 9,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8a3c7d13-895a-18f47-8a91-4b907a3d6388\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 10,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 10,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d23f51c8-0e67-20d8c-86b9-53a7cf20a2aa\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 11,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6d38150d-b6ad-3297-8ec3-c214aada8b88\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 12,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 12,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"343c2082-e07b-1564-8128-3a478e53818c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 13,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 13,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9934706d-f11e-7efa-8fdf-039bb0aee69c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 14,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 14,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7e390cc8-3f5f-231d-8364-b3df92b56099\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 15,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4e35a75f-4824-27c3-8fcc-5659355b4d8c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 16,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 16,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"94304308-1c10-3a05-8690-63494bfd3f87\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 17,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 17,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"68313c2a-5157-5bd1-80e9-af6a82820190\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 18,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 18,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d13ca58e-16d8-5d50-8e2b-65df250cf985\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 19,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 19,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7c3ea290-3fbc-20842-84ba-ec352bf78c98\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 20,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 20,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e935e60e-dce0-23f3-8b97-c0422a57b5a0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 21,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 21,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e938b4b9-f1e9-2371-86da-cf7425c50ab3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 22,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 22,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c73d8686-e05f-1756b-8aa7-23a37b88fca9\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 23,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 23,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e930b08f-6178-1f08-8f4d-db23b0a38680\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 24,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 24,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a732ba57-78ea-16ea3-826e-84369dd572ae\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 25,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 25,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ab32db74-1dda-21808-8c9e-62c7c83f5196\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 26,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 26,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"503963b9-85ef-16ce0-8950-7148e51704a4\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 27,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 27,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a1380d85-91dd-7a88-8ff6-8dec953ed393\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 28,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 28,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6f3ab76e-116c-3aff-8987-df601dd850ae\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 29,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 29,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"eb34727b-312e-7397-8022-f9c78527c288\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 30,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 30,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ed308b60-9771-208d2-8417-daddde3f87b5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 31,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 31,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c5372590-b199-8cab-850e-7ce4c36c1fbe\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 32,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 32,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9e3003a6-a7d7-2d1c-837e-9a590338e2b1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 33,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 33,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6e3a310a-5bb7-21b3e-8be2-88919faf46bd\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 34,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 34,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"063449a7-a70e-8b67-8f79-2d29acaabdb3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 35,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 35,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b73909c8-407e-4af1-8631-045baf7896a3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 441,\n                \"damage\": 36,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 262,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 262,\n                \"damage\": 36,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3f37b026-1cc5-41bd-80d8-e3de2a2a9e87\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"bf3b509d-29ad-212c4-8394-c2a1449d94b4\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"963d5efb-608a-3fc6-812d-2e29907569a9\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 42,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"91319c17-0761-219dd-8365-c3ed85b468b7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 42,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d5333397-9873-48b2-89ef-f289d7370887\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 57,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9a3c799a-902b-737b-8f9d-0214f80ca680\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 57,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8b3af454-68d6-17180-826f-91e60a459aa5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 133,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8e3ff10d-11ac-0474-89d9-aa7ac129e2a8\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 133,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 388,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"54327f02-0e77-5bdc-8a84-f30cd653f5bd\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 152,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2a39b305-0ef0-4e8d-8e0e-5965cde94a81\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 152,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c831f836-7f6b-16e22-840e-b9f5b67a45b4\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 22,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"98350af4-6a77-171ed-8e51-3ef161e051a7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 22,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3731afc2-4dc4-20d70-8a02-7ca45368a597\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 170,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"093794b2-bb4f-8bc4-8752-6cf199757bb4\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 170,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e4377102-bb59-906a-8212-5ef0ef3d0091\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 173,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8f314a48-8623-209ac-851b-b93635cb87bc\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 173,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"47319339-f584-2083d-8f9e-7effb212dba7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a93adb54-e898-20594-896c-9789911093bf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c531db02-2da9-185a9-871d-47ea2757f1bc\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 39,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 40,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 281,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 282,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"87378c37-a972-20f75-81fe-54073de31ea3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 457,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 457,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 457,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 457,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 457,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 457,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 281,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 459,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5431cba0-ddad-1991d-8e63-9419018880bb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 357,\n                \"damage\": 0,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f33ca2be-983f-211fc-81d2-bdc7b5d4e7b3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 103,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f73aad80-b98c-23d5-87c1-c48eb3f58aaf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 362,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1a3aac4a-cf8a-18c14-86e4-771936bea08d\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 86,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 361,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4d374e51-80b9-8d3a-8953-00b3dabbb6ad\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 86,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 353,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 344,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 400,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a032e78c-6d03-7ad4-8a8e-9a4374c8d48d\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 375,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 353,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 39,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 376,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c3321dca-9cba-6479-8a46-ae2444448796\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 54,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9b3bfd0d-dfbb-11d1-8bc1-6c4149c8c1ba\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 131,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 54,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 146,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1630e376-9a3d-6459-8d8a-754e9c62b3ba\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 61,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"39390d3f-51d9-579a-80df-79845c337595\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 58,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6035394d-23bd-3b3c-8684-04f702c38996\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 12,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 24,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"473227b7-5231-199c1-8b7c-4abbe9d466b2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 12,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 179,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"31371b9e-c049-5f79-8849-c06a9d7e0698\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 24,\n                \"damage\": 2,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"df3a19da-d1d8-57e9-84b7-55f44b736796\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 179,\n                \"damage\": 2,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1a3b5473-0988-8b3a-8bed-e77857fd0eb5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 44,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 44,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 24,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6d32491f-31ee-218c9-8adc-e89ec9517685\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 182,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 182,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 179,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1f33558c-7832-5434-8940-a1bc9acf14a6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 98,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c931d6f1-9957-211ab-87f4-67922b5b44bf\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 106,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 98,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2d398a00-38c4-18877-8aeb-0de70e35a7bd\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 44,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 44,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 98,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"68318ab3-494e-286d-8af0-265a23ceaba3\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 106,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 48,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c23a67fd-1522-19c79-8bf5-c6d06cdb04ab\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 101,\n                \"damage\": 0,\n                \"count\": 16,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1f353853-95f7-194e2-8a38-388cb2f05bae\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 102,\n                \"damage\": 0,\n                \"count\": 16,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e339f60b-58b0-209bf-8f24-005b0b8d2190\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 405,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 405,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 405,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 405,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7c3b2324-66f4-17070-8aa0-03173a10e092\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 155,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a2350812-19b7-194f8-8143-555f2897b080\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 44,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 44,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 155,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3f3d4f13-3577-5629-8298-01157c61f7b2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 155,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 155,\n                \"damage\": 2,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4b34fd08-5a27-62d5-8d37-1eb97664c797\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 182,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 182,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 201,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6a34d67f-93c2-55fb-8d6d-ef7ba86f1f90\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 1,\n                \"damage\": 3,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0a3217e6-410a-8ebc-8e01-e206e8ae5b8a\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 1,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fa398915-6990-38d5-8569-34c79abdc1a3\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 1,\n                \"damage\": 5,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5a3a03c2-ac91-21fb0-8569-6d1891195f9f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 1,\n                \"damage\": 4,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c03f3cf7-c6aa-90a5-8b4b-e304292aa594\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 1,\n                \"damage\": 2,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"973b28bb-ea82-9312-8bf9-64a5716e95be\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 1,\n                \"damage\": 6,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5532eb84-5fb8-8203-826f-34a9210f9a8c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 399,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 138,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"323fbcf6-aa7d-55f2-8f88-f0bc76503ca0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 381,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 130,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5b354173-5741-103e-83bc-5269096d5e96\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 298,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ec3af022-cb41-163d2-8d85-f753e955e7bf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 299,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1e3ef3dc-cb37-4f62-8b69-2ab6a76e8980\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 300,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7a39c1a0-a7c0-19e50-8820-725087862baa\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 301,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c438d55f-192f-9613-8758-4517bc53eda0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 306,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"bf38ea3b-e050-536f-84ab-0fad66dccaaf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 307,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ee3d8ccf-b46c-3f5f-8dad-69a77f493883\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 308,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c13d9b21-7852-161d6-8d98-3612336e9bbb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 309,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"bf3a72cd-edf2-7a72-8467-05c1b4077b8c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 310,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ba3047be-2c9b-18d18-8f50-29e06e31c689\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 311,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6d39d10b-efcb-18d9c-8c8e-5acf4b2604bc\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 312,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"aa311c01-5700-1802f-8e95-b157ffdfcb96\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 313,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b336ede3-beda-56b1-8c54-b63536665190\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 314,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0d3c3016-d988-809b-803a-2a4f814a3ead\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 315,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b230d068-4b94-17cf7-8eec-87e6de63caab\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 316,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"56398605-20d0-19af0-8eaa-8bd40d222ab6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 317,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5f3d105b-f4c4-17897-84af-c02f3529b3ac\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9933e957-d5d4-19b3e-868d-c10ac97a8b98\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 14,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"613780d3-5589-3697-8597-bd21cdd31199\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 13,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"86321a6e-4638-2849-84af-4a68e1ed919c\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 12,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b937b884-f9cc-879f-8b33-2c7b4539ce82\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"61338caa-4ad8-6870-8a6b-91e440827e93\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 10,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"433d6590-a1bd-7287-82ef-f53c876c158a\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e633fc1e-87e4-75b8-827d-75ab815388a3\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6d348cf3-d258-206ab-8cfb-bd285a4097aa\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2d3f1ee4-5023-18215-8768-a54c0c021cac\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d737746c-45ac-7bb3-8df6-fb5af07f12b9\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 10,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c339bf7d-3ccb-706d-8b17-ae83b9c63bbb\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"953a52c1-2437-18943-8196-3abb5a5ebf90\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 12,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3836e9a9-9bf8-15cd-8477-678c831d6da3\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 13,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c133e550-e5e1-5300-81cc-7956803f0aa3\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 14,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"85392541-c362-21bd9-8e4a-adfa4dda1cbb\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5a37c96e-6470-17d7-87ba-91b9ffbc939b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 37,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a0311c72-9ce8-6e1b-8605-9dc24f80b7bb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 244,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6f3fca6d-61be-5f9a-82e5-99d1d16d3a98\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d83d8e91-b2eb-27c3-85eb-30dcea81028f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 352,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"bd3cdf20-9497-1e61-8755-d58b17ec278a\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 9,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"663e280b-458a-97bf-814d-d663a9d7e0a0\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 14,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4934ddb7-c5a6-2d08-8086-f8f53b66a38e\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 10,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"25315582-32df-6b4c-820f-8dbce73ba9b8\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 8,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a03b1422-c74a-20d44-8e46-add2110490b8\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 7,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"02388bf8-4ecd-7ee3-8b43-04bfbac5169c\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 7,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a33440ff-066e-1834f-8f8e-00c263dcc287\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 12,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f13f73ad-86d3-16b6f-8c30-50b42127bab1\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 6,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"df3c3988-562b-6d5d-888c-5788cd1ea79a\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 5,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2c321882-8fe7-7871-8d30-545dc7ad1a9f\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 13,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0b3bd19f-d94d-6f56-8d0d-cf9bcc03e585\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 13,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3434c871-fbe3-8320-8de6-2b0f439a9c83\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 13,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"48344599-75f0-2a2d-8c00-626bc5f709ae\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 12,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"db33ca16-cf29-5786-8f94-ba8d1a5a0d9a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 13,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9e3fca12-3fc3-19d4a-8dd4-38f23649299e\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c53e2234-7399-0986-8e83-90deaa7b9f8a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"743b69c3-caf5-1664b-83f7-46a09fe246b5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 14,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c4398b5e-e4cb-8c50-8701-4c20102482be\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4932b300-aa87-27fb-8aaa-d91cefdfc8a3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c5321071-e030-19eba-8f45-f9c2c2ab7ca1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 38,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1036849a-ef21-59e5-8c0f-1cc3c440c589\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 175,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 11,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8e38e205-c8f9-1050-8e04-2ba83ba0ad93\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 175,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 13,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"733c9dee-309c-167d9-860b-d477d94d5b9b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 175,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1a38816d-4dbf-1bff-894c-137f7ffc1cbc\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 175,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 9,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8f30e3db-ef57-429a-8045-bb3acb565699\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 457,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6939256c-4719-6edb-869a-8f353c8c4f97\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 395,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3337999f-0215-6562-89b0-2b9d7c6da9aa\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 345,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 395,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1b393304-d5f7-3f60-8aec-47bbdcb5b599\"\n    },\n    {\n        \"type\": 4,\n        \"uuid\": \"9d4d10ba-5597-9385-8443-e9a8b7efcca4\"\n    },\n    {\n        \"type\": 4,\n        \"uuid\": \"ae40a14b-75b0-92d3-8ef6-568d86af8987\"\n    },\n    {\n        \"type\": 4,\n        \"uuid\": \"4b43944b-9422-18dae-8793-2cbb99446786\"\n    },\n    {\n        \"type\": 4,\n        \"uuid\": \"00000000-0000-0000-8100-000000000000\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 338,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 338,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 338,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a73937c6-d639-8b17-8865-4767f9267288\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 339,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 340,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9e3e0e74-e445-17ef6-8ede-1db430de158f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 139,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f7318ce9-75b1-17f25-8b98-eaa8a73fd587\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 48,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 48,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 48,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 48,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 48,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 48,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 139,\n                \"damage\": 1,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"cb37b209-058b-46f6-8fdc-20b857ded9ad\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 113,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f73100a8-ee7c-57a4-8853-879ac522eb9c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 85,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fe34dfc5-1af9-0c19-8a61-4071330eac8b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 85,\n                \"damage\": 1,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8538c54e-a7d3-218da-8fcf-88512570ac94\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 85,\n                \"damage\": 2,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4837f4ee-921b-439e-8917-43e019564e8c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 85,\n                \"damage\": 3,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fe3a245c-c0fb-4efc-86fe-83d5fd43e38c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 85,\n                \"damage\": 4,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f13795d8-c650-8da6-8020-aa0948006594\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 85,\n                \"damage\": 5,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5f3f91c9-0530-21d0f-8e76-26d65e89b68a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 107,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"573acfce-7ea9-96cc-82f7-375d519af983\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 183,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1e3ee9ff-ebd3-7018-8f2a-01232076538b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 184,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fd3e999a-d1cc-18eac-816c-39118ee14a99\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 185,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"14312113-7afa-5753-89f1-8e26ce4e08b3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 187,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5739a6e6-660f-1b39-8aae-d48ee7f4d789\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 186,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ee31adcb-a433-9eff-81d6-5e11715b00ba\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 42,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 42,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 42,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 145,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fc3957db-dfe3-40c5-8c6e-9847dadf3ba6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 340,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 340,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 340,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 47,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"21367b1b-a507-17013-8492-076ea07e64b7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 332,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 332,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 332,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 332,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 80,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6f36dd0d-826e-19843-8824-07ebd6db26a2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 80,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 80,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 80,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 78,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"903894a4-88f7-8f7b-8eaf-22a896dfd69b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 337,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 337,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 337,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 337,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 82,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3530d19b-0578-1806-8533-6eddce09ff86\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 336,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 336,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 336,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 336,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0432fffc-97b0-20161-891a-19f98e542589\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 348,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 348,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 348,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 348,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 89,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"333ed104-748b-71e3-8ff6-e01fbc0cb399\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"dc3c67c9-7af1-1649-8c7c-1150a2f4a38f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 289,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 289,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 289,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 289,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 12,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 289,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 46,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3e370268-f1f4-9e31-8a4e-1238fdf69091\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 44,\n                \"damage\": 3,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3d397566-a74a-2980-8bcd-640bc7e2eba1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 44,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3a36aacc-590f-63b5-8bbd-50042d40c09a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 44,\n                \"damage\": 1,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a03215be-b91f-16313-8a13-4ea653974186\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 182,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4239da78-626b-8210-8935-ddbcaa7ac79d\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 158,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"723ee0e8-99a0-43b6-8dff-7e4760eb7c8e\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 158,\n                \"damage\": 1,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b93bf9df-6642-77e9-8f1d-8568004363be\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 158,\n                \"damage\": 2,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"cc3b51c0-1681-1780e-8267-d45f5d4400b6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 158,\n                \"damage\": 3,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7c332a47-216b-63e2-885f-1504dc96a89a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 158,\n                \"damage\": 4,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d23fa0a9-8252-2026e-8da4-1940a94c6e90\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 158,\n                \"damage\": 5,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ba34407c-3d6e-0755-89e7-ac1fcb55739e\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 44,\n                \"damage\": 4,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b0352df1-aefb-161a0-873d-f808dcda0db6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 44,\n                \"damage\": 5,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a83947c1-27ec-1961b-86c3-d3aadab9a1a2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 44,\n                \"damage\": 7,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ea34479b-aa9b-17b0e-84a8-f02045094086\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 44,\n                \"damage\": 6,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"24327e91-5d25-16d16-8da5-fcbc578fde98\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 182,\n                \"damage\": 1,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e63182ff-034b-0f94-8939-cfad3298bb80\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 433,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 433,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 433,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 433,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 201,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"37365587-25f9-5d5e-802a-af3932d5d7a3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 369,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 433,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 208,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"923207a8-78de-1aa8-86ad-8886fb1e4199\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 121,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 121,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 121,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 121,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 206,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"eb365021-ccbe-1976f-8608-78276634d192\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 65,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"39385cb2-e98a-8900-8015-ffe3d537d7ba\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 324,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b438e747-a24e-1689c-821c-33eb94df1fb1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 427,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b9316aad-b58a-05b8-8a47-f9d20e9b8489\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 428,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"353e6f30-b426-163d7-8d84-a2a680de8f94\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 429,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"513e1853-b061-3526-8dad-ae983214d6bc\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 430,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2e325d9d-712d-6574-8d11-410137c41caf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 431,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5f3df813-a793-3d86-8014-b876ca8a72be\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 96,\n                \"damage\": 0,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e03c26b1-0888-00e4-8a77-c9b507d231a3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 167,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4e37b91d-3252-9577-85e8-6621adb7ce91\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 131,\n                \"damage\": 0,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1f324615-d07a-4187-89a5-c7097710ba99\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 25,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"733f23d6-b07b-6fb7-8d5a-bdf4c386ff8a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 330,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1d387080-389c-0b6e-8580-29197e5facba\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 323,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"be31a6b2-2cae-19e12-84d2-e7646c6a33bb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 325,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 325,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 325,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 353,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 344,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 353,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 354,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 325,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1334f513-691d-1686a-8417-a38090c52681\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 338,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 353,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0034c266-8669-0964-80f8-0f458cb46b99\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 391,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 396,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c33e6e91-275f-21cbd-8d38-4d2552758bb6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 360,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 371,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 382,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ca36f024-49df-3369-822a-44facd7001ad\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 369,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 377,\n                \"damage\": 0,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6930db0b-5556-17875-85a8-4ffacf7decaf\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 377,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 378,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f43aa0de-003b-4c02-87f6-c5cc738ee7a1\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 39,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 353,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 375,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 376,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"74387959-abc9-5d63-8a12-cc7cbd936cb5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 17,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ce314836-7093-7307-889b-067c24cb1382\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 17,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fb3a6224-13d5-7be6-83bc-5a9fedafb8a0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 17,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3130db34-4c6f-2fe8-8189-366549a0f8bb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 17,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"833fd08d-6502-5813-8d5c-aed2f43b0da1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 162,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"dc3bde6b-04de-5faa-8f35-070bdf3557ac\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 162,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f43e848c-d93b-21f30-8de2-4a503e264483\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7e3dd7b0-33de-20d4e-89fd-76121efb24be\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 50,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"073683ae-0d15-7f43-8a9f-99e7f6b111b4\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 263,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 50,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9231fdb2-fcf7-1082-8b72-990b7aff34ab\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 281,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9439f642-21e0-2023f-8859-ffb3a7ce288c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 412,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 391,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 393,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 39,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 281,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 413,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"503c6ea6-ff91-18b85-89b8-3fa4b787a3a1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 412,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 391,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 393,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 40,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 281,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 413,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9d34f2a0-72fa-4f88-830f-1a8220e87f8b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 374,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c1335586-9f71-4c4c-88f9-513cb52114ac\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 336,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 336,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 336,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 390,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d1397f10-1e7b-19ce3-8ef3-70023ad8f4bd\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 66,\n                \"damage\": 0,\n                \"count\": 16,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6c3779d0-04cd-21622-8496-1fef9ad13489\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 27,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ba30d9e5-d2f3-17e6d-84f7-b2577d766198\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 70,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 28,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"283a3a66-3344-10cc-8c15-4ef92f3d75a5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 76,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 126,\n                \"damage\": 0,\n                \"count\": 6,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5030aa72-64b9-083a-84ed-5f27f06297b1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 328,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7a3a1ce6-68ad-5df5-8cfe-ccc5aa9c54a0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 54,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 328,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 342,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fb34431b-614c-196a4-8d90-66c12bd1acaa\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 410,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 328,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 408,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"eb33e423-43f7-4e99-80a0-721b18602aa5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 380,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"db335d37-df3b-0b0c-8712-ce4a8be7fd8b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 369,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 379,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8534fd47-bd02-173d2-843a-887392ce158f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 86,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 50,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 91,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c3399917-f526-207b3-8cf5-c77be90c2ab8\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 269,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 333,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"dc31fb75-767e-175ee-8518-974efd25e59e\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 269,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 333,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7e38d12d-0a03-393b-899b-b249aeb8a09c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 269,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 333,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"bf352750-670c-75b8-84b3-04ec29e37fb7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 269,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 333,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"af385bca-3f16-151f-8850-bce4658d3e9a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 269,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 333,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"953ff74e-09b8-911d-82c8-9c1570ed819c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 269,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 333,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5a3ff230-8372-2bd4-8c9b-7d617a70d4bb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 325,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5d398efe-c68a-16be8-89a3-44c337bea186\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 318,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 259,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"6f3aee6e-112b-9e6d-8268-55c82b2daa94\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 296,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 297,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"613669ec-0828-210fa-8bbe-7e995a82aca0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 53,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0c307223-4d55-17f2c-83fe-722c8cb71e8b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 134,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"cc3f7c08-24f4-3e3b-83bb-c186ca47fd88\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 135,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ad363157-9aaf-41a0-896c-4c6aa7bf9a97\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 136,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0732b7ba-85b4-1865b-82a1-fc3c7bd744bd\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 163,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2b3e7936-8672-865c-846c-d3af2ec5dab5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 164,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4938497d-2a90-7ae1-897a-61e236ce9f8a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 67,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"de302db7-f3c9-19d24-8298-865194189397\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 45,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 108,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"cc3cca6d-850d-211c8-82dd-c855e54299b1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 24,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 128,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"983b81db-bbd8-7caf-8837-e30ad0027ea2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 179,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 180,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8b349b4e-f3b2-01fa-8cfb-092babc8789d\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 98,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 109,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4630b726-66b8-21169-868f-6598eb4f6092\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 155,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 156,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e83a8d32-aed8-20f9a-8539-bb4dd68ec78b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 112,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 114,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"423c75ee-1e14-7af8-87e0-ab7d94280cba\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 201,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 203,\n                \"damage\": 0,\n                \"count\": 4,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4938adc1-5109-1a88-8c14-122dfb599c84\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 346,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b5353bfc-e1d4-21bb5-84f8-270d485603aa\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 346,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 391,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 398,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"273c1e8c-5a84-16994-89d0-4142c3a9dab7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 321,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"af3b7d22-5df1-0a88-8622-970c7c2b2f8b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 260,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 322,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ad334055-5d89-39f1-8eea-182936d22ebf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 260,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 41,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 466,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"9d34b800-272e-7f26-8b9e-58597210a9b2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 69,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f13b6d6c-37d1-2a2a-8f0a-d417f9e23db7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 76,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"75382bbb-2459-4ad3-8561-7cca72b9f5bd\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 158,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 158,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 158,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 151,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5a320f44-ac26-189da-86cd-83cd3ce5ecaf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 76,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 76,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 356,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"613eae0c-ea31-3e57-8343-553030e5c1b7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 89,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 123,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"fd30edfe-9e39-1785a-82e8-c73790c4c4bd\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 347,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"383ea897-37ac-21128-8fbb-7bcf62058b85\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 345,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7d3d0f8c-aa43-4a78-8c16-eab8173faeae\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 77,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"983997f9-99a8-8948-840c-bf158c822188\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 143,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"aa3a2d4a-ff81-47d7-80ab-20fc11e8a991\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 1,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 70,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f23153b6-733e-232b-8344-a28d9c984d8f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 72,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a3308692-b3cb-194b9-857a-18b49bcc25b2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 266,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 147,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4c3b277a-26bd-769d-877f-94ee90717183\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 148,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a438aa57-3d49-18cf8-826d-2520aa150dbc\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 261,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 23,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"31368d36-67a8-16bb1-80ee-1aa6b2c933aa\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 125,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b0314c6d-ad5b-7574-883c-849bb404e481\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 54,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 410,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"693c1533-0123-4502-8dec-e8a62071e7b7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 251,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"af3295fc-0c43-7a94-84df-ad94a62b16bf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 265,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 331,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 4,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 33,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7e3430c7-cc99-6e6d-8363-263398dbd8a5\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 33,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 29,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"db39e7fa-21b7-19328-842a-86db32ba67bf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 5,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 355,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"613a94d9-f4cc-4e31-84c2-05063b06df94\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 340,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 264,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 49,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 116,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ed337196-958b-16dab-8afe-1b56cfd4c080\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 415,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 415,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 415,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 415,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"07344cf3-8ba2-65eb-8008-0d871deb52bf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 76,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 76,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 406,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 76,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 1,\n                \"damage\": -1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 404,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"833f97f3-6922-1975e-821c-1838a2eb689d\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 46,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 328,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 407,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"12312b8a-5015-9353-8212-cc5d89a3a493\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 280,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 389,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"2e368f41-fb07-3046-8d9f-6e13e2b829af\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 377,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 368,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 381,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d735089c-8d7b-8f54-846c-6d249119a381\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 381,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 370,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 20,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 426,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e4389d5c-6dd5-5a43-8eba-9cb1a0d5be91\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"b53a66c9-5e21-5e7d-81d9-e8abc3fa4b9f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 15,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"81360234-da7c-5f38-8ee8-e222577ab4b8\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 1,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"913b0f45-165a-207d6-8fb4-35f0002868b6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 14,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5f3d2f35-82c8-17bbd-8bfb-aefcf063ddb4\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 2,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"8f359326-4cd2-63f8-8c57-ed8698b3ccb6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 13,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d83ccac5-3946-19781-8d7f-b6366554c897\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 3,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"eb3c241e-3a85-20ac1-863f-c4249b94a98a\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 3,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 12,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c3359dde-bd13-2171b-815f-b563c4e84fb2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 4,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5d33bd55-d06b-7b04-8ee0-0b960605c1b7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 4,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 11,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"1835a8d6-c3a1-17e14-81a3-fce3419b61be\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 5,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"cc381a6e-4291-3fc6-8392-a9ef57d46089\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 5,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 10,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a63664d3-1466-5a6f-85ec-0149bd2da0a1\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 6,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f838fe01-97ba-200cc-8fa3-453335b5e7b8\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 6,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 9,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f530fc51-83ac-21a23-806e-6eb02cdf95a6\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 7,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"983fa475-c110-799f-8f68-d8c0c14eb7bb\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 7,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 8,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"83353241-3a70-201a9-87ec-570216878790\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 8,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"433185e9-5351-16e23-8e81-a9c694a5eda8\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 8,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 7,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"d93fdc79-5c81-286b-856e-c39b02ef2199\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 9,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"003626c1-1ad9-435c-82bf-8df8098bc38c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 9,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 6,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"283af721-d78d-2691-8225-d0aeb2bd5dae\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 10,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 10,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 10,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"40372dc5-9895-17f22-8eb8-0be5ccf0bb8c\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 10,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 5,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"18355c6d-1bb6-9756-818a-4d02371cc299\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 11,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"e53cac6f-672d-17f03-886e-3c625e4e5489\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 11,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 4,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"ca3a4889-bc8e-177a3-8000-000a38ff44b0\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 12,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 12,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 12,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"66387aa8-6476-633a-83ae-e6e6974a799b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 12,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 3,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"753ff5c8-5d37-33d6-89b0-87ddc88a789b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 13,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 13,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 13,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"bd318f73-e0a7-18c76-8264-d45e32f9698b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 13,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 2,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"f737a038-cf49-21b18-8089-b0730c0112b7\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 14,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 14,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 14,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"a7351642-e800-5632-83e4-ff3bd4ef3a96\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 14,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 1,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"3f33d74a-4f57-90aa-8b7d-98299339c68b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 35,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 35,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 171,\n                \"damage\": 15,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"0e392c18-2b9c-19f2d-8567-be48d8af75a4\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 15,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 172,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 159,\n                \"damage\": 0,\n                \"count\": 8,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"313b5847-6292-178df-86db-4123b455f8bf\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 165,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"633039e0-8a53-16387-86b3-3cefc5fa39a3\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 1,\n        \"height\": 1,\n        \"input\": [\n            {\n                \"id\": 165,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 9,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"913c4d6f-9059-7033-833c-c2bcf6901680\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 377,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 289,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 385,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"353a8303-921a-76a8-87b7-cd1af1fa16ba\"\n    },\n    {\n        \"type\": 0,\n        \"input\": [\n            {\n                \"id\": 377,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 263,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 289,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 385,\n                \"damage\": 0,\n                \"count\": 3,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"863230be-1ac7-20e33-8cd6-5cd815f7f18b\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 341,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 287,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 420,\n                \"damage\": 0,\n                \"count\": 2,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"7e3709aa-98ef-1850f-8096-bb382802309e\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 0,\n                \"damage\": 0,\n                \"count\": 0,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 334,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 416,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"c03b3f11-8c0b-9744-8042-a2418458e18f\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 2,\n        \"height\": 2,\n        \"input\": [\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 168,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"633e16d9-2670-194dc-830a-598735206195\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 168,\n                \"damage\": 2,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"4e3a49bd-d3f5-64f7-8980-03daf64d7ba2\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 351,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 168,\n                \"damage\": 1,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"5134bfb8-a77b-0ac6-85a4-40be668fa794\"\n    },\n    {\n        \"type\": 1,\n        \"width\": 3,\n        \"height\": 3,\n        \"input\": [\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 422,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 422,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 422,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 422,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 422,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            },\n            {\n                \"id\": 409,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"output\": [\n            {\n                \"id\": 169,\n                \"damage\": 0,\n                \"count\": 1,\n                \"nbt\": \"\"\n            }\n        ],\n        \"uuid\": \"283cde40-627d-67e1-82c9-1a53f242788f\"\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 4,\n        \"output\": {\n            \"id\": 1,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 12,\n        \"output\": {\n            \"id\": 20,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 14,\n        \"output\": {\n            \"id\": 266,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 15,\n        \"output\": {\n            \"id\": 265,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 16,\n        \"output\": {\n            \"id\": 263,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 17,\n        \"output\": {\n            \"id\": 263,\n            \"damage\": 1,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 21,\n        \"output\": {\n            \"id\": 351,\n            \"damage\": 4,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 56,\n        \"output\": {\n            \"id\": 264,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 73,\n        \"output\": {\n            \"id\": 331,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 81,\n        \"output\": {\n            \"id\": 351,\n            \"damage\": 2,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 82,\n        \"output\": {\n            \"id\": 172,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 87,\n        \"output\": {\n            \"id\": 405,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 129,\n        \"output\": {\n            \"id\": 388,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 153,\n        \"output\": {\n            \"id\": 406,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 162,\n        \"output\": {\n            \"id\": 263,\n            \"damage\": 1,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 319,\n        \"output\": {\n            \"id\": 320,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 337,\n        \"output\": {\n            \"id\": 336,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 349,\n        \"output\": {\n            \"id\": 350,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 363,\n        \"output\": {\n            \"id\": 364,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 365,\n        \"output\": {\n            \"id\": 366,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 392,\n        \"output\": {\n            \"id\": 393,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 411,\n        \"output\": {\n            \"id\": 412,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 423,\n        \"output\": {\n            \"id\": 424,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 432,\n        \"output\": {\n            \"id\": 433,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 2,\n        \"inputId\": 460,\n        \"output\": {\n            \"id\": 463,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 3,\n        \"inputId\": 19,\n        \"inputDamage\": 1,\n        \"output\": {\n            \"id\": 19,\n            \"damage\": 0,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    },\n    {\n        \"type\": 3,\n        \"inputId\": 98,\n        \"inputDamage\": 0,\n        \"output\": {\n            \"id\": 98,\n            \"damage\": 2,\n            \"count\": 1,\n            \"nbt\": \"\"\n        }\n    }\n]"
  },
  {
    "path": "src/pocketmine/scheduler/AsyncPool.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\event\\Timings;\nuse pocketmine\\Server;\n\nclass AsyncPool{\n\n\t/** @var Server */\n\tprivate $server;\n\n\tprotected $size;\n\n\t/** @var AsyncTask[] */\n\tprivate $tasks = [];\n\t/** @var int[] */\n\tprivate $taskWorkers = [];\n\n\t/** @var AsyncWorker[] */\n\tprivate $workers = [];\n\t/** @var int[] */\n\tprivate $workerUsage = [];\n\n\tpublic function __construct(Server $server, $size){\n\t\t$this->server = $server;\n\t\t$this->size = (int) $size;\n\n\t\tfor($i = 0; $i < $this->size; ++$i){\n\t\t\t$this->workerUsage[$i] = 0;\n\t\t\t$this->workers[$i] = new AsyncWorker($this->server->getLogger(), $i + 1);\n\t\t\t$this->workers[$i]->setClassLoader($this->server->getLoader());\n\t\t\t$this->workers[$i]->start();\n\t\t}\n\t}\n\n\tpublic function getSize(){\n\t\treturn $this->size;\n\t}\n\n\tpublic function increaseSize($newSize){\n\t\t$newSize = (int) $newSize;\n\t\tif($newSize > $this->size){\n\t\t\tfor($i = $this->size; $i < $newSize; ++$i){\n\t\t\t\t$this->workerUsage[$i] = 0;\n\t\t\t\t$this->workers[$i] = new AsyncWorker($this->server->getLogger(), $i + 1);\n\t\t\t\t$this->workers[$i]->setClassLoader($this->server->getLoader());\n\t\t\t\t$this->workers[$i]->start();\n\t\t\t}\n\t\t\t$this->size = $newSize;\n\t\t}\n\t}\n\n\tpublic function submitTaskToWorker(AsyncTask $task, $worker){\n\t\tif(isset($this->tasks[$task->getTaskId()]) or $task->isGarbage()){\n\t\t\treturn;\n\t\t}\n\n\t\t$worker = (int) $worker;\n\t\tif($worker < 0 or $worker >= $this->size){\n\t\t\tthrow new \\InvalidArgumentException(\"Invalid worker $worker\");\n\t\t}\n\n\t\t$this->tasks[$task->getTaskId()] = $task;\n\n\t\t$this->workers[$worker]->stack($task);\n\t\t$this->workerUsage[$worker]++;\n\t\t$this->taskWorkers[$task->getTaskId()] = $worker;\n\t}\n\n\tpublic function submitTask(AsyncTask $task){\n\t\tif(isset($this->tasks[$task->getTaskId()]) or $task->isGarbage()){\n\t\t\treturn;\n\t\t}\n\n\t\t$selectedWorker = mt_rand(0, $this->size - 1);\n\t\t$selectedTasks = $this->workerUsage[$selectedWorker];\n\t\tfor($i = 0; $i < $this->size; ++$i){\n\t\t\tif($this->workerUsage[$i] < $selectedTasks){\n\t\t\t\t$selectedWorker = $i;\n\t\t\t\t$selectedTasks = $this->workerUsage[$i];\n\t\t\t}\n\t\t}\n\n\t\t$this->submitTaskToWorker($task, $selectedWorker);\n\t}\n\n\tprivate function removeTask(AsyncTask $task, $force = false){\n\t\t$task->setGarbage();\n\n\t\tif(isset($this->taskWorkers[$task->getTaskId()])){\n\t\t\tif(!$force and ($task->isRunning() or !$task->isGarbage())){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$this->workerUsage[$this->taskWorkers[$task->getTaskId()]]--;\n\t\t\t$this->workers[$this->taskWorkers[$task->getTaskId()]]->collector($task);\n\t\t}\n\n\t\tunset($this->tasks[$task->getTaskId()]);\n\t\tunset($this->taskWorkers[$task->getTaskId()]);\n\n\t\t$task->cleanObject();\n\t}\n\n\tpublic function removeTasks(){\n\t\tdo{\n\t\t\tforeach($this->tasks as $task){\n\t\t\t\t$task->cancelRun();\n\t\t\t\t$this->removeTask($task);\n\t\t\t}\n\n\t\t\tif(count($this->tasks) > 0){\n\t\t\t\tServer::microSleep(25000);\n\t\t\t}\n\t\t}while(count($this->tasks) > 0);\n\n\t\tfor($i = 0; $i < $this->size; ++$i){\n\t\t\t$this->workerUsage[$i] = 0;\n\t\t}\n\n\t\t$this->taskWorkers = [];\n\t\t$this->tasks = [];\n\t}\n\n\tpublic function collectTasks(){\n\t\tTimings::$schedulerAsyncTimer->startTiming();\n\n\t\tforeach($this->tasks as $task){\n\t\t\tif($task->isFinished() and !$task->isRunning() and !$task->isCrashed()){\n\n\t\t\t\tif(!$task->hasCancelledRun()){\n\t\t\t\t\t$task->onCompletion($this->server);\n\t\t\t\t}\n\n\t\t\t\t$this->removeTask($task);\n\t\t\t}elseif($task->isTerminated() or $task->isCrashed()){\n\t\t\t\t$this->server->getLogger()->critical(\"Could not execute asynchronous task \" . (new \\ReflectionClass($task))->getShortName() . \": Task crashed\");\n\t\t\t\t$this->removeTask($task, true);\n\t\t\t}\n\t\t}\n\n\t\tTimings::$schedulerAsyncTimer->stopTiming();\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/AsyncTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\Server;\n\n/**\n * Class used to run async tasks in other threads.\n *\n * An AsyncTask does not have its own thread. It is queued into an AsyncPool and executed if there is an async worker\n * with no AsyncTask running. Therefore, an AsyncTask SHOULD NOT execute for more than a few seconds. For tasks that\n * run for a long time or infinitely, start another {@link \\pocketmine\\Thread} instead.\n *\n * WARNING: Do not call PocketMine-MP API methods, or save objects (and arrays containing objects) from/on other Threads!!\n */\nabstract class AsyncTask extends \\Threaded implements \\Collectable{\n\n\t/** @var AsyncWorker $worker */\n\tpublic $worker = null;\n\n\tprivate $result = null;\n\tprivate $serialized = false;\n\tprivate $cancelRun = false;\n\t/** @var int */\n\tprivate $taskId = null;\n\n\tprivate $crashed = false;\n\n\tprivate $isGarbage = false;\n\n\tprivate $isFinished = false;\n\n\tpublic function isGarbage() : bool{\n\t\treturn $this->isGarbage;\n\t}\n\n\tpublic function setGarbage(){\n\t\t$this->isGarbage = true;\n\t}\n\n\tpublic function isFinished() : bool{\n\t\treturn $this->isFinished;\n\t}\n\n\tpublic function run(){\n\t\t$this->result = null;\n\t\t$this->isGarbage = false;\n\n\t\tif($this->cancelRun !== true){\n\t\t\ttry{\n\t\t\t\t$this->onRun();\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$this->crashed = true;\n\t\t\t\t$this->worker->handleException($e);\n\t\t\t}\n\t\t}\n\n\t\t$this->isFinished = true;\n\t\t//$this->setGarbage();\n\t}\n\n\tpublic function isCrashed(){\n\t\treturn $this->crashed;\n\t}\n\n\t/**\n\t * @return mixed\n\t */\n\tpublic function getResult(){\n\t\treturn $this->serialized ? unserialize($this->result) : $this->result;\n\t}\n\n\tpublic function cancelRun(){\n\t\t$this->cancelRun = true;\n\t}\n\n\tpublic function hasCancelledRun(){\n\t\treturn $this->cancelRun === true;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function hasResult(){\n\t\treturn $this->result !== null;\n\t}\n\n\t/**\n\t * @param mixed $result\n\t * @param bool  $serialize\n\t */\n\tpublic function setResult($result, $serialize = true){\n\t\t$this->result = $serialize ? serialize($result) : $result;\n\t\t$this->serialized = $serialize;\n\t}\n\n\tpublic function setTaskId($taskId){\n\t\t$this->taskId = $taskId;\n\t}\n\n\tpublic function getTaskId(){\n\t\treturn $this->taskId;\n\t}\n\n\t/**\n\t * Gets something into the local thread store.\n\t * You have to initialize this in some way from the task on run\n\t *\n\t * @param string $identifier\n\t * @return mixed\n\t */\n\tpublic function getFromThreadStore($identifier){\n\t\tglobal $store;\n\t\treturn $this->isGarbage() ? null : $store[$identifier];\n\t}\n\n\t/**\n\t * Saves something into the local thread store.\n\t * This might get deleted at any moment.\n\t *\n\t * @param string $identifier\n\t * @param mixed  $value\n\t */\n\tpublic function saveToThreadStore($identifier, $value){\n\t\tglobal $store;\n\t\tif(!$this->isGarbage()){\n\t\t\t$store[$identifier] = $value;\n\t\t}\n\t}\n\n\t/**\n\t * Actions to execute when run\n\t *\n\t * @return void\n\t */\n\tpublic abstract function onRun();\n\n\t/**\n\t * Actions to execute when completed (on main thread)\n\t * Implement this if you want to handle the data in your AsyncTask after it has been processed\n\t *\n\t * @param Server $server\n\t *\n\t * @return void\n\t */\n\tpublic function onCompletion(Server $server){\n\n\t}\n\n\t/**\n\t * Call this method from {@link AsyncTask#onRun} (AsyncTask execution thread) to schedule a call to\n\t * {@link AsyncTask#onProgressUpdate} from the main thread with the given progress parameter.\n\t *\n\t * @param mixed $progress A value that can be safely serialize()'ed.\n\t */\n\tpublic function publishProgress($progress){\n\t\t$this->progressUpdates[] = serialize($progress);\n\t}\n\n\t/**\n\t * @internal Only call from AsyncPool.php on the main thread\n\t *\n\t * @param Server $server\n\t */\n\tpublic function checkProgressUpdates(Server $server){\n\t\twhile($this->progressUpdates->count() !== 0){\n\t\t\t$progress = $this->progressUpdates->shift();\n\t\t\t$this->onProgressUpdate($server, unserialize($progress));\n\t\t}\n\t}\n\n\t/**\n\t * Called from the main thread after {@link AsyncTask#publishProgress} is called.\n\t * All {@link AsyncTask#publishProgress} calls should result in {@link AsyncTask#onProgressUpdate} calls before\n\t * {@link AsyncTask#onCompletion} is called.\n\t *\n\t * @param Server $server\n\t * @param mixed  $progress The parameter passed to {@link AsyncTask#publishProgress}. It is serialize()'ed\n\t *                         and then unserialize()'ed, as if it has been cloned.\n\t */\n\tpublic function onProgressUpdate(Server $server, $progress){\n\n\t}\n\n\t/**\n\t * Call this method from {@link AsyncTask#onCompletion} to fetch the data stored in the constructor, if any, and\n\t * clears it from the storage.\n\t *\n\t * Do not call this method from {@link AsyncTask#onProgressUpdate}, because this method deletes the data and cannot\n\t * be used in the next {@link AsyncTask#onProgressUpdate} call or from {@link AsyncTask#onCompletion}. Use\n\t * {@link AsyncTask#peekLocal} instead.\n\t *\n\t * @param Server $server default null\n\t *\n\t * @return mixed\n\t *\n\t * @throws \\RuntimeException if no data were stored by this AsyncTask instance.\n\t */\n\tprotected function fetchLocal(Server $server = null){\n\t\tif($server === null){\n\t\t\t$server = Server::getInstance();\n\t\t\tassert($server !== null, \"Call this method only from the main thread!\");\n\t\t}\n\n\t\treturn $server->getScheduler()->fetchLocalComplex($this);\n\t}\n\n\t/**\n\t * Call this method from {@link AsyncTask#onProgressUpdate} to fetch the data stored in the constructor.\n\t *\n\t * Use {@link AsyncTask#peekLocal} instead from {@link AsyncTask#onCompletion}, because this method does not delete\n\t * the data, and not clearing the data will result in a warning for memory leak after {@link AsyncTask#onCompletion}\n\t * finished executing.\n\t *\n\t * @param Server|null $server default null\n\t *\n\t * @return mixed\n\t *\n\t * @throws \\RuntimeException if no data were stored by this AsyncTask instance\n\t */\n\tprotected function peekLocal(Server $server = null){\n\t\tif($server === null){\n\t\t\t$server = Server::getInstance();\n\t\t\tassert($server !== null, \"Call this method only from the main thread!\");\n\t\t}\n\n\t\treturn $server->getScheduler()->peekLocalComplex($this);\n\t}\n\n\tpublic function cleanObject(){\n\t\tforeach($this as $p => $v){\n\t\t\tif(!($v instanceof \\Threaded) and !in_array($p, [\"isFinished\", \"isGarbage\", \"cancelRun\"])){\n\t\t\t\t$this->{$p} = null;\n\t\t\t}\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/AsyncWorker.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\Worker;\n\nclass AsyncWorker extends Worker{\n\n\tprivate $logger;\n\tprivate $id;\n\n\tpublic function __construct(\\ThreadedLogger $logger, $id){\n\t\t$this->logger = $logger;\n\t\t$this->id = $id;\n\t}\n\n\tpublic function run(){\n\t\t$this->registerClassLoader();\n\t\tgc_enable();\n\t\tini_set(\"memory_limit\", -1);\n\n\t\tglobal $store;\n\t\t$store = [];\n\t}\n\n\tpublic function handleException(\\Throwable $e){\n\t\t$this->logger->logException($e);\n\t}\n\n\tpublic function getThreadName(){\n\t\treturn \"Asynchronous Worker #\" . $this->id;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/CallbackTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\n/**\n * Allows the creation of simple callbacks with extra data\n * The last parameter in the callback will be this object\n *\n * If you want to do a task in a Plugin, consider extending PluginTask to your needs\n *\n * @deprecated \n * Do NOT use this anymore, it was deprecated a long time ago at PocketMine\n * and will be removed at some stage in the future.\n */\n\nclass CallbackTask extends Task{\n\n\t/** @var callable */\n\tprotected $callable;\n\n\t/** @var array */\n\tprotected $args;\n\n\t/**\n\t * @param callable $callable\n\t * @param array    $args\n\t */\n\tpublic function __construct(callable $callable, array $args = []){\n\t\t$this->callable = $callable;\n\t\t$this->args = $args;\n\t\t$this->args[] = $this;\n\t}\n\n\t/**\n\t * @return callable\n\t */\n\tpublic function getCallable(){\n\t\treturn $this->callable;\n\t}\n\n\tpublic function onRun($currentTicks){\n\t\tcall_user_func_array($this->callable, $this->args);\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/DServerTask.php",
    "content": "<?php\n/*\n * DServerTask 2.0\n * @author MUedsa, PeratX\n*/\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\Server;\n\nclass DServerTask extends AsyncTask{\n\n\tpublic $data;\n\tpublic $autotimes;\n\tpublic $re;\n\n\tpublic function __construct($data, $autotimes = 5){\n\t\t$this->data = $data;\n\t\t$this->autotimes = $autotimes;\n\t}\n\n\tpublic function onRun(){\n\t\t$re = [0, 0];\n\t\tforeach($this->data as $d){\n\t\t\t$data = $this->getInfo($d);\n\t\t\t$re[0] = $re[0] + $data[0];\n\t\t\t$re[1] = $re[1] + $data[1];\n\t\t}\n\t\t$this->re = (array) $re;\n\t}\n\n\n\tpublic function getInfo($ds, $time = 1){\n\t\t$tmp = explode(\":\", $ds);\n\t\t$ip = $tmp[0];\n\t\t$port = $tmp[1];\n\t\t$client = stream_socket_client(\"udp://\" . $ip . \":\" . $port, $errno, $errstr);    //非阻塞Socket\n\t\tif($client){\n\t\t\tstream_set_timeout($client, 1);\n\t\t\t$Handshake_to = \"\\xFE\\xFD\" . chr(9) . pack(\"N\", 233);\n\t\t\tfwrite($client, $Handshake_to);\n\t\t\t$Handshake_re_1 = fread($client, 65535);\n\t\t\tif($Handshake_re_1 != \"\"){\n\t\t\t\t$Handshake_re = $this->decode($Handshake_re_1);\n\t\t\t\t$Status_to = \"\\xFE\\xFD\" . chr(0) . pack(\"N\", 233) . pack(\"N\", $Handshake_re[\"payload\"]);\n\t\t\t\tfwrite($client, $Status_to);\n\t\t\t\t$Status_re_1 = fread($client, 65535);\n\t\t\t\tif($Status_re_1 != \"\"){\n\t\t\t\t\t$Status_re = $this->decode($Status_re_1);\n\t\t\t\t\t$ServerData = explode(\"\\x00\", $Status_re[\"payload\"]);\n\t\t\t\t\treturn [$ServerData[3], $ServerData[4]];\n\t\t\t\t}\n\t\t\t}\n\t\t\tfclose($client);\n\t\t}\n\t\tif($time < $this->autotimes){\n\t\t\treturn $this->getInfo($ds, $time + 1);\n\t\t}elseif($time = $this->autotimes) return [0, 0];\n\t\treturn [0, 0];\n\t}\n\n\tpublic function onCompletion(Server $server){\n\t\t$re = $this->re;\n\t\tif($re[0] > 0) $server->dserverPlayers = $re[0];\n\t\tif($re[1] > 0) $server->dserverAllPlayers = $re[1];\n\t\t//$server->getNetwork()->updateName();\n\t}\n\n\tpublic function decode($buffer){\n\t\t$redata = [];\n\t\t$redata[\"packetType\"] = ord($buffer{0});\n\t\t$redata[\"sessionID\"] = unpack(\"N\", substr($buffer, 1, 4))[1];\n\t\t$redata[\"payload\"] = rtrim(substr($buffer, 5));\n\t\treturn $redata;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/scheduler/FileWriteTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nclass FileWriteTask extends AsyncTask{\n\n\tprivate $path;\n\tprivate $contents;\n\tprivate $flags;\n\n\tpublic function __construct($path, $contents, $flags = 0){\n\t\t$this->path = $path;\n\t\t$this->contents = $contents;\n\t\t$this->flags = (int) $flags;\n\t}\n\n\tpublic function onRun(){\n\t\ttry{\n\t\t\tfile_put_contents($this->path, $this->contents, (int) $this->flags);\n\t\t}catch (\\Throwable $e){\n\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/GarbageCollectionTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nclass GarbageCollectionTask extends AsyncTask{\n\n\tpublic function onRun(){\n\t\tgc_enable();\n\t\tgc_collect_cycles();\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/PluginTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\plugin\\Plugin;\n\n/**\n * Base class for plugin tasks. Allows the Server to delete them easily when needed\n */\nabstract class PluginTask extends Task{\n\n\t/** @var Plugin */\n\tprotected $owner;\n\n\t/**\n\t * @param Plugin $owner\n\t */\n\tpublic function __construct(Plugin $owner){\n\t\t$this->owner = $owner;\n\t}\n\n\t/**\n\t * @return Plugin\n\t */\n\tpublic final function getOwner(){\n\t\treturn $this->owner;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/SendUsageTask.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\network\\protocol\\Info;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\Utils;\nuse pocketmine\\utils\\UUID;\nuse pocketmine\\utils\\VersionString;\n\nclass SendUsageTask extends AsyncTask{\n\n\tconst TYPE_OPEN = 1;\n\tconst TYPE_STATUS = 2;\n\tconst TYPE_CLOSE = 3;\n\n\tpublic $endpoint;\n\tpublic $data;\n\n\tpublic function __construct(Server $server, $type, $playerList = []){\n\t\t$endpoint = \"http://\" . $server->getProperty(\"anonymous-statistics.host\", \"stats.pocketmine.net\") . \"/\";\n\n\t\t$data = [];\n\t\t$data[\"uniqueServerId\"] = $server->getServerUniqueId();\n\t\t$data[\"uniqueMachineId\"] = Utils::getMachineUniqueId();\n\t\t$data[\"uniqueRequestId\"] = UUID::fromData($server->getServerUniqueId(), microtime(true));\n\n\t\tswitch($type){\n\t\t\tcase self::TYPE_OPEN:\n\t\t\t\t$data[\"event\"] = \"open\";\n\n\t\t\t\t$version = new VersionString();\n\n\t\t\t\t$data[\"server\"] = [\n\t\t\t\t\t\"port\" => $server->getPort(),\n\t\t\t\t\t\"software\" => $server->getName(),\n\t\t\t\t\t\"fullVersion\" => $version->get(true),\n\t\t\t\t\t\"version\" => $version->get(),\n\t\t\t\t\t\"build\" => $version->getBuild(),\n\t\t\t\t\t\"api\" => $server->getApiVersion(),\n\t\t\t\t\t\"minecraftVersion\" => $server->getVersion(),\n\t\t\t\t\t\"protocol\" => Info::CURRENT_PROTOCOL\n\t\t\t\t];\n\n\t\t\t\t$data[\"system\"] = [\n\t\t\t\t\t\"operatingSystem\" => Utils::getOS(),\n\t\t\t\t\t\"cores\" => Utils::getCoreCount(),\n\t\t\t\t\t\"phpVersion\" => PHP_VERSION,\n\t\t\t\t\t\"machine\" => php_uname(\"a\"),\n\t\t\t\t\t\"release\" => php_uname(\"r\"),\n\t\t\t\t\t\"platform\" => php_uname(\"i\")\n\t\t\t\t];\n\n\t\t\t\t$data[\"players\"] = [\n\t\t\t\t\t\"count\" => 0,\n\t\t\t\t\t\"limit\" => $server->getMaxPlayers()\n\t\t\t\t];\n\n\t\t\t\t$plugins = [];\n\n\t\t\t\tforeach($server->getPluginManager()->getPlugins() as $p){\n\t\t\t\t\t$d = $p->getDescription();\n\n\t\t\t\t\t$plugins[$d->getName()] = [\n\t\t\t\t\t\t\"name\" => $d->getName(),\n\t\t\t\t\t\t\"version\" => $d->getVersion(),\n\t\t\t\t\t\t\"enabled\" => $p->isEnabled()\n\t\t\t\t\t];\n\t\t\t\t}\n\n\t\t\t\t$data[\"plugins\"] = $plugins;\n\n\t\t\t\tbreak;\n\t\t\tcase self::TYPE_STATUS:\n\t\t\t\t$data[\"event\"] = \"status\";\n\n\t\t\t\t$data[\"server\"] = [\n\t\t\t\t\t\"ticksPerSecond\" => $server->getTicksPerSecondAverage(),\n\t\t\t\t\t\"tickUsage\" => $server->getTickUsageAverage(),\n\t\t\t\t\t\"ticks\" => $server->getTick()\n\t\t\t\t];\n\n\n\t\t\t\t//This anonymizes the user ids so they cannot be reversed to the original\n\t\t\t\tforeach($playerList as $k => $v){\n\t\t\t\t\t$playerList[$k] = md5($v);\n\t\t\t\t}\n\n\t\t\t\t$players = [];\n\t\t\t\tforeach($server->getOnlinePlayers() as $p){\n\t\t\t\t\tif($p->isOnline()){\n\t\t\t\t\t\t$players[] = md5($p->getUniqueId()->toBinary());\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$data[\"players\"] = [\n\t\t\t\t\t\"count\" => count($players),\n\t\t\t\t\t\"limit\" => $server->getMaxPlayers(),\n\t\t\t\t\t\"currentList\" => $players,\n\t\t\t\t\t\"historyList\" => array_values($playerList)\n\t\t\t\t];\n\n\t\t\t\t$info = Utils::getMemoryUsage(true);\n\t\t\t\t$data[\"system\"] = [\n\t\t\t\t\t\"mainMemory\" => $info[0],\n\t\t\t\t\t\"totalMemory\" => $info[1],\n\t\t\t\t\t\"availableMemory\" => $info[2],\n\t\t\t\t\t\"threadCount\" => Utils::getThreadCount()\n\t\t\t\t];\n\n\t\t\t\tbreak;\n\t\t\tcase self::TYPE_CLOSE:\n\t\t\t\t$data[\"event\"] = \"close\";\n\t\t\t\t$data[\"crashing\"] = $server->isRunning();\n\t\t\t\tbreak;\n\t\t}\n\n\t\t$this->endpoint = $endpoint . \"api/post\";\n\t\t$this->data = json_encode($data/*, JSON_PRETTY_PRINT*/);\n\t}\n\n\tpublic function onRun(){\n\t\ttry{\n\t\t\tUtils::postURL($this->endpoint, $this->data, 5, [\n\t\t\t\t\"Content-Type: application/json\",\n\t\t\t\t\"Content-Length: \". strlen($this->data)\n\t\t\t]);\n\t\t}catch(\\Throwable $e){\n\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/ServerScheduler.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Task scheduling related classes\n */\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\plugin\\Plugin;\nuse pocketmine\\Server;\nuse pocketmine\\utils\\MainLogger;\nuse pocketmine\\utils\\PluginException;\nuse pocketmine\\utils\\ReversePriorityQueue;\n\nclass ServerScheduler{\n\tpublic static $WORKERS = 2;\n\t/**\n\t * @var ReversePriorityQueue<Task>\n\t */\n\tprotected $queue;\n\n\t/**\n\t * @var TaskHandler[]\n\t */\n\tprotected $tasks = [];\n\n\t/** @var AsyncPool */\n\tprotected $asyncPool;\n\n\t/** @var int */\n\tprivate $ids = 1;\n\n\t/** @var int */\n\tprotected $currentTick = 0;\n\n\tpublic function __construct(){\n\t\t$this->queue = new ReversePriorityQueue();\n\t\t$this->asyncPool = new AsyncPool(Server::getInstance(), self::$WORKERS);\n\t}\n\n\t/**\n\t * @param Task $task\n\t *\n\t * @return null|TaskHandler\n\t */\n\tpublic function scheduleTask(Task $task){\n\t\treturn $this->addTask($task, -1, -1);\n\t}\n\n\t/**\n\t * Submits an asynchronous task to the Worker Pool\n\t *\n\t * @param AsyncTask $task\n\t *\n\t * @return void\n\t */\n\tpublic function scheduleAsyncTask(AsyncTask $task){\n\t\t$id = $this->nextId();\n\t\t$task->setTaskId($id);\n\t\t$this->asyncPool->submitTask($task);\n\t}\n\n\t/**\n\t * Submits an asynchronous task to a specific Worker in the Pool\n\t *\n\t * @param AsyncTask $task\n\t * @param int       $worker\n\t *\n\t * @return void\n\t */\n\tpublic function scheduleAsyncTaskToWorker(AsyncTask $task, $worker){\n\t\t$id = $this->nextId();\n\t\t$task->setTaskId($id);\n\t\t$this->asyncPool->submitTaskToWorker($task, $worker);\n\t}\n\n\tpublic function getAsyncTaskPoolSize(){\n\t\treturn $this->asyncPool->getSize();\n\t}\n\n\tpublic function increaseAsyncTaskPoolSize($newSize){\n\t\t$this->asyncPool->increaseSize($newSize);\n\t}\n\n\t/**\n\t * @param Task $task\n\t * @param int  $delay\n\t *\n\t * @return null|TaskHandler\n\t */\n\tpublic function scheduleDelayedTask(Task $task, $delay){\n\t\treturn $this->addTask($task, (int) $delay, -1);\n\t}\n\n\t/**\n\t * @param Task $task\n\t * @param int  $period\n\t *\n\t * @return null|TaskHandler\n\t */\n\tpublic function scheduleRepeatingTask(Task $task, $period){\n\t\treturn $this->addTask($task, -1, (int) $period);\n\t}\n\n\t/**\n\t * @param Task $task\n\t * @param int  $delay\n\t * @param int  $period\n\t *\n\t * @return null|TaskHandler\n\t */\n\tpublic function scheduleDelayedRepeatingTask(Task $task, $delay, $period){\n\t\treturn $this->addTask($task, (int) $delay, (int) $period);\n\t}\n\n\t/**\n\t * @param int $taskId\n\t */\n\tpublic function cancelTask($taskId){\n\t\tif($taskId !== null and isset($this->tasks[$taskId])){\n\t\t\t$this->tasks[$taskId]->cancel();\n\t\t\tunset($this->tasks[$taskId]);\n\t\t}\n\t}\n\n\t/**\n\t * @param Plugin $plugin\n\t */\n\tpublic function cancelTasks(Plugin $plugin){\n\t\tforeach($this->tasks as $taskId => $task){\n\t\t\t$ptask = $task->getTask();\n\t\t\tif($ptask instanceof PluginTask and $ptask->getOwner() === $plugin){\n\t\t\t\t$task->cancel();\n\t\t\t\tunset($this->tasks[$taskId]);\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function cancelAllTasks(){\n\t\tforeach($this->tasks as $task){\n\t\t\t$task->cancel();\n\t\t}\n\t\t$this->tasks = [];\n\t\t$this->asyncPool->removeTasks();\n\t\twhile(!$this->queue->isEmpty()){\n\t\t\t$this->queue->extract();\n\t\t}\n\t\t$this->ids = 1;\n\t}\n\n\t/**\n\t * @param int $taskId\n\t *\n\t * @return bool\n\t */\n\tpublic function isQueued($taskId){\n\t\treturn isset($this->tasks[$taskId]);\n\t}\n\n\t/**\n\t * @param Task $task\n\t * @param      $delay\n\t * @param      $period\n\t *\n\t * @return null|TaskHandler\n\t *\n\t * @throws PluginException\n\t */\n\tprivate function addTask(Task $task, $delay, $period){\n\t\tif($task instanceof PluginTask){\n\t\t\tif(!($task->getOwner() instanceof Plugin)){\n\t\t\t\tthrow new PluginException(\"Invalid owner of PluginTask \" . get_class($task));\n\t\t\t}elseif(!$task->getOwner()->isEnabled()){\n\t\t\t\tthrow new PluginException(\"Plugin '\" . $task->getOwner()->getName() . \"' attempted to register a task while disabled\");\n\t\t\t}\n\t\t}elseif($task instanceof CallbackTask and Server::getInstance()->getProperty(\"settings.deprecated-verbose\", true)){\n\t\t\t$callable = $task->getCallable();\n\t\t\tif(is_array($callable)){\n\t\t\t\tif(is_object($callable[0])){\n\t\t\t\t\t$taskName = \"Callback#\" . get_class($callable[0]) . \"::\" . $callable[1];\n\t\t\t\t}else{\n\t\t\t\t\t$taskName = \"Callback#\" . $callable[0] . \"::\" . $callable[1];\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$taskName = \"Callback#\" . $callable;\n\t\t\t}\n\t\t\t//Server::getInstance()->getLogger()->warning(\"A plugin attempted to register a deprecated CallbackTask ($taskName)\");\n\t\t}\n\n\t\tif($delay <= 0){\n\t\t\t$delay = -1;\n\t\t}\n\n\t\tif($period <= -1){\n\t\t\t$period = -1;\n\t\t}elseif($period < 1){\n\t\t\t$period = 1;\n\t\t}\n\n\t\treturn $this->handle(new TaskHandler(get_class($task), $task, $this->nextId(), $delay, $period));\n\t}\n\n\tprivate function handle(TaskHandler $handler){\n\t\tif($handler->isDelayed()){\n\t\t\t$nextRun = $this->currentTick + $handler->getDelay();\n\t\t}else{\n\t\t\t$nextRun = $this->currentTick;\n\t\t}\n\n\t\t$handler->setNextRun($nextRun);\n\t\t$this->tasks[$handler->getTaskId()] = $handler;\n\t\t$this->queue->insert($handler, $nextRun);\n\n\t\treturn $handler;\n\t}\n\n\t/**\n\t * @param int $currentTick\n\t */\n\tpublic function mainThreadHeartbeat($currentTick){\n\t\t$this->currentTick = $currentTick;\n\t\twhile($this->isReady($this->currentTick)){\n\t\t\t/** @var TaskHandler $task */\n\t\t\t$task = $this->queue->extract();\n\t\t\tif($task->isCancelled()){\n\t\t\t\tunset($this->tasks[$task->getTaskId()]);\n\t\t\t\tcontinue;\n\t\t\t}else{\n\t\t\t\t$task->timings->startTiming();\n\t\t\t\ttry{\n\t\t\t\t\t$task->run($this->currentTick);\n\t\t\t\t}catch(\\Throwable $e){\n\t\t\t\t\tServer::getInstance()->getLogger()->critical(\"Could not execute task \" . $task->getTaskName() . \": \" . $e->getMessage());\n\t\t\t\t\t$logger = Server::getInstance()->getLogger();\n\t\t\t\t\tif($logger instanceof MainLogger){\n\t\t\t\t\t\t$logger->logException($e);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$task->timings->stopTiming();\n\t\t\t}\n\t\t\tif($task->isRepeating()){\n\t\t\t\t$task->setNextRun($this->currentTick + $task->getPeriod());\n\t\t\t\t$this->queue->insert($task, $this->currentTick + $task->getPeriod());\n\t\t\t}else{\n\t\t\t\t$task->remove();\n\t\t\t\tunset($this->tasks[$task->getTaskId()]);\n\t\t\t}\n\t\t}\n\n\t\t$this->asyncPool->collectTasks();\n\t}\n\n\tprivate function isReady($currentTicks){\n\t\treturn count($this->tasks) > 0 and $this->queue->current()->getNextRun() <= $currentTicks;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tprivate function nextId(){\n\t\treturn $this->ids++;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/Task.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nabstract class Task{\n\n\t/** @var TaskHandler */\n\tprivate $taskHandler = null;\n\n\t/**\n\t * @return TaskHandler\n\t */\n\tpublic final function getHandler(){\n\t\treturn $this->taskHandler;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic final function getTaskId(){\n\t\tif($this->taskHandler !== null){\n\t\t\treturn $this->taskHandler->getTaskId();\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t * @param TaskHandler $taskHandler\n\t */\n\tpublic final function setHandler($taskHandler){\n\t\tif($this->taskHandler === null or $taskHandler === null){\n\t\t\t$this->taskHandler = $taskHandler;\n\t\t}\n\t}\n\n\t/**\n\t * Actions to execute when run\n\t *\n\t * @param $currentTick\n\t *\n\t * @return void\n\t */\n\tpublic abstract function onRun($currentTick);\n\n\t/**\n\t * Actions to execute if the Task is cancelled\n\t */\n\tpublic function onCancel(){\n\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/scheduler/TaskHandler.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\scheduler;\n\nuse pocketmine\\event\\Timings;\n\nclass TaskHandler{\n\n\t/** @var Task */\n\tprotected $task;\n\n\t/** @var int */\n\tprotected $taskId;\n\n\t/** @var int */\n\tprotected $delay;\n\n\t/** @var int */\n\tprotected $period;\n\n\t/** @var int */\n\tprotected $nextRun;\n\n\t/** @var bool */\n\tprotected $cancelled = false;\n\n\t/** @var \\pocketmine\\event\\TimingsHandler */\n\tpublic $timings;\n\n\tpublic $timingName = null;\n\n\t/**\n\t * @param string $timingName\n\t * @param Task   $task\n\t * @param int    $taskId\n\t * @param int    $delay\n\t * @param int    $period\n\t */\n\tpublic function __construct($timingName, Task $task, $taskId, $delay = -1, $period = -1){\n\t\t$this->task = $task;\n\t\t$this->taskId = $taskId;\n\t\t$this->delay = $delay;\n\t\t$this->period = $period;\n\t\t$this->timingName = $timingName === null ? \"Unknown\" : $timingName;\n\t\t$this->timings = Timings::getPluginTaskTimings($this, $period);\n\t\t$this->task->setHandler($this);\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isCancelled(){\n\t\treturn $this->cancelled === true;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getNextRun(){\n\t\treturn $this->nextRun;\n\t}\n\n\t/**\n\t * @param int $ticks\n\t */\n\tpublic function setNextRun($ticks){\n\t\t$this->nextRun = $ticks;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getTaskId(){\n\t\treturn $this->taskId;\n\t}\n\n\t/**\n\t * @return Task\n\t */\n\tpublic function getTask(){\n\t\treturn $this->task;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getDelay(){\n\t\treturn $this->delay;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isDelayed(){\n\t\treturn $this->delay > 0;\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function isRepeating(){\n\t\treturn $this->period > 0;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getPeriod(){\n\t\treturn $this->period;\n\t}\n\n\t/**\n\t * WARNING: Do not use this, it's only for internal use.\n\t * Changes to this function won't be recorded on the version.\n\t */\n\tpublic function cancel(){\n\t\tif(!$this->isCancelled()){\n\t\t\t$this->task->onCancel();\n\t\t}\n\t\t$this->remove();\n\t}\n\n\tpublic function remove(){\n\t\t$this->cancelled = true;\n\t\t$this->task->setHandler(null);\n\t}\n\n\t/**\n\t * @param int $currentTick\n\t */\n\tpublic function run($currentTick){\n\t\t$this->task->onRun($currentTick);\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getTaskName(){\n\t\tif($this->timingName !== null){\n\t\t\treturn $this->timingName;\n\t\t}\n\n\t\treturn get_class($this->task);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Beacon.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n * \n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Pocketmine Team\n * @link http://www.pocketmine.net\n * \n *\n*/\n\n namespace pocketmine\\tile;\n \n use pocketmine\\level\\format\\Chunk;\n use pocketmine\\nbt\\tag\\CompoundTag;\n use pocketmine\\nbt\\tag\\IntTag;\n use pocketmine\\nbt\\tag\\StringTag;\n use pocketmine\\nbt\\tag\\ByteTag;\n use pocketmine\\nbt\\tag\\FloatTag;\n \n class Beacon extends Spawnable{\n \n \tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n \t\tparent::__construct($chunk, $nbt);\n \t}\n \n \tpublic function saveNBT(){\n \t\tparent::saveNBT();\n \t}\n \n \tprivate function setChanged(){\n \t\t$this->spawnToAll();\n \t\tif($this->chunk instanceof Chunk){\n \t\t\t$this->chunk->setChanged();\n \t\t\t$this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ());\n \t\t}\n \t}\n \n \tpublic function getSpawnCompound(){\n \t\treturn new CompoundTag(\"\", [\n \t\t\tnew StringTag(\"id\", Tile::BEACON),\n \t\t\tnew IntTag(\"x\", (int) $this->x),\n \t\t\tnew IntTag(\"y\", (int) $this->y),\n \t\t\tnew IntTag(\"z\", (int) $this->z)\n \t\t]);\n \t}\n }\n\n"
  },
  {
    "path": "src/pocketmine/tile/BrewingStand.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\inventory\\BrewingInventory;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\network\\protocol\\ContainerSetDataPacket;\nuse pocketmine\\Server;\n\nclass BrewingStand extends Spawnable implements InventoryHolder, Container, Nameable{\n\tconst MAX_BREW_TIME = 400;\n\t/** @var BrewingInventory */\n\tprotected $inventory;\n\n\tpublic static $ingredients = [\n\t\tItem::NETHER_WART => 0,\n\t\tItem::GLOWSTONE_DUST => 0,\n\t\tItem::REDSTONE => 0,\n\t\tItem::FERMENTED_SPIDER_EYE => 0,\n\n\t\tItem::MAGMA_CREAM => 0,\n\t\tItem::SUGAR => 0,\n\t\tItem::GLISTERING_MELON => 0,\n\t\tItem::SPIDER_EYE => 0,\n\t\tItem::GHAST_TEAR => 0,\n\t\tItem::BLAZE_POWDER => 0,\n\t\tItem::GOLDEN_CARROT => 0,\n\t\t//Item::RAW_FISH => Fish::FISH_PUFFERFISH,\n\t\tItem::PUFFER_FISH,\n\t\tItem::RABBIT_FOOT => 0,\n\n\t\tItem::GUNPOWDER => 0,\n\t];\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->CookedTime) or !($nbt->CookedTime instanceof ShortTag)){\n\t\t\t$nbt->CookedTime = new ShortTag(\"CookedTime\", 0);\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->inventory = new BrewingInventory($this);\n\t\tif(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){\n\t\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\t}\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$this->inventory->setItem($i, $this->getItem($i));\n\t\t}\n\t\t/*if($this->namedtag[\"CookTime\"] < self::MAX_BREW_TIME){\n\t\t\t$this->scheduleUpdate();\n\t\t}*/\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->hasName() ? $this->namedtag->CustomName->getValue() : \"Brewing Stand\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\tpublic function close(){\n\t\tif(!$this->closed){\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getInventory());\n\t\t\t}\n\t\t\tparent::close();\n\t\t}\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\tfor($index = 0; $index < $this->getSize(); ++$index){\n\t\t\t$this->setItem($index, $this->inventory->getItem($index));\n\t\t}\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSize(){\n\t\treturn 4;\n\t}\n\n\t/**\n\t * @param $index\n\t *\n\t * @return int\n\t */\n\tprotected function getSlotIndex($index){\n\t\tforeach($this->namedtag->Items as $i => $slot){\n\t\t\tif($slot[\"Slot\"] === $index){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index){\n\t\t$i = $this->getSlotIndex($index);\n\t\tif($i < 0){\n\t\t\treturn Item::get(Item::AIR, 0, 0);\n\t\t}else{\n\t\t\treturn Item::nbtDeserialize($this->namedtag->Items[$i]);\n\t\t}\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int  $index\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setItem($index, Item $item){\n\t\t$i = $this->getSlotIndex($index);\n\n\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\tif($i >= 0){\n\t\t\t\tunset($this->namedtag->Items[$i]);\n\t\t\t}\n\t\t}elseif($i < 0){\n\t\t\tfor($i = 0; $i <= $this->getSize(); ++$i){\n\t\t\t\tif(!isset($this->namedtag->Items[$i])){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}else{\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return BrewingInventory\n\t */\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\tpublic function checkIngredient(Item $item){\n\t\tif(isset(self::$ingredients[$item->getId()])){\n\t\t\tif(self::$ingredients[$item->getId()] === $item->getDamage()){\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function updateSurface(){\n\t\t$this->saveNBT();\n\t\t$this->onChanged();\n\t}\n\n\tpublic function onUpdate(){\n\t\tif($this->closed === true){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\t$ret = false;\n\n\t\t$ingredient = $this->inventory->getIngredient();\n\t\t$canBrew = false;\n\n\t\tfor($i = 1; $i <= 3; $i++){\n\t\t\tif($this->inventory->getItem($i)->getId() === Item::POTION or\n\t\t\t\t$this->inventory->getItem($i)->getId() === Item::SPLASH_POTION\n\t\t\t){\n\t\t\t\t$canBrew = true;\n\t\t\t}\n\t\t}\n\n\t\tif($ingredient->getId() !== Item::AIR and $ingredient->getCount() > 0){\n\t\t\tif($canBrew){\n\t\t\t\tif(!$this->checkIngredient($ingredient)){\n\t\t\t\t\t$canBrew = false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($canBrew){\n\t\t\t\tfor($i = 1; $i <= 3; $i++){\n\t\t\t\t\t$potion = $this->inventory->getItem($i);\n\t\t\t\t\t$recipe = Server::getInstance()->getCraftingManager()->matchBrewingRecipe($ingredient, $potion);\n\t\t\t\t\tif($recipe !== null){\n\t\t\t\t\t\t$canBrew = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t$canBrew = false;\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$canBrew = false;\n\t\t}\n\n\t\tif($canBrew){\n\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", $this->namedtag[\"CookTime\"] - 1);\n\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$windowId = $player->getWindowId($this->getInventory());\n\t\t\t\tif($windowId > 0){\n\t\t\t\t\t$pk = new ContainerSetDataPacket();\n\t\t\t\t\t$pk->windowid = $windowId;\n\t\t\t\t\t$pk->property = 0; //Brew\n\t\t\t\t\t$pk->value = $this->namedtag[\"CookTime\"];\n\t\t\t\t\t$player->dataPacket($pk);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($this->namedtag[\"CookTime\"] <= 0){\n\t\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", self::MAX_BREW_TIME);\n\t\t\t\tfor($i = 1; $i <= 3; $i++){\n\t\t\t\t\t$potion = $this->inventory->getItem($i);\n\t\t\t\t\t$recipe = Server::getInstance()->getCraftingManager()->matchBrewingRecipe($ingredient, $potion);\n\t\t\t\t\tif($recipe != null and $potion->getId() !== Item::AIR){\n\t\t\t\t\t\t$this->inventory->setItem($i, $recipe->getResult());\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$ingredient->count--;\n\t\t\t\tif($ingredient->getCount() <= 0) $ingredient = Item::get(Item::AIR);\n\t\t\t\t$this->inventory->setIngredient($ingredient);\n\t\t\t}\n\n\t\t\t$ret = true;\n\t\t}else{\n\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", self::MAX_BREW_TIME);\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$windowId = $player->getWindowId($this->getInventory());\n\t\t\t\tif($windowId > 0){\n\t\t\t\t\t$pk = new ContainerSetDataPacket();\n\t\t\t\t\t$pk->windowid = $windowId;\n\t\t\t\t\t$pk->property = 0; //Brew\n\t\t\t\t\t$pk->value = 0;\n\t\t\t\t\t$player->dataPacket($pk);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t$this->lastUpdate = microtime(true);\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $ret;\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::BREWING_STAND),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t\tnew ShortTag(\"CookTime\", self::MAX_BREW_TIME),\n\t\t\t$this->namedtag->Items,\n\t\t]);\n\n\t\tif($this->hasName()){\n\t\t\t$nbt->CustomName = $this->namedtag->CustomName;\n\t\t}\n\t\treturn $nbt;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Cauldron.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\utils\\Color;\n\nclass Cauldron extends Spawnable{\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->PotionId) or !($nbt->PotionId instanceof ShortTag)){\n\t\t\t$nbt->PotionId = new ShortTag(\"PotionId\", 0xffff);\n\t\t}\n\t\tif(!isset($nbt->SplashPotion) or !($nbt->SplashPotion instanceof ByteTag)){\n\t\t\t$nbt->SplashPotion = new ByteTag(\"SplashPotion\", 0);\n\t\t}\n\t\tif(!isset($nbt->Items) or !($nbt->Items instanceof ListTag)){\n\t\t\t$nbt->Items = new ListTag(\"Items\", []);\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t}\n\n\tpublic function getPotionId(){\n\t\treturn $this->namedtag[\"PotionId\"];\n\t}\n\n\tpublic function setPotionId($potionId){\n\t\t$this->namedtag->PotionId = new ShortTag(\"PotionId\", $potionId);\n\t\t$this->onChanged();\n\t}\n\n\tpublic function hasPotion(){\n\t\treturn $this->namedtag[\"PotionId\"] !== 0xffff;\n\t}\n\n\tpublic function getSplashPotion(){\n\t\treturn ($this->namedtag[\"SplashPotion\"] == true);\n\t}\n\n\tpublic function setSplashPotion($bool){\n\t\t$this->namedtag->SplashPotion = new ByteTag(\"SplashPotion\", ($bool == true) ? 1 : 0);\n\t\t$this->onChanged();\n\t}\n\n\tpublic function getCustomColor(){//\n\t\tif($this->isCustomColor()){\n\t\t\t$color = $this->namedtag[\"CustomColor\"];\n\t\t\t$green = ($color >> 8) & 0xff;\n\t\t\t$red = ($color >> 16) & 0xff;\n\t\t\t$blue = ($color) & 0xff;\n\t\t\treturn Color::getRGB($red, $green, $blue);\n\t\t}\n\t\treturn null;\n\t}\n\n\tpublic function getCustomColorRed(){\n\t\treturn ($this->namedtag[\"CustomColor\"] >> 16) & 0xff;\n\t}\n\n\tpublic function getCustomColorGreen(){\n\t\treturn ($this->namedtag[\"CustomColor\"] >> 8) & 0xff;\n\t}\n\n\tpublic function getCustomColorBlue(){\n\t\treturn ($this->namedtag[\"CustomColor\"]) & 0xff;\n\t}\n\n\tpublic function isCustomColor(){\n\t\treturn isset($this->namedtag->CustomColor);\n\t}\n\n\tpublic function setCustomColor($r, $g = 0xff, $b = 0xff){\n\t\tif($r instanceof Color){\n\t\t\t$color = ($r->getRed() << 16 | $r->getGreen() << 8 | $r->getBlue()) & 0xffffff;\n\t\t}else{\n\t\t\t$color = ($r << 16 | $g << 8 | $b) & 0xffffff;\n\t\t}\n\t\t$this->namedtag->CustomColor = new IntTag(\"CustomColor\", $color);\n\t\t$this->onChanged();\n\t}\n\n\tpublic function clearCustomColor(){\n\t\tif(isset($this->namedtag->CustomColor)){\n\t\t\tunset($this->namedtag->CustomColor);\n\t\t}\n\t\t$this->onChanged();\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::CAULDRON),\n\t\t\tnew IntTag(\"x\", (Int) $this->x),\n\t\t\tnew IntTag(\"y\", (Int) $this->y),\n\t\t\tnew IntTag(\"z\", (Int) $this->z),\n\t\t\tnew ShortTag(\"PotionId\", $this->namedtag[\"PotionId\"]),\n\t\t\tnew ByteTag(\"SplashPotion\", $this->namedtag[\"SplashPotion\"]),\n\t\t\tnew ListTag(\"Items\", $this->namedtag[\"Items\"])//unused?\n\t\t]);\n\n\t\tif($this->getPotionId() === 0xffff and $this->isCustomColor()){\n\t\t\t$nbt->CustomColor = $this->namedtag->CustomColor;\n\t\t}\n\t\treturn $nbt;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Chest.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\inventory\\ChestInventory;\nuse pocketmine\\inventory\\DoubleChestInventory;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\n\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass Chest extends Spawnable implements InventoryHolder, Container, Nameable{\n\n\t/** @var ChestInventory */\n\tprotected $inventory;\n\t/** @var DoubleChestInventory */\n\tprotected $doubleInventory = null;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->inventory = new ChestInventory($this);\n\t\tif(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){\n\t\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\t}\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$this->inventory->setItem($i, $this->getItem($i));\n\t\t}\n\t}\n\n\tpublic function close(){\n\t\tif($this->closed === false){\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getInventory());\n\t\t\t}\n\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getRealInventory());\n\t\t\t}\n\t\t\tparent::close();\n\t\t}\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\tfor($index = 0; $index < $this->getSize(); ++$index){\n\t\t\t$this->setItem($index, $this->inventory->getItem($index));\n\t\t}\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSize(){\n\t\treturn 27;\n\t}\n\n\t/**\n\t * @param $index\n\t *\n\t * @return int\n\t */\n\tprotected function getSlotIndex($index){\n\t\tforeach($this->namedtag->Items as $i => $slot){\n\t\t\tif((int) $slot[\"Slot\"] === (int) $index){\n\t\t\t\treturn (int) $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index){\n\t\t$i = $this->getSlotIndex($index);\n\t\tif($i < 0){\n\t\t\treturn Item::get(Item::AIR, 0, 0);\n\t\t}else{\n\t\t\treturn Item::nbtDeserialize($this->namedtag->Items[$i]);\n\t\t}\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int  $index\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setItem($index, Item $item){\n\t\t$i = $this->getSlotIndex($index);\n\n\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\tif($i >= 0){\n\t\t\t\tunset($this->namedtag->Items[$i]);\n\t\t\t}\n\t\t}elseif($i < 0){\n\t\t\tfor($i = 0; $i <= $this->getSize(); ++$i){\n\t\t\t\tif(!isset($this->namedtag->Items[$i])){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}else{\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return ChestInventory|DoubleChestInventory\n\t */\n\tpublic function getInventory(){\n\t\tif($this->isPaired() and $this->doubleInventory === null){\n\t\t\t$this->checkPairing();\n\t\t}\n\t\treturn $this->doubleInventory instanceof DoubleChestInventory ? $this->doubleInventory : $this->inventory;\n\t}\n\n\t/**\n\t * @return ChestInventory\n\t */\n\tpublic function getRealInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\t/**\n\t * @return DoubleChestInventory|null\n\t */\n\tpublic function getDoubleInventory(){\n\t\treturn $this->doubleInventory;\n\t}\n\n\tprotected function checkPairing(){\n\t\tif($this->isPaired() and !$this->getLevel()->isChunkLoaded($this->namedtag->pairx->getValue() >> 4, $this->namedtag->pairz->getValue() >> 4)){\n\t\t\t//paired to a tile in an unloaded chunk\n\t\t\t$this->doubleInventory = null;\n\n\t\t}elseif(($pair = $this->getPair()) instanceof Chest){\n\t\t\tif(!$pair->isPaired()){\n\t\t\t\t$pair->createPair($this);\n\t\t\t\t$pair->checkPairing();\n\t\t\t}\n\t\t\tif($this->doubleInventory === null){\n\t\t\t\tif(($p = $pair->getDoubleInventory()) instanceof DoubleChestInventory){\n\t\t\t\t\t$this->doubleInventory = $p;\n\t\t\t\t}else{\n\t\t\t\t\tif(($pair->x + ($pair->z << 15)) > ($this->x + ($this->z << 15))){ //Order them correctly\n\t\t\t\t\t\t$this->doubleInventory = new DoubleChestInventory($pair, $this);\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$this->doubleInventory = new DoubleChestInventory($this, $pair);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}else{\n\t\t\t$this->doubleInventory = null;\n\t\t\tunset($this->namedtag->pairx, $this->namedtag->pairz);\n\t\t}\n\t}\n\n\tpublic function getName() : string{\n\t\treturn isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : \"Chest\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\tpublic function isPaired(){\n\t\tif(!isset($this->namedtag->pairx) or !isset($this->namedtag->pairz)){\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return Chest\n\t */\n\tpublic function getPair(){\n\t\tif($this->isPaired()){\n\t\t\t$tile = $this->getLevel()->getTile(new Vector3((int) $this->namedtag[\"pairx\"], $this->y, (int) $this->namedtag[\"pairz\"]));\n\t\t\tif($tile instanceof Chest){\n\t\t\t\treturn $tile;\n\t\t\t}\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tpublic function pairWith(Chest $tile){\n\t\tif($this->isPaired() or $tile->isPaired()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->createPair($tile);\n\n\t\t$this->spawnToAll();\n\t\t$tile->spawnToAll();\n\t\t$this->checkPairing();\n\n\t\treturn true;\n\t}\n\n\tprivate function createPair(Chest $tile){\n\t\t$this->namedtag->pairx = new IntTag(\"pairx\", $tile->x);\n\t\t$this->namedtag->pairz = new IntTag(\"pairz\", $tile->z);\n\n\t\t$tile->namedtag->pairx = new IntTag(\"pairx\", $this->x);\n\t\t$tile->namedtag->pairz = new IntTag(\"pairz\", $this->z);\n\t}\n\n\tpublic function unpair(){\n\t\tif(!$this->isPaired()){\n\t\t\treturn false;\n\t\t}\n\n\t\t$tile = $this->getPair();\n\t\tunset($this->namedtag->pairx, $this->namedtag->pairz);\n\n\t\t$this->spawnToAll();\n\n\t\tif($tile instanceof Chest){\n\t\t\tunset($tile->namedtag->pairx, $tile->namedtag->pairz);\n\t\t\t$tile->checkPairing();\n\t\t\t$tile->spawnToAll();\n\t\t}\n\t\t$this->checkPairing();\n\n\t\treturn true;\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\tif($this->isPaired()){\n\t\t\t$c = new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::CHEST),\n\t\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t\t\tnew IntTag(\"pairx\", (int) $this->namedtag[\"pairx\"]),\n\t\t\t\tnew IntTag(\"pairz\", (int) $this->namedtag[\"pairz\"])\n\t\t\t]);\n\t\t}else{\n\t\t\t$c = new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::CHEST),\n\t\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t\t]);\n\t\t}\n\n\t\tif($this->hasName()){\n\t\t\t$c->CustomName = $this->namedtag->CustomName;\n\t\t}\n\n\t\treturn $c;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Container.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\item\\Item;\n\ninterface Container{\n\n\t/**\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index);\n\n\t/**\n\t * @param int  $index\n\t * @param Item $item\n\t */\n\tpublic function setItem($index, Item $item);\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSize();\n}\n"
  },
  {
    "path": "src/pocketmine/tile/DLDetector.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\block\\DaylightDetector;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\level\\Level;\n\nclass DLDetector extends Spawnable{\n\tprivate $lastType = 0;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->scheduleUpdate();\n\t}\n\n\tpublic function getLightByTime(){\n\t\t/*\t$strength = 1;\n\t\t\t$time = $this->getLevel()->getTime();\n\t\t\tif(WeatherManager::isRegistered($this->getLevel())) $weather = $this->getLevel()->getWeather()->getWeather();\n\t\t\telse $weather = Weather::SUNNY;\n\t\t\tswitch($weather){\n\t\t\t\tcase Weather::SUNNY:\n\t\t\t\t\tif($time <= 22340 and $time >= 13680) $strength = 1;\n\t\t\t\t\tif($time <= 22800 and $time >= 13220) $strength = 2;\n\t\t\t\t\tif($time <= 23080 and $time >= 12940) $strength = 3;\n\t\t\t\t\tif($time <= 23300 and $time >= 12720) $strength = 4;\n\t\t\t\t\tif($time <= 23540 and $time >= 12480) $strength = 5;\n\t\t\t\t\tif($time <= 23780 and $time >= 12240) $strength = 6;\n\t\t\t\t\tif($time <= 23960 and $time >= 12040) $strength = 7;\n\t\t\t\t\tif($time >= 180 and $time <= 11840) $strength = 8;\n\t\t\t\t\tif($time >= 540 and $time <= 11480) $strength = 9;\n\t\t\t\t\tif($time >= 940 and $time <= 11080) $strength = 10;\n\t\t\t\t\tif($time >= 1380 and $time <= 10640) $strength = 11;\n\t\t\t\t\tif($time >= 1880 and $time <= 10140) $strength = 12;\n\t\t\t\t\tif($time >= 2460 and $time <= 9560) $strength = 13;\n\t\t\t\t\tif($time >= 3180 and $time <= 8840) $strength = 14;\n\t\t\t\t\tif($time >= 4300 and $time <= 7720) $strength = 15;\n\t\t\t\t\tbreak;\n\t\t\t\tcase Weather::RAINY_THUNDER:\n\t\t\t\tcase Weather::RAINY:\n\t\t\t\t\tif($time <= 22340 and $time >= 13680) $strength = 1;\n\t\t\t\t\tif($time <= 22800 and $time >= 13220) $strength = 2;\n\t\t\t\t\tif($time <= 23240 and $time >= 12780) $strength = 3;\n\t\t\t\t\tif($time <= 23520 and $time >= 12500) $strength = 4;\n\t\t\t\t\tif($time <= 23760 and $time >= 12260) $strength = 5;\n\t\t\t\t\tif($time >= 0 and $time <= 12020) $strength = 6;\n\t\t\t\t\tif($time >= 400 and $time <= 11620) $strength = 7;\n\t\t\t\t\tif($time >= 900 and $time <= 11120) $strength = 8;\n\t\t\t\t\tif($time >= 1440 and $time <= 10580) $strength = 9;\n\t\t\t\t\tif($time >= 2080 and $time <= 9940) $strength = 10;\n\t\t\t\t\tif($time >= 2880 and $time <= 9140) $strength = 11;\n\t\t\t\t\tif($time >= 4120 and $time <= 7990) $strength = 12;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn $strength;*/\n\t\t$time = $this->getLevel()->getTime();\n\t\tif(($time >= Level::TIME_DAY and $time <= Level::TIME_SUNSET) or\n\t\t\t($time >= Level::TIME_SUNRISE and $time <= Level::TIME_FULL)) return 15;\n\t\treturn 0;\n\t}\n\n\tpublic function isActivated() : bool{\n\t\tif($this->getType() == Block::DAYLIGHT_SENSOR) {\n\t\t\tif($this->getLightByTime() == 15) return true;\n\t\t\treturn false;\n\t\t}else{\n\t\t\tif($this->getLightByTime() == 0) return true;\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tprivate function getType() : int{\n\t\treturn $this->getBlock()->getId();\n\t}\n\n\tpublic function onUpdate(){\n\t\tif(($this->getLevel()->getServer()->getTick() % 3) == 0){ //Update per 3 ticks\n\t\t\tif($this->getType() != $this->lastType){ //Update when changed\n\t\t\t\t/** @var DaylightDetector $block */\n\t\t\t\t$block = $this->getBlock();\n\t\t\t\tif($this->isActivated()){\n\t\t\t\t\t$block->activate();\n\t\t\t\t}else{\n\t\t\t\t\t$block->deactivate();\n\t\t\t\t}\n\t\t\t\t$this->lastType = $block->getId();\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\treturn new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::DAY_LIGHT_DETECTOR),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t]);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/tile/Dispenser.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\inventory\\DispenserInventory;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\particle\\SmokeParticle;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\entity\\Item as ItemEntity;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\n\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass Dispenser extends Spawnable implements InventoryHolder, Container, Nameable{\n\n\t/** @var DispenserInventory */\n\tprotected $inventory;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->inventory = new DispenserInventory($this);\n\t\tif(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){\n\t\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\t}\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$this->inventory->setItem($i, $this->getItem($i));\n\t\t}\n\t\t$this->scheduleUpdate();\n\t}\n\n\tpublic function close(){\n\t\tif($this->closed === false){\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getInventory());\n\t\t\t}\n\t\t\tparent::close();\n\t\t}\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\tfor($index = 0; $index < $this->getSize(); ++$index){\n\t\t\t$this->setItem($index, $this->inventory->getItem($index));\n\t\t}\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSize(){\n\t\treturn 9;\n\t}\n\n\t/**\n\t * @param $index\n\t *\n\t * @return int\n\t */\n\tprotected function getSlotIndex($index){\n\t\tforeach($this->namedtag->Items as $i => $slot){\n\t\t\tif((int) $slot[\"Slot\"] === (int) $index){\n\t\t\t\treturn (int) $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index){\n\t\t$i = $this->getSlotIndex($index);\n\t\tif($i < 0){\n\t\t\treturn Item::get(Item::AIR, 0, 0);\n\t\t}else{\n\t\t\treturn Item::nbtDeserialize($this->namedtag->Items[$i]);\n\t\t}\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int  $index\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setItem($index, Item $item){\n\t\t$i = $this->getSlotIndex($index);\n\n\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\tif($i >= 0){\n\t\t\t\tunset($this->namedtag->Items[$i]);\n\t\t\t}\n\t\t}elseif($i < 0){\n\t\t\tfor($i = 0; $i <= $this->getSize(); ++$i){\n\t\t\t\tif(!isset($this->namedtag->Items[$i])){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}else{\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return DispenserInventory\n\t */\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : \"Dispenser\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\tpublic function getMotion(){\n\t\t$meta = $this->getBlock()->getDamage();\n\t\tswitch($meta){\n\t\t\tcase Vector3::SIDE_DOWN:\n\t\t\t\treturn [0, -1, 0];\n\t\t\tcase Vector3::SIDE_UP:\n\t\t\t\treturn [0, 1, 0];\n\t\t\tcase Vector3::SIDE_NORTH:\n\t\t\t\treturn [0, 0, -1];\n\t\t\tcase Vector3::SIDE_SOUTH:\n\t\t\t\treturn [0, 0, 1];\n\t\t\tcase Vector3::SIDE_WEST:\n\t\t\t\treturn [-1, 0, 0];\n\t\t\tcase Vector3::SIDE_EAST:\n\t\t\t\treturn [1, 0, 0];\n\t\t\tdefault:\n\t\t\t\treturn [0, 0, 0];\n\t\t}\n\t}\n\n\tpublic function activate(){\n\t\t$itemIndex = [];\n\t\tfor($i = 0; $i < $this->getSize(); $i++){\n\t\t\t$item = $this->getInventory()->getItem($i);\n\t\t\tif($item->getId() != Item::AIR){\n\t\t\t\t$itemIndex[] = [$i, $item];\n\t\t\t}\n\t\t}\n\t\t$max = count($itemIndex) - 1;\n\t\tif($max < 0) $itemArr = null;\n\t\telseif($max == 0) $itemArr = $itemIndex[0];\n\t\telse $itemArr = $itemIndex[mt_rand(0, $max)];\n\n\t\tif(is_array($itemArr)){\n\t\t\t/** @var Item $item */\n\t\t\t$item = $itemArr[1];\n\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t$this->getInventory()->setItem($itemArr[0], $item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t$motion = $this->getMotion();\n\t\t\t$needItem = Item::get($item->getId(), $item->getDamage());\n\t\t\t$f = 1.5;\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->x + $motion[0] * 2 + 0.5),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->y + ($motion[1] > 0 ? $motion[1] : 0.5)),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $this->z + $motion[2] * 2 + 0.5)\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $motion[0]),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $motion[1]),\n\t\t\t\t\t\t\tnew DoubleTag(\"\", $motion[2])\n\t\t\t\t\t\t]),\n\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\tnew FloatTag(\"\", lcg_value() * 360),\n\t\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t\t]),\n\t\t\t]);\n\t\t\tswitch($needItem->getId()){\n\t\t\t\tcase Item::ARROW:\n\t\t\t\t\t$nbt->Fire = new ShortTag(\"Fire\", 0);\n\t\t\t\t\t$entity = Entity::createEntity(\"Arrow\", $this->chunk, $nbt);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Item::SNOWBALL:\n\t\t\t\t\t$entity = Entity::createEntity(\"Snowball\", $this->chunk, $nbt);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Item::EGG:\n\t\t\t\t\t$entity = Entity::createEntity(\"Egg\", $this->chunk, $nbt);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Item::SPLASH_POTION:\n\t\t\t\t\t$nbt->PotionId = new ShortTag(\"PotionId\", $item->getDamage());\n\t\t\t\t\t$entity = Entity::createEntity(\"ThrownPotion\", $this->chunk, $nbt);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Item::ENCHANTING_BOTTLE:\n\t\t\t\t\t$entity = Entity::createEntity(\"ThrownExpBottle\", $this->chunk, $nbt);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$nbt->Health = new ShortTag(\"Health\", 5);\n\t\t\t\t\t$nbt->Item = $needItem->nbtSerialize(-1, \"Item\");\n\t\t\t\t\t$nbt->PickupDelay = new ShortTag(\"PickupDelay\", 10);\n\t\t\t\t\t$f = 0.3;\n\t\t\t\t\t$entity = new ItemEntity($this->chunk, $nbt, $this);\n\t\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\t$entity->setMotion($entity->getMotion()->multiply($f));\n\t\t\t$entity->spawnToAll();\n\n\t\t\tfor($i = 1; $i < 10; $i++){\n\t\t\t\t$this->getLevel()->addParticle(new SmokeParticle($this->add($motion[0] * $i * 0.3 + 0.5, $motion[1] == 0 ? 0.5 : $motion[1] * $i * 0.3, $motion[2] * $i * 0.3 + 0.5)));\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$c = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::DISPENSER),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t]);\n\n\t\tif($this->hasName()){\n\t\t\t$c->CustomName = $this->namedtag->CustomName;\n\t\t}\n\n\t\treturn $c;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/tile/Dropper.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\inventory\\DropperInventory;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\particle\\SmokeParticle;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\entity\\Item as ItemEntity;\n\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\IntTag;\n\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass Dropper extends Spawnable implements InventoryHolder, Container, Nameable{\n\n\t/** @var DropperInventory */\n\tprotected $inventory;\n\n\tprotected $nextUpdate = 0;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->inventory = new DropperInventory($this);\n\t\tif(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){\n\t\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\t}\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$this->inventory->setItem($i, $this->getItem($i));\n\t\t}\n\t\t$this->scheduleUpdate();\n\t}\n\n\tpublic function close(){\n\t\tif($this->closed === false){\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getInventory());\n\t\t\t}\n\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getInventory());\n\t\t\t}\n\t\t\tparent::close();\n\t\t}\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\tfor($index = 0; $index < $this->getSize(); ++$index){\n\t\t\t$this->setItem($index, $this->inventory->getItem($index));\n\t\t}\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSize(){\n\t\treturn 9;\n\t}\n\n\t/**\n\t * @param $index\n\t *\n\t * @return int\n\t */\n\tprotected function getSlotIndex($index){\n\t\tforeach($this->namedtag->Items as $i => $slot){\n\t\t\tif((int) $slot[\"Slot\"] === (int) $index){\n\t\t\t\treturn (int) $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index){\n\t\t$i = $this->getSlotIndex($index);\n\t\tif($i < 0){\n\t\t\treturn Item::get(Item::AIR, 0, 0);\n\t\t}else{\n\t\t\treturn Item::nbtDeserialize($this->namedtag->Items[$i]);\n\t\t}\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int  $index\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setItem($index, Item $item){\n\t\t$i = $this->getSlotIndex($index);\n\n\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\tif($i >= 0){\n\t\t\t\tunset($this->namedtag->Items[$i]);\n\t\t\t}\n\t\t}elseif($i < 0){\n\t\t\tfor($i = 0; $i <= $this->getSize(); ++$i){\n\t\t\t\tif(!isset($this->namedtag->Items[$i])){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}else{\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return DropperInventory\n\t */\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\tpublic function getName() : string{\n\t\treturn isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : \"Dropper\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\tpublic function getMotion(){\n\t\t$meta = $this->getBlock()->getDamage();\n\t\tswitch($meta){\n\t\t\tcase Vector3::SIDE_DOWN:\n\t\t\t\treturn [0, -1, 0];\n\t\t\tcase Vector3::SIDE_UP:\n\t\t\t\treturn [0, 1, 0];\n\t\t\tcase Vector3::SIDE_NORTH:\n\t\t\t\treturn [0, 0, -1];\n\t\t\tcase Vector3::SIDE_SOUTH:\n\t\t\t\treturn [0, 0, 1];\n\t\t\tcase Vector3::SIDE_WEST:\n\t\t\t\treturn [-1, 0, 0];\n\t\t\tcase Vector3::SIDE_EAST:\n\t\t\t\treturn [1, 0, 0];\n\t\t\tdefault:\n\t\t\t\treturn [0, 0, 0];\n\t\t}\n\t}\n\n\tpublic function activate(){\n\t\t$itemIndex = [];\n\t\tfor($i = 0; $i < $this->getSize(); $i++){\n\t\t\t$item = $this->getInventory()->getItem($i);\n\t\t\tif($item->getId() != Item::AIR){\n\t\t\t\t$itemIndex[] = [$i, $item];\n\t\t\t}\n\t\t}\n\t\t$max = count($itemIndex) - 1;\n\t\tif($max < 0) $itemArr = null;\n\t\telseif($max == 0) $itemArr = $itemIndex[0];\n\t\telse $itemArr = $itemIndex[mt_rand(0, $max)];\n\n\t\tif(is_array($itemArr)){\n\t\t\t/** @var Item $item */\n\t\t\t$item = $itemArr[1];\n\t\t\t$item->setCount($item->getCount() - 1);\n\t\t\t$this->getInventory()->setItem($itemArr[0], $item->getCount() > 0 ? $item : Item::get(Item::AIR));\n\t\t\t$motion = $this->getMotion();\n\t\t\t$needItem = Item::get($item->getId(), $item->getDamage());\n\t\t\t$block = $this->getLevel()->getBlock($this->add($motion[0], $motion[1], $motion[2]));\n\t\t\tswitch($block->getId()){\n\t\t\t\tcase Block::CHEST:\n\t\t\t\tcase Block::TRAPPED_CHEST:\n\t\t\t\tcase Block::DROPPER:\n\t\t\t\tcase Block::DISPENSER:\n\t\t\t\tcase Block::BREWING_STAND_BLOCK:\n\t\t\t\tcase Block::FURNACE:\n\t\t\t\t\t$t = $this->getLevel()->getTile($block);\n\t\t\t\t\t/** @var Chest|Dispenser|Dropper|BrewingStand|Furnace $t */\n\t\t\t\t\tif($t instanceof Tile){\n\t\t\t\t\t\tif($t->getInventory()->canAddItem($needItem)){\n\t\t\t\t\t\t\t$t->getInventory()->addItem($needItem);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t}\n\n\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\tnew DoubleTag(\"\", $this->x + $motion[0] * 2 + 0.5),\n\t\t\t\t\tnew DoubleTag(\"\", $this->y + ($motion[1] > 0 ? $motion[1] : 0.5)),\n\t\t\t\t\tnew DoubleTag(\"\", $this->z + $motion[2] * 2 + 0.5)\n\t\t\t\t]),\n\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\tnew DoubleTag(\"\", $motion[0]),\n\t\t\t\t\tnew DoubleTag(\"\", $motion[1]),\n\t\t\t\t\tnew DoubleTag(\"\", $motion[2])\n\t\t\t\t]),\n\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\tnew FloatTag(\"\", lcg_value() * 360),\n\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t]),\n\t\t\t\t\"Health\" => new ShortTag(\"Health\", 5),\n\t\t\t\t\"Item\" => $needItem->nbtSerialize(-1, \"Item\"),\n\t\t\t\t\"PickupDelay\" => new ShortTag(\"PickupDelay\", 10)\n\t\t\t]);\n\n\t\t\t$f = 0.3;\n\t\t\t$itemEntity = new ItemEntity($this->chunk, $nbt, $this);\n\t\t\t$itemEntity->setMotion($itemEntity->getMotion()->multiply($f));\n\t\t\t$itemEntity->spawnToAll();\n\n\t\t\tfor($i = 1; $i < 10; $i++){\n\t\t\t\t$this->getLevel()->addParticle(new SmokeParticle($this->add($motion[0] * $i * 0.3 + 0.5, $motion[1] == 0 ? 0.5 : $motion[1] * $i * 0.3, $motion[2] * $i * 0.3 + 0.5)));\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$c = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::DROPPER),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t]);\n\n\t\tif($this->hasName()){\n\t\t\t$c->CustomName = $this->namedtag->CustomName;\n\t\t}\n\n\t\treturn $c;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/tile/EnchantTable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\tile;\n\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass EnchantTable extends Spawnable implements Nameable{\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tparent::__construct($chunk, $nbt);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->hasName() ? $this->namedtag->CustomName->getValue() : \"Enchanting Table\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::ENCHANT_TABLE),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t]);\n\n\t\tif($this->hasName()){\n\t\t\t$nbt->CustomName = $this->namedtag->CustomName;\n\t\t}\n\n\t\treturn $nbt;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/EnderChest.php",
    "content": "<?php\n\n/*\n *\n *    _______                                _\n *   |__   __|                              | |\n *      | | ___  ___ ___  ___ _ __ __ _  ___| |_\n *      | |/ _ \\/ __/ __|/ _ \\  __/ _` |/ __| __|\n *      | |  __/\\__ \\__ \\  __/ | | (_| | (__| |_\n *      |_|\\___||___/___/\\___|_|  \\__,_|\\___|\\__|\n *\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author Tessetact Team\n * @link http://www.github.com/TesseractTeam/Tesseract\n * \n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass EnderChest extends Spawnable implements Nameable{\n\n\n\tpublic function getName() : string{\n\t\treturn isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : \"Ender Chest\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$enderchest = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::ENDER_CHEST),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t]);\n\n\t\tif($this->hasName()){\n\t\t\t$enderchest->CustomName = $this->namedtag->CustomName;\n\t\t}\n\n\t\treturn $enderchest;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/tile/FlowerPot.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass FlowerPot extends Spawnable{\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->item) or !($nbt->item instanceof ShortTag)){\n\t\t\t$nbt->item = new ShortTag(\"item\", 0);\n\t\t}\n\t\tif(!isset($nbt->mData) or !($nbt->mData instanceof IntTag)){\n\t\t\t$nbt->mData = new IntTag(\"mData\", 0);\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t}\n\n\tpublic function getItem() : Item{\n\t\treturn Item::get((int) ($this->namedtag[\"item\"] ?? 0), (int) ($this->namedtag[\"mData\"] ?? 0));\n\t}\n\n\tpublic function setItem(Item $item){\n\t\t$this->namedtag[\"item\"] = $item->getId();\n\t\t$this->namedtag[\"mData\"] = $item->getDamage();\n\t\t$this->onChanged();\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\treturn new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::FLOWER_POT),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t\t$this->namedtag->item,\n\t\t\t$this->namedtag->mData\n\t\t]);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Furnace.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\event\\inventory\\FurnaceBurnEvent;\nuse pocketmine\\event\\inventory\\FurnaceSmeltEvent;\nuse pocketmine\\inventory\\FurnaceInventory;\nuse pocketmine\\inventory\\FurnaceRecipe;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\NBT;\n\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\ShortTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\network\\protocol\\ContainerSetDataPacket;\n\nclass Furnace extends Spawnable implements InventoryHolder, Container, Nameable{\n\t/** @var FurnaceInventory */\n\tprotected $inventory;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->BurnTime) or !($nbt->BurnTime instanceof ShortTag) or $nbt[\"BurnTime\"] < 0){\n\t\t\t$nbt->BurnTime = new ShortTag(\"BurnTime\", 0);\n\t\t}\n\t\tif(!isset($nbt->CookTime) or !($nbt->CookTime instanceof ShortTag) or $nbt[\"CookTime\"] < 0 or ($nbt[\"BurnTime\"] === 0 and $nbt[\"CookTime\"] > 0)){\n\t\t\t$nbt->CookTime = new ShortTag(\"CookTime\", 0);\n\t\t}\n\t\tif(!isset($nbt->MaxTime) or !($nbt->MaxTime instanceof ShortTag)){\n\t\t\t$nbt->MaxTime = new ShortTag(\"BurnTime\", $nbt[\"BurnTime\"]);\n\t\t\t$nbt->BurnTicks = new ShortTag(\"BurnTicks\", 0);\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->inventory = new FurnaceInventory($this);\n\t\tif(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){\n\t\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\t}\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$this->inventory->setItem($i, $this->getItem($i));\n\t\t}\n\t\tif($this->namedtag[\"BurnTime\"] > 0){\n\t\t\t$this->scheduleUpdate();\n\t\t}\n\t}\n\n\tpublic function getName() : string{\n\t\treturn isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : \"Furnace\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\tpublic function close(){\n\t\tif($this->closed === false){\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getInventory());\n\t\t\t}\n\t\t\tparent::close();\n\t\t}\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\tfor($index = 0; $index < $this->getSize(); ++$index){\n\t\t\t$this->setItem($index, $this->inventory->getItem($index));\n\t\t}\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSize(){\n\t\treturn 3;\n\t}\n\n\t/**\n\t * @param $index\n\t *\n\t * @return int\n\t */\n\tprotected function getSlotIndex($index){\n\t\tforeach($this->namedtag->Items as $i => $slot){\n\t\t\tif($slot[\"Slot\"] === $index){\n\t\t\t\treturn $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index){\n\t\t$i = $this->getSlotIndex($index);\n\t\tif($i < 0){\n\t\t\treturn Item::get(Item::AIR, 0, 0);\n\t\t}else{\n\t\t\treturn Item::nbtDeserialize($this->namedtag->Items[$i]);\n\t\t}\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int  $index\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setItem($index, Item $item){\n\t\t$i = $this->getSlotIndex($index);\n\n\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\tif($i >= 0){\n\t\t\t\tunset($this->namedtag->Items[$i]);\n\t\t\t}\n\t\t}elseif($i < 0){\n\t\t\tfor($i = 0; $i <= $this->getSize(); ++$i){\n\t\t\t\tif(!isset($this->namedtag->Items[$i])){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}else{\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return FurnaceInventory\n\t */\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\tprotected function checkFuel(Item $fuel){\n\t\t$this->server->getPluginManager()->callEvent($ev = new FurnaceBurnEvent($this, $fuel, $fuel->getFuelTime()));\n\n\t\tif($ev->isCancelled()){\n\t\t\treturn;\n\t\t}\n\n\t\t$this->namedtag->MaxTime = new ShortTag(\"MaxTime\", $ev->getBurnTime());\n\t\t$this->namedtag->BurnTime = new ShortTag(\"BurnTime\", $ev->getBurnTime());\n\t\t$this->namedtag->BurnTicks = new ShortTag(\"BurnTicks\", 0);\n\t\tif($this->getBlock()->getId() === Item::FURNACE){\n\t\t\t$this->getLevel()->setBlock($this, Block::get(Item::BURNING_FURNACE, $this->getBlock()->getDamage()), true);\n\t\t}\n\n\t\tif($this->namedtag[\"BurnTime\"] > 0 and $ev->isBurning()){\n\t\t\t$fuel->setCount($fuel->getCount() - 1);\n\t\t\tif($fuel->getCount() === 0){\n\t\t\t\t$fuel = Item::get(Item::AIR, 0, 0);\n\t\t\t}\n\t\t\t$this->inventory->setFuel($fuel);\n\t\t}\n\t}\n\n\tpublic function onUpdate(){\n\t\tif($this->closed === true){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\t$ret = false;\n\n\t\t$fuel = $this->inventory->getFuel();\n\t\t$raw = $this->inventory->getSmelting();\n\t\t$product = $this->inventory->getResult();\n\t\t$smelt = $this->server->getCraftingManager()->matchFurnaceRecipe($raw);\n\t\t$canSmelt = ($smelt instanceof FurnaceRecipe and $raw->getCount() > 0 and (($smelt->getResult()->equals($product) and $product->getCount() < $product->getMaxStackSize()) or $product->getId() === Item::AIR));\n\n\t\tif($this->namedtag[\"BurnTime\"] <= 0 and $canSmelt and $fuel->getFuelTime() !== null and $fuel->getCount() > 0){\n\t\t\t$this->checkFuel($fuel);\n\t\t}\n\n\t\tif($this->namedtag[\"BurnTime\"] > 0){\n\t\t\t$this->namedtag->BurnTime = new ShortTag(\"BurnTime\", $this->namedtag[\"BurnTime\"] - 1);\n\t\t\t$this->namedtag->BurnTicks = new ShortTag(\"BurnTicks\", ceil(($this->namedtag[\"BurnTime\"] / $this->namedtag[\"MaxTime\"] * 200)));\n\n\t\t\tif($smelt instanceof FurnaceRecipe and $canSmelt){\n\t\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", $this->namedtag[\"CookTime\"] + 1);\n\t\t\t\tif($this->namedtag[\"CookTime\"] >= 200){ //10 seconds\n\t\t\t\t\t$product = Item::get($smelt->getResult()->getId(), $smelt->getResult()->getDamage(), $product->getCount() + 1);\n\n\t\t\t\t\t$this->server->getPluginManager()->callEvent($ev = new FurnaceSmeltEvent($this, $raw, $product));\n\n\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t$this->inventory->setResult($ev->getResult());\n\t\t\t\t\t\t$raw->setCount($raw->getCount() - 1);\n\t\t\t\t\t\tif($raw->getCount() === 0){\n\t\t\t\t\t\t\t$raw = Item::get(Item::AIR, 0, 0);\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->inventory->setSmelting($raw);\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", $this->namedtag[\"CookTime\"] - 200);\n\t\t\t\t}\n\t\t\t}elseif($this->namedtag[\"BurnTime\"] <= 0){\n\t\t\t\t$this->namedtag->BurnTime = new ShortTag(\"BurnTime\", 0);\n\t\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", 0);\n\t\t\t\t$this->namedtag->BurnTicks = new ShortTag(\"BurnTicks\", 0);\n\t\t\t}else{\n\t\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", 0);\n\t\t\t}\n\t\t\t$ret = true;\n\t\t}else{\n\t\t\tif($this->getBlock()->getId() === Item::BURNING_FURNACE){\n\t\t\t\t$this->getLevel()->setBlock($this, Block::get(Item::FURNACE, $this->getBlock()->getDamage()), true);\n\t\t\t}\n\t\t\t$this->namedtag->BurnTime = new ShortTag(\"BurnTime\", 0);\n\t\t\t$this->namedtag->CookTime = new ShortTag(\"CookTime\", 0);\n\t\t\t$this->namedtag->BurnTicks = new ShortTag(\"BurnTicks\", 0);\n\t\t}\n\n\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t$windowId = $player->getWindowId($this->getInventory());\n\t\t\tif($windowId > 0){\n\t\t\t\t$pk = new ContainerSetDataPacket();\n\t\t\t\t$pk->windowid = $windowId;\n\t\t\t\t$pk->property = 0; //Smelting\n\t\t\t\t$pk->value = floor($this->namedtag[\"CookTime\"]);\n\t\t\t\t$player->dataPacket($pk);\n\n\t\t\t\t$pk = new ContainerSetDataPacket();\n\t\t\t\t$pk->windowid = $windowId;\n\t\t\t\t$pk->property = 1; //Fire icon\n\t\t\t\t$pk->value = $this->namedtag[\"BurnTicks\"];\n\t\t\t\t$player->dataPacket($pk);\n\t\t\t}\n\n\t\t}\n\n\t\t$this->lastUpdate = microtime(true);\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn $ret;\n\t}\n\t\n\tpublic function getSpawnCompound(){\n\t\t$nbt = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::FURNACE),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t\tnew ShortTag(\"BurnTime\", $this->namedtag[\"BurnTime\"]),\n\t\t\tnew ShortTag(\"CookTime\", $this->namedtag[\"CookTime\"]),\n\t\t\t//new ShortTag(\"BurnDuration\", $this->namedtag[\"BurnTicks\"])\n\t\t]);\n\t\t\n\t\tif($this->hasName()){\n\t\t\t$nbt->CustomName = $this->namedtag->CustomName;\n\t\t}\n\t\treturn $nbt;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Hopper.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\block\\Hopper as HopperBlock;\nuse pocketmine\\entity\\Item as DroppedItem;\nuse pocketmine\\inventory\\HopperInventory;\nuse pocketmine\\inventory\\InventoryHolder;\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass Hopper extends Spawnable implements InventoryHolder, Container, Nameable{\n\t/** @var HopperInventory */\n\tprotected $inventory;\n\n\t/** @var bool */\n\tprotected $isLocked = false;\n\t\n\t/** @var bool */\n\tprotected $isPowered = false;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->TransferCooldown) or !($nbt->TransferCooldown instanceof IntTag)){\n\t\t\t$nbt->TransferCooldown = new IntTag(\"TransferCooldown\", 0);\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->inventory = new HopperInventory($this);\n\t\tif(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){\n\t\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\t}\n\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t$this->inventory->setItem($i, $this->getItem($i));\n\t\t}\n\t\t$this->scheduleUpdate();\n\t}\n\n\tpublic function close(){\n\t\tif($this->closed === false){\n\t\t\tforeach($this->getInventory()->getViewers() as $player){\n\t\t\t\t$player->removeWindow($this->getInventory());\n\t\t\t}\n\t\t\tparent::close();\n\t\t}\n\t}\n\t\n\tpublic function activate(){\n\t\t$this->isPowered = true;\n\t}\n\t\n\tpublic function deactivate(){\n\t\t$this->isPowered = false;\n\t}\n\n\tpublic function canUpdate(){\n\t\treturn $this->namedtag->TransferCooldown->getValue() === 0 and !$this->isPowered;\n\t}\n\n\tpublic function resetCooldownTicks(){\n\t\t$this->namedtag->TransferCooldown->setValue(8);\n\t}\n\n\tpublic function onUpdate(){\n\t\tif(!($this->getBlock() instanceof HopperBlock)){\n\t\t\treturn false;\n\t\t}\n\t\t//Pickup dropped items\n\t\t//This can happen at any time regardless of cooldown\n\t\t$area = clone $this->getBlock()->getBoundingBox(); //Area above hopper to draw items from\n\t\t$area->maxY = ceil($area->maxY) + 1; //Account for full block above, not just 1 + 5/8\n\t\tforeach($this->getLevel()->getChunkEntities($this->getBlock()->x >> 4, $this->getBlock()->z >> 4) as $entity){\n\t\t\tif(!($entity instanceof DroppedItem) or !$entity->isAlive()){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif(!$entity->boundingBox->intersectsWith($area)){\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\t$item = $entity->getItem();\n\t\t\tif(!$item instanceof Item){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif($item->getCount() < 1){\n\t\t\t\t$entity->kill();\n\t\t\t\tcontinue;\n\t\t\t}\n\n\t\t\tif($this->inventory->canAddItem($item)){\n\t\t\t\t$this->inventory->addItem($item);\n\t\t\t\t$entity->kill();\n\t\t\t}\n\t\t}\n\n\t\tif(!$this->canUpdate()){ //Hoppers only update CONTENTS every 8th tick\n\t\t\t$this->namedtag->TransferCooldown->setValue($this->namedtag->TransferCooldown->getValue() - 1);\n\t\t\treturn true;\n\t\t}\n\t\t\n\t\t//Suck items from above tile inventories\n\t\t$source = $this->getLevel()->getTile($this->getBlock()->getSide(Vector3::SIDE_UP));\n\t\tif($source instanceof Tile and $source instanceof InventoryHolder){\n\t\t\t$inventory = $source->getInventory();\n\t\t\t$item = clone $inventory->getItem($inventory->firstOccupied());\n\t\t\t$item->setCount(1);\n\t\t\tif($this->inventory->canAddItem($item)){\n\t\t\t\t$this->inventory->addItem($item);\n\t\t\t\t$inventory->removeItem($item);\n\t\t\t\t$this->resetCooldownTicks();\n\t\t\t\tif($source instanceof Hopper){\n\t\t\t\t\t$source->resetCooldownTicks();\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t\n\t\t//Feed item into target inventory\n\t\t//Do not do this if there's a hopper underneath this hopper, to follow vanilla behaviour\n\t\tif(!($this->getLevel()->getTile($this->getBlock()->getSide(Vector3::SIDE_DOWN)) instanceof Hopper)){\n\t\t\t$target = $this->getLevel()->getTile($this->getBlock()->getSide($this->getBlock()->getDamage()));\n\t\t\tif($target instanceof Tile and $target instanceof InventoryHolder){\n\t\t\t\t$inv = $target->getInventory();\n\t\t\t\tforeach($this->inventory->getContents() as $item){\n\t\t\t\t\tif($item->getId() === Item::AIR or $item->getCount() < 1){\n\t\t\t\t\t\tcontinue;\n\t\t\t\t\t}\n\t\t\t\t\t$targetItem = clone $item;\n\t\t\t\t\t$targetItem->setCount(1);\n\t\t\t\t\t\n\t\t\t\t\tif($inv->canAddItem($targetItem)){\n\t\t\t\t\t\t$inv->addItem($targetItem);\n\t\t\t\t\t\t$this->inventory->removeItem($targetItem);\n\t\t\t\t\t\t$this->resetCooldownTicks();\n\t\t\t\t\t\tif($target instanceof Hopper){\n\t\t\t\t\t\t\t$target->resetCooldownTicks();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t\t\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return HopperInventory\n\t */\n\tpublic function getInventory(){\n\t\treturn $this->inventory;\n\t}\n\n\t/**\n\t * @return int\n\t */\n\tpublic function getSize(){\n\t\treturn 5;\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int $index\n\t *\n\t * @return Item\n\t */\n\tpublic function getItem($index){\n\t\t$i = $this->getSlotIndex($index);\n\t\tif($i < 0){\n\t\t\treturn Item::get(Item::AIR, 0, 0);\n\t\t}else{\n\t\t\treturn Item::nbtDeserialize($this->namedtag->Items[$i]);\n\t\t}\n\t}\n\n\t/**\n\t * This method should not be used by plugins, use the Inventory\n\t *\n\t * @param int  $index\n\t * @param Item $item\n\t *\n\t * @return bool\n\t */\n\tpublic function setItem($index, Item $item){\n\t\t$i = $this->getSlotIndex($index);\n\n\t\tif($item->getId() === Item::AIR or $item->getCount() <= 0){\n\t\t\tif($i >= 0){\n\t\t\t\tunset($this->namedtag->Items[$i]);\n\t\t\t}\n\t\t}elseif($i < 0){\n\t\t\tfor($i = 0; $i <= $this->getSize(); ++$i){\n\t\t\t\tif(!isset($this->namedtag->Items[$i])){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}else{\n\t\t\t$this->namedtag->Items[$i] = $item->nbtSerialize($index);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @param $index\n\t *\n\t * @return int\n\t */\n\tprotected function getSlotIndex($index){\n\t\tforeach($this->namedtag->Items as $i => $slot){\n\t\t\tif((int) $slot[\"Slot\"] === (int) $index){\n\t\t\t\treturn (int) $i;\n\t\t\t}\n\t\t}\n\n\t\treturn -1;\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->Items = new ListTag(\"Items\", []);\n\t\t$this->namedtag->Items->setTagType(NBT::TAG_Compound);\n\t\tfor($index = 0; $index < $this->getSize(); ++$index){\n\t\t\t$this->setItem($index, $this->inventory->getItem($index));\n\t\t}\n\t}\n\n\tpublic function getName() : string{\n\t\treturn isset($this->namedtag->CustomName) ? $this->namedtag->CustomName->getValue() : \"Hopper\";\n\t}\n\n\tpublic function hasName(){\n\t\treturn isset($this->namedtag->CustomName);\n\t}\n\n\tpublic function setName($str){\n\t\tif($str === \"\"){\n\t\t\tunset($this->namedtag->CustomName);\n\t\t\treturn;\n\t\t}\n\t\t$this->namedtag->CustomName = new StringTag(\"CustomName\", $str);\n\t}\n\n\n\tpublic function hasLock(){\n\t\treturn isset($this->namedtag->Lock);\n\t}\n\n\tpublic function setLock(string $itemName = \"\"){\n\t\tif($itemName === \"\"){\n\t\t\tunset($this->namedtag->Lock);\n\t\t\treturn;\n\t\t}\n\t\t$this->namedtag->Lock = new StringTag(\"Lock\", $itemName);\n\t}\n\t\n\tpublic function checkLock(string $key){\n\t\treturn $this->namedtag->Lock->getValue() === $key;\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$c = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::HOPPER),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t]);\n\n\t\tif($this->hasName()){\n\t\t\t$c->CustomName = $this->namedtag->CustomName;\n\t\t}\n\t\tif($this->hasLock()){\n\t\t\t$c->Lock = $this->namedtag->Lock;\n\t\t}\n\n\t\treturn $c;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/ItemFrame.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\item\\Item;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\ByteTag;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\n\nclass ItemFrame extends Spawnable{\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt) {\n\t\tif(!isset($nbt->Item) or !($nbt->Item instanceof CompoundTag)) {\n\t\t\t$nbt->Item = Item::get(Item::AIR)->nbtSerialize(-1, \"Item\");\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Item Frame\";\n\t}\n\n\tpublic function getItemRotation() {\n\t\treturn $this->namedtag[\"ItemRotation\"];\n\t}\n\n\tpublic function hasItem() : bool{\n\t\treturn $this->getItem()->getId() !== Item::AIR;\n\t}\n\n\tpublic function setItemRotation(int $itemRotation){\n\t\t$this->namedtag->ItemRotation = new ByteTag(\"ItemRotation\", $itemRotation);\n\t\t$this->onChanged();\n\t}\n\n\tpublic function getItem(){\n\t\treturn Item::nbtDeserialize($this->namedtag->Item);\n\t}\n\n\tpublic function setItem(Item $item, bool $setChanged = true){\n\t\t$this->namedtag->Item = $item->nbtSerialize(-1, \"Item\");\n\t\tif($setChanged) {\n\t\t\t$this->onChanged();\n\t\t}\n\t}\n\n\tpublic function getItemDropChance(){\n\t\treturn $this->namedtag[\"ItemDropChance\"];\n\t}\n\n\tpublic function setItemDropChance(float $chance = 1.0){\n\t\t$this->namedtag->ItemDropChance = new FloatTag(\"ItemDropChance\", $chance);\n\t}\n\n\tpublic function getSpawnCompound() {\n\t\tif(!isset($this->namedtag->Item)) {\n\t\t\t$this->setItem(Item::get(Item::AIR), false);\n\t\t}\n\t\t/** @var CompoundTag $nbtItem */\n\t\t$nbtItem = clone $this->namedtag->Item;\n\t\t$nbtItem->setName(\"Item\");\n\t\tif($nbtItem[\"id\"] == 0) {\n\t\t\treturn new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::ITEM_FRAME),\n\t\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t\t\tnew ByteTag(\"ItemRotation\", 0),\n\t\t\t\tnew FloatTag(\"ItemDropChance\", (float) $this->getItemDropChance())\n\t\t\t]);\n\t\t} else {\n\t\t\treturn new CompoundTag(\"\", [\n\t\t\t\tnew StringTag(\"id\", Tile::ITEM_FRAME),\n\t\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t\t\t$nbtItem,\n\t\t\t\tnew ByteTag(\"ItemRotation\", (int) $this->getItemRotation()),\n\t\t\t\tnew FloatTag(\"ItemDropChance\", (float) $this->getItemDropChance())\n\t\t\t]);\n\t\t}\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/tile/MobSpawner.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\event\\entity\\EntityGenerateEvent;\nuse pocketmine\\item\\Item;\nuse pocketmine\\math\\Vector3;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\DoubleTag;\nuse pocketmine\\nbt\\tag\\ListTag;\nuse pocketmine\\nbt\\tag\\FloatTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\Player;\n\nclass MobSpawner extends Spawnable{\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->EntityId) or !($nbt->EntityId instanceof IntTag)){\n\t\t\t$nbt->EntityId = new IntTag(\"EntityId\", 0);\n\t\t}\n\t\tif(!isset($nbt->SpawnCount) or !($nbt->SpawnCount instanceof IntTag)){\n\t\t\t$nbt->SpawnCount = new IntTag(\"SpawnCount\", 4);\n\t\t}\n\t\tif(!isset($nbt->SpawnRange) or !($nbt->SpawnRange instanceof IntTag)){\n\t\t\t$nbt->SpawnRange = new IntTag(\"SpawnRange\", 4);\n\t\t}\n\t\tif(!isset($nbt->MinSpawnDelay) or !($nbt->MinSpawnDelay instanceof IntTag)){\n\t\t\t$nbt->MinSpawnDelay = new IntTag(\"MinSpawnDelay\", 200);\n\t\t}\n\t\tif(!isset($nbt->MaxSpawnDelay) or !($nbt->MaxSpawnDelay instanceof IntTag)){\n\t\t\t$nbt->MaxSpawnDelay = new IntTag(\"MaxSpawnDelay\", 799);\n\t\t}\n\t\tif(!isset($nbt->Delay) or !($nbt->Delay instanceof IntTag)){\n\t\t\t$nbt->Delay = new IntTag(\"Delay\", mt_rand($nbt->MinSpawnDelay->getValue(), $nbt->MaxSpawnDelay->getValue()));\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t\tif($this->getEntityId() > 0){\n\t\t\t$this->scheduleUpdate();\n\t\t}\n\t}\n\n\tpublic function getEntityId(){\n\t\treturn $this->namedtag[\"EntityId\"];\n\t}\n\n\tpublic function setEntityId(int $id){\n\t\t$this->namedtag->EntityId->setValue($id);\n\t\t$this->onChanged();\n\t\t$this->scheduleUpdate();\n\t}\n\n\tpublic function getSpawnCount(){\n\t\treturn $this->namedtag[\"SpawnCount\"];\n\t}\n\n\tpublic function setSpawnCount(int $value){\n\t\t$this->namedtag->SpawnCount->setValue($value);\n\t}\n\n\tpublic function getSpawnRange(){\n\t\treturn $this->namedtag[\"SpawnRange\"];\n\t}\n\n\tpublic function setSpawnRange(int $value){\n\t\t$this->namedtag->SpawnRange->setValue($value);\n\t}\n\n\tpublic function getMinSpawnDelay(){\n\t\treturn $this->namedtag[\"MinSpawnDelay\"];\n\t}\n\n\tpublic function setMinSpawnDelay(int $value){\n\t\t$this->namedtag->MinSpawnDelay->setValue($value);\n\t}\n\n\tpublic function getMaxSpawnDelay(){\n\t\treturn $this->namedtag[\"MaxSpawnDelay\"];\n\t}\n\n\tpublic function setMaxSpawnDelay(int $value){\n\t\t$this->namedtag->MaxSpawnDelay->setValue($value);\n\t}\n\n\tpublic function getDelay(){\n\t\treturn $this->namedtag[\"Delay\"];\n\t}\n\n\tpublic function setDelay(int $value){\n\t\t$this->namedtag->Delay->setValue($value);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn \"Monster Spawner\";\n\t}\n\n\tpublic function canUpdate() : bool{\n\t\tif($this->getEntityId() === 0) return false;\n\t\t$hasPlayer = false;\n\t\t$count = 0;\n\t\tforeach($this->getLevel()->getEntities() as $e){\n\t\t\tif($e instanceof Player){\n\t\t\t\tif($e->distance($this->getBlock()) <= 15) $hasPlayer = true;\n\t\t\t}\n\t\t\tif($e::NETWORK_ID == $this->getEntityId()){\n\t\t\t\t$count++;\n\t\t\t}\n\t\t}\n\t\tif($hasPlayer and $count < 15){ // Spawn limit = 15\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function onUpdate(){\n\t\tif($this->closed === true){\n\t\t\treturn false;\n\t\t}\n\n\t\t$this->timings->startTiming();\n\n\t\tif(!($this->chunk instanceof Chunk)){\n\t\t\treturn false;\n\t\t}\n\t\tif($this->canUpdate()){\n\t\t\tif($this->getDelay() <= 0){\n\t\t\t\t$success = 0;\n\t\t\t\tfor($i = 0; $i < $this->getSpawnCount(); $i++){\n\t\t\t\t\t$pos = $this->add(mt_rand() / mt_getrandmax() * $this->getSpawnRange(), mt_rand(-1, 1), mt_rand() / mt_getrandmax() * $this->getSpawnRange());\n\t\t\t\t\t$target = $this->getLevel()->getBlock($pos);\n\t\t\t\t\t$ground = $target->getSide(Vector3::SIDE_DOWN);\n\t\t\t\t\tif($target->getId() == Item::AIR && $ground->isTopFacingSurfaceSolid()){\n\t\t\t\t\t\t$success++;\n\t\t\t\t\t\t$this->getLevel()->getServer()->getPluginManager()->callEvent($ev = new EntityGenerateEvent($pos, $this->getEntityId(), EntityGenerateEvent::CAUSE_MOB_SPAWNER));\n\t\t\t\t\t\tif(!$ev->isCancelled()){\n\t\t\t\t\t\t\t$nbt = new CompoundTag(\"\", [\n\t\t\t\t\t\t\t\t\"Pos\" => new ListTag(\"Pos\", [\n\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $pos->x),\n\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $pos->y),\n\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", $pos->z)\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\"Motion\" => new ListTag(\"Motion\", [\n\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", 0),\n\t\t\t\t\t\t\t\t\tnew DoubleTag(\"\", 0)\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t\t\"Rotation\" => new ListTag(\"Rotation\", [\n\t\t\t\t\t\t\t\t\tnew FloatTag(\"\", mt_rand() / mt_getrandmax() * 360),\n\t\t\t\t\t\t\t\t\tnew FloatTag(\"\", 0)\n\t\t\t\t\t\t\t\t]),\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\t$entity = Entity::createEntity($this->getEntityId(), $this->chunk, $nbt);\n\t\t\t\t\t\t\t$entity->spawnToAll();\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tif($success > 0){\n\t\t\t\t\t$this->setDelay(mt_rand($this->getMinSpawnDelay(), $this->getMaxSpawnDelay()));\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->setDelay($this->getDelay() - 1);\n\t\t\t}\n\t\t}\n\n\t\t$this->timings->stopTiming();\n\n\t\treturn true;\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\t$c = new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::MOB_SPAWNER),\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z),\n\t\t\tnew IntTag(\"EntityId\", (int) $this->getEntityId())\n\t\t]);\n\n\t\treturn $c;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Nameable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\tile;\n\n\ninterface Nameable{\n\n\n\t/**\n\t * @return string\n\t */\n\tpublic function getName();\n\n\t/**\n\t * @param void $str\n\t */\n\tpublic function setName($str);\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function hasName();\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Sign.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\event\\block\\SignChangeEvent;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\Player;\nuse pocketmine\\utils\\TextFormat;\n\nclass Sign extends Spawnable{\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->Text1) or !($nbt->Text1 instanceof StringTag)){\n\t\t\t$nbt->Text1 = new StringTag(\"Text1\", \"\");\n\t\t}\n\t\tif(!isset($nbt->Text2) or !($nbt->Text2 instanceof StringTag)){\n\t\t\t$nbt->Text2 = new StringTag(\"Text2\", \"\");\n\t\t}\n\t\tif(!isset($nbt->Text3) or !($nbt->Text3 instanceof StringTag)){\n\t\t\t$nbt->Text3 = new StringTag(\"Text3\", \"\");\n\t\t}\n\t\tif(!isset($nbt->Text4) or !($nbt->Text4 instanceof StringTag)){\n\t\t\t$nbt->Text4 = new StringTag(\"Text4\", \"\");\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t}\n\n\tpublic function saveNBT(){\n\t\tparent::saveNBT();\n\t\tunset($this->namedtag->Creator);\n\t}\n\n\tpublic function setText($line1 = \"\", $line2 = \"\", $line3 = \"\", $line4 = \"\"){\n\t\t$this->namedtag->Text1 = new StringTag(\"Text1\", $line1);\n\t\t$this->namedtag->Text2 = new StringTag(\"Text2\", $line2);\n\t\t$this->namedtag->Text3 = new StringTag(\"Text3\", $line3);\n\t\t$this->namedtag->Text4 = new StringTag(\"Text4\", $line4);\n\t\t$this->onChanged();\n\n\t\treturn true;\n\t}\n\n\tpublic function getText(){\n\t\treturn [\n\t\t\t$this->namedtag[\"Text1\"],\n\t\t\t$this->namedtag[\"Text2\"],\n\t\t\t$this->namedtag[\"Text3\"],\n\t\t\t$this->namedtag[\"Text4\"]\n\t\t];\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\treturn new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::SIGN),\n\t\t\t$this->namedtag->Text1,\n\t\t\t$this->namedtag->Text2,\n\t\t\t$this->namedtag->Text3,\n\t\t\t$this->namedtag->Text4,\n\t\t\tnew IntTag(\"x\", (int) $this->x),\n\t\t\tnew IntTag(\"y\", (int) $this->y),\n\t\t\tnew IntTag(\"z\", (int) $this->z)\n\t\t]);\n\t}\n\n\tpublic function updateCompoundTag(CompoundTag $nbt, Player $player) : bool{\n\t\tif($nbt[\"id\"] !== Tile::SIGN){\n\t\t\treturn false;\n\t\t}\n\n\t\t$ev = new SignChangeEvent($this->getBlock(), $player, [\n\t\t\tTextFormat::clean($nbt[\"Text1\"], ($removeFormat = $player->getRemoveFormat())),\n\t\t\tTextFormat::clean($nbt[\"Text2\"], $removeFormat),\n\t\t\tTextFormat::clean($nbt[\"Text3\"], $removeFormat),\n\t\t\tTextFormat::clean($nbt[\"Text4\"], $removeFormat)\n\t\t]);\n\n\t\tif(!isset($this->namedtag->Creator) or $this->namedtag[\"Creator\"] !== $player->getRawUniqueId()){\n\t\t\t$ev->setCancelled();\n\t\t}\n\n\t\t$this->level->getServer()->getPluginManager()->callEvent($ev);\n\n\t\tif(!$ev->isCancelled()){\n\t\t\t$this->setText(...$ev->getLines());\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Skull.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\tag\\{ByteTag, CompoundTag, IntTag, StringTag};\n\nclass Skull extends Spawnable{\n\n\tconst TYPE_SKELETON = 0;\n\tconst TYPE_WITHER = 1;\n\tconst TYPE_ZOMBIE = 2;\n\tconst TYPE_HUMAN = 3;\n\tconst TYPE_CREEPER = 4;\n\tconst TYPE_DRAGON = 5;\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif(!isset($nbt->SkullType) or !($nbt->SkullType instanceof ByteTag)){\n\t\t\t$nbt->SkullType = new ByteTag(\"SkullType\", self::TYPE_SKELETON);\n\t\t}\n\t\tif(!isset($nbt->Rot) or !($nbt->Rot instanceof ByteTag)) {\n\t\t\t$nbt->Rot = new ByteTag(\"Rot\", 0);\n\t\t}\n\t\tparent::__construct($chunk, $nbt);\n\t}\n\n\tpublic function setType(int $type){\n\t\tif($type >= 0 && $type <= 4){\n\t\t\t$this->namedtag->SkullType = new ByteTag(\"SkullType\", $type);\n\t\t\t$this->onChanged();\n\t\t\treturn true;\n\t\t}\n\t\treturn false;\n\t}\n\n\tpublic function getType() {\n\t\treturn $this->namedtag[\"SkullType\"];\n\t}\n\n\tpublic function saveNBT(){\n\t\tparent::saveNBT();\n\t\tunset($this->namedtag->Creator);\n\t}\n\n\tpublic function getSpawnCompound(){\n\t\treturn new CompoundTag(\"\", [\n\t\t\tnew StringTag(\"id\", Tile::SKULL),\n\t\t\t$this->namedtag->SkullType,\n\t\t\t$this->namedtag->Rot,\n\t\t\tnew IntTag(\"x\", (int)$this->x),\n\t\t\tnew IntTag(\"y\", (int)$this->y),\n\t\t\tnew IntTag(\"z\", (int)$this->z),\n\t\t]);\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Spawnable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\tile;\n\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\nbt\\NBT;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\network\\protocol\\BlockEntityDataPacket;\nuse pocketmine\\Player;\n\nabstract class Spawnable extends Tile{\n\n\tpublic function spawnTo(Player $player){\n\t\tif($this->closed){\n\t\t\treturn false;\n\t\t}\n\n\t\t$nbt = new NBT(NBT::LITTLE_ENDIAN);\n\t\t$nbt->setData($this->getSpawnCompound());\n\t\t$pk = new BlockEntityDataPacket();\n\t\t$pk->x = $this->x;\n\t\t$pk->y = $this->y;\n\t\t$pk->z = $this->z;\n\t\t$pk->namedtag = $nbt->write(true);\n\t\t$player->dataPacket($pk);\n\n\t\treturn true;\n\t}\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tparent::__construct($chunk, $nbt);\n\t\t$this->spawnToAll();\n\t}\n\n\tpublic function spawnToAll(){\n\t\tif($this->closed){\n\t\t\treturn;\n\t\t}\n\n\t\tforeach($this->getLevel()->getChunkPlayers($this->chunk->getX(), $this->chunk->getZ()) as $player){\n\t\t\tif($player->spawned === true){\n\t\t\t\t$this->spawnTo($player);\n\t\t\t}\n\t\t}\n\t}\n\n\tprotected function onChanged(){\n\t\t$this->spawnToAll();\n\n\t\tif($this->chunk !== null){\n\t\t\t$this->chunk->setChanged();\n\t\t\t$this->level->clearChunkCache($this->chunk->getX(), $this->chunk->getZ());\n\t\t}\n\t}\n\n\t/**\n\t * @return CompoundTag\n\t */\n\tpublic abstract function getSpawnCompound();\n\n\t/**\n\t * Called when a player updates a block entity's NBT data\n\t * for example when writing on a sign.\n\t *\n\t * @param CompoundTag $nbt\n\t * @param Player      $player\n\t *\n\t * @return bool indication of success, will respawn the tile to the player if false.\n\t */\n\tpublic function updateCompoundTag(CompoundTag $nbt, Player $player) : bool{\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/tile/Tile.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * All the Tile classes and related classes\n */\nnamespace pocketmine\\tile;\n\nuse pocketmine\\event\\Timings;\nuse pocketmine\\level\\format\\Chunk;\nuse pocketmine\\level\\Level;\nuse pocketmine\\level\\Position;\nuse pocketmine\\nbt\\tag\\CompoundTag;\nuse pocketmine\\nbt\\tag\\IntTag;\nuse pocketmine\\nbt\\tag\\StringTag;\nuse pocketmine\\utils\\ChunkException;\n\nabstract class Tile extends Position{\n\t\n\tconst BREWING_STAND = \"BrewingStand\";\n\tconst CHEST = \"Chest\";\n\tconst ENCHANT_TABLE = \"EnchantTable\";\n\tconst FLOWER_POT = \"FlowerPot\";\n\tconst FURNACE = \"Furnace\";\n\tconst MOB_SPAWNER = \"MobSpawner\";\n\tconst SIGN = \"Sign\";\n\tconst SKULL = \"Skull\";\n\tconst ITEM_FRAME = \"ItemFrame\";\n\tconst DISPENSER = \"Dispenser\";\n\tconst DROPPER = \"Dropper\";\n\tconst DAY_LIGHT_DETECTOR = \"DLDetector\";\n\tconst CAULDRON = \"Cauldron\";\n\tconst HOPPER = \"Hopper\";\n\tconst BEACON = \"Beacon\";\n\tconst ENDER_CHEST = \"EnderChest\";\n\n\tpublic static $tileCount = 1;\n\n\tprivate static $knownTiles = [];\n\tprivate static $shortNames = [];\n\n\t/** @var Chunk */\n\tpublic $chunk;\n\tpublic $name;\n\tpublic $id;\n\tpublic $x;\n\tpublic $y;\n\tpublic $z;\n\tpublic $attach;\n\tpublic $metadata;\n\tpublic $closed = false;\n\tpublic $namedtag;\n\tprotected $lastUpdate;\n\tprotected $server;\n\tprotected $timings;\n\n\t/** @var \\pocketmine\\event\\TimingsHandler */\n\tpublic $tickTimer;\n\t\n\tpublic static function init(){\n\t\tself::registerTile(Beacon::class);\n\t\tself::registerTile(BrewingStand::class);\n\t\tself::registerTile(Cauldron::class);\n\t\tself::registerTile(Chest::class);\n\t\tself::registerTile(Dispenser::class);\n\t\tself::registerTile(DLDetector::class);\n\t\tself::registerTile(Dropper::class);\n\t\tself::registerTile(EnchantTable::class);\n\t\tself::registerTile(EnderChest::class);\n\t\tself::registerTile(FlowerPot::class);\n\t\tself::registerTile(Furnace::class);\n\t\tself::registerTile(Hopper::class);\n\t\tself::registerTile(ItemFrame::class);\n\t\tself::registerTile(MobSpawner::class);\n\t\tself::registerTile(Sign::class);\n\t\tself::registerTile(Skull::class);\n\t}\n\n\t/**\n\t * @param string    $type\n\t * @param Chunk $chunk\n\t * @param CompoundTag  $nbt\n\t * @param           $args\n\t *\n\t * @return Tile\n\t */\n\tpublic static function createTile($type, Chunk $chunk, CompoundTag $nbt, ...$args){\n\t\tif(isset(self::$knownTiles[$type])){\n\t\t\t$class = self::$knownTiles[$type];\n\t\t\treturn new $class($chunk, $nbt, ...$args);\n\t\t}\n\n\t\treturn null;\n\t}\n\n\t/**\n\t * @param $className\n\t *\n\t * @return bool\n\t */\n\tpublic static function registerTile($className){\n\t\t$class = new \\ReflectionClass($className);\n\t\tif(is_a($className, Tile::class, true) and !$class->isAbstract()){\n\t\t\tself::$knownTiles[$class->getShortName()] = $className;\n\t\t\tself::$shortNames[$className] = $class->getShortName();\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t * Returns the short save name\n\t *\n\t * @return string\n\t */\n\tpublic function getSaveId(){\n\t\treturn self::$shortNames[static::class];\n\t}\n\n\tpublic function __construct(Chunk $chunk, CompoundTag $nbt){\n\t\tif($chunk === null or $chunk->getProvider() === null){\n\t\t\tthrow new ChunkException(\"Invalid garbage Chunk given to Tile\");\n\t\t}\n\n\t\t$this->timings = Timings::getTileEntityTimings($this);\n\n\t\t$this->server = $chunk->getProvider()->getLevel()->getServer();\n\t\t$this->chunk = $chunk;\n\t\t$this->setLevel($chunk->getProvider()->getLevel());\n\t\t$this->namedtag = $nbt;\n\t\t$this->name = \"\";\n\t\t$this->lastUpdate = microtime(true);\n\t\t$this->id = Tile::$tileCount++;\n\t\t$this->x = (int) $this->namedtag[\"x\"];\n\t\t$this->y = (int) $this->namedtag[\"y\"];\n\t\t$this->z = (int) $this->namedtag[\"z\"];\n\n\t\t$this->chunk->addTile($this);\n\t\t$this->getLevel()->addTile($this);\n\t\t$this->tickTimer = Timings::getTileEntityTimings($this);\n\t}\n\n\tpublic function getId(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function saveNBT(){\n\t\t$this->namedtag->id = new StringTag(\"id\", $this->getSaveId());\n\t\t$this->namedtag->x = new IntTag(\"x\", $this->x);\n\t\t$this->namedtag->y = new IntTag(\"y\", $this->y);\n\t\t$this->namedtag->z = new IntTag(\"z\", $this->z);\n\t}\n\n\t/**\n\t * @return \\pocketmine\\block\\Block\n\t */\n\tpublic function getBlock(){\n\t\treturn $this->level->getBlock($this);\n\t}\n\n\tpublic function onUpdate(){\n\t\treturn false;\n\t}\n\n\tpublic final function scheduleUpdate(){\n\t\t$this->level->updateTiles[$this->id] = $this;\n\t}\n\n\tpublic function __destruct(){\n\t\t$this->close();\n\t}\n\n\tpublic function close(){\n\t\tif(!$this->closed){\n\t\t\t$this->closed = true;\n\t\t\tunset($this->level->updateTiles[$this->id]);\n\t\t\tif($this->chunk instanceof Chunk){\n\t\t\t\t$this->chunk->removeTile($this);\n\t\t\t}\n\t\t\tif(($level = $this->getLevel()) instanceof Level){\n\t\t\t\t$level->removeTile($this);\n\t\t\t}\n\t\t\t$this->level = null;\n\t\t}\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->name;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/utils/Binary.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\n/**\n * Various Utilities used around the code\n */\n \nnamespace pocketmine\\utils;\n\nuse pocketmine\\entity\\Entity;\nuse pocketmine\\item\\Item;\n\nclass Binary{\n\tconst BIG_ENDIAN = 0x00;\n\tconst LITTLE_ENDIAN = 0x01;\n\n\tprivate static function checkLength($str, $expect){\n\t\tassert(($len = strlen($str)) === $expect, \"Expected $expect bytes, got $len\");\n\t}\n\n\t/**\n\t * Reads a 3-byte big-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return mixed\n\t */\n\tpublic static function readTriad($str){\n\t\tself::checkLength($str, 3);\n\t\treturn unpack(\"N\", \"\\x00\" . $str)[1];\n\t}\n\n\t/**\n\t * Writes a 3-byte big-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeTriad($value){\n\t\treturn substr(pack(\"N\", $value), 1);\n\t}\n\n\t/**\n\t * Reads a 3-byte little-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return mixed\n\t */\n\tpublic static function readLTriad($str){\n\t\tself::checkLength($str, 3);\n\t\treturn unpack(\"V\", $str . \"\\x00\")[1];\n\t}\n\n\t/**\n\t * Writes a 3-byte little-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeLTriad($value){\n\t\treturn substr(pack(\"V\", $value), 0, -1);\n\t}\n\n\t/**\n\t * Writes a coded metadata string\n\t *\n\t * @param array $data\n\t *\n\t * @return string\n\t */\n\tpublic static function writeMetadata(array $data){\n\t\t$stream = new BinaryStream();\n\t\t$stream->putUnsignedVarInt(count($data));\n\t\tforeach($data as $key => $d){\n\t\t\t$stream->putUnsignedVarInt($key); //data key\n\t\t\t$stream->putUnsignedVarInt($d[0]); //data type\n\t\t\tswitch($d[0]){\n\t\t\t\tcase Entity::DATA_TYPE_BYTE:\n\t\t\t\t\t$stream->putByte($d[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_SHORT:\n\t\t\t\t\t$stream->putLShort($d[1]); //SIGNED short!\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_INT:\n\t\t\t\t\t$stream->putVarInt($d[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_FLOAT:\n\t\t\t\t\t$stream->putLFloat($d[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_STRING:\n\t\t\t\t\t$stream->putString($d[1]);\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_SLOT:\n\t\t\t\t\t//TODO: change this implementation (use objects)\n\t\t\t\t\t$stream->putSlot(Item::get($d[1][0], $d[1][2], $d[1][1])); //ID, damage, count\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_POS:\n\t\t\t\t\t//TODO: change this implementation (use objects)\n\t\t\t\t\t$stream->putVarInt($d[1][0]); //x\n\t\t\t\t\t$stream->putVarInt($d[1][1]); //y (SIGNED)\n\t\t\t\t\t$stream->putVarInt($d[1][2]); //z\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_LONG:\n\t\t\t\t\t$stream->putVarInt($d[1]); //TODO: varint64 support\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_VECTOR3F:\n\t\t\t\t\t//TODO: change this implementation (use objects)\n\t\t\t\t\t$stream->putVector3f($d[1][0], $d[1][1], $d[1][2]); //x, y, z\n\t\t\t}\n\t\t}\n\n\t\treturn $stream->getBuffer();\n\t}\n\n\t/**\n\t * Reads a metadata coded string\n\t *\n\t * @param      $value\n\t * @param bool $types\n\t *\n\t * @return array\n\t */\n\tpublic static function readMetadata($value, $types = false){\n\t\t$stream = new BinaryStream();\n\t\t$stream->setBuffer($value);\n\t\t$count = $stream->getUnsignedVarInt();\n\t\t$data = [];\n\t\tfor($i = 0; $i < $count; ++$i){\n\t\t\t$key = $stream->getUnsignedVarInt();\n\t\t\t$type = $stream->getUnsignedVarInt();\n\t\t\t$value = null;\n\t\t\tswitch($type){\n\t\t\t\tcase Entity::DATA_TYPE_BYTE:\n\t\t\t\t\t$value = $stream->getByte();\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_SHORT:\n\t\t\t\t\t$value = $stream->getLShort(true); //signed\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_INT:\n\t\t\t\t\t$value = $stream->getVarInt();\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_FLOAT:\n\t\t\t\t\t$value = $stream->getLFloat();\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_STRING:\n\t\t\t\t\t$value = $stream->getString();\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_SLOT:\n\t\t\t\t\t//TODO: use objects directly\n\t\t\t\t\t$value = [];\n\t\t\t\t\t$item = $stream->getSlot();\n\t\t\t\t\t$value[0] = $item->getId();\n\t\t\t\t\t$value[1] = $item->getCount();\n\t\t\t\t\t$value[2] = $item->getDamage();\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_POS:\n\t\t\t\t\t$value = [];\n\t\t\t\t\t$value[0] = $stream->getVarInt(); //x\n\t\t\t\t\t$value[1] = $stream->getVarInt(); //y (SIGNED)\n\t\t\t\t\t$value[2] = $stream->getVarInt(); //z\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_LONG:\n\t\t\t\t\t$value = $stream->getVarInt(); //TODO: varint64 proper support\n\t\t\t\t\tbreak;\n\t\t\t\tcase Entity::DATA_TYPE_VECTOR3F:\n\t\t\t\t\t$value = [0.0, 0.0, 0.0];\n\t\t\t\t\t$stream->getVector3f($value[0], $value[1], $value[2]);\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$value = [];\n\t\t\t}\n\t\t\tif($types === true){\n\t\t\t\t$data[$key] = [$value, $type];\n\t\t\t}else{\n\t\t\t\t$data[$key] = $value;\n\t\t\t}\n\t\t}\n\n\t\treturn $data;\n\t}\n\n\t/**\n\t * Reads a byte boolean\n\t *\n\t * @param $b\n\t *\n\t * @return bool\n\t */\n\tpublic static function readBool($b){\n\t\treturn self::readByte($b, false) === 0 ? false : true;\n\t}\n\n\t/**\n\t * Writes a byte boolean\n\t *\n\t * @param $b\n\t *\n\t * @return bool|string\n\t */\n\tpublic static function writeBool($b){\n\t\treturn self::writeByte($b === true ? 1 : 0);\n\t}\n\n\t/**\n\t * Reads an unsigned/signed byte\n\t *\n\t * @param string $c\n\t * @param bool   $signed\n\t *\n\t * @return int\n\t */\n\tpublic static function readByte($c, $signed = true){\n\t\tself::checkLength($c, 1);\n\t\t$b = ord($c{0});\n\n\t\tif($signed){\n\t\t\tif(PHP_INT_SIZE === 8){\n\t\t\t\treturn $b << 56 >> 56;\n\t\t\t}else{\n\t\t\t\treturn $b << 24 >> 24;\n\t\t\t}\n\t\t}else{\n\t\t\treturn $b;\n\t\t}\n\t}\n\n\t/**\n\t * Writes an unsigned/signed byte\n\t *\n\t * @param $c\n\t *\n\t * @return string\n\t */\n\tpublic static function writeByte($c){\n\t\treturn chr($c);\n\t}\n\n\t/**\n\t * Reads a 16-bit unsigned big-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return int\n\t */\n\tpublic static function readShort($str){\n\t\tself::checkLength($str, 2);\n\t\treturn unpack(\"n\", $str)[1];\n\t}\n\n\t/**\n\t * Reads a 16-bit signed big-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return int\n\t */\n\tpublic static function readSignedShort($str){\n\t\tself::checkLength($str, 2);\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn unpack(\"n\", $str)[1] << 48 >> 48;\n\t\t}else{\n\t\t\treturn unpack(\"n\", $str)[1] << 16 >> 16;\n\t\t}\n\t}\n\n\t/**\n\t * Writes a 16-bit signed/unsigned big-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeShort($value){\n\t\treturn pack(\"n\", $value);\n\t}\n\n\t/**\n\t * Reads a 16-bit unsigned little-endian number\n\t *\n\t * @param      $str\n\t *\n\t * @return int\n\t */\n\tpublic static function readLShort($str){\n\t\tself::checkLength($str, 2);\n\t\treturn unpack(\"v\", $str)[1];\n\t}\n\n\t/**\n\t * Reads a 16-bit signed little-endian number\n\t *\n\t * @param      $str\n\t *\n\t * @return int\n\t */\n\tpublic static function readSignedLShort($str){\n\t\tself::checkLength($str, 2);\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn unpack(\"v\", $str)[1] << 48 >> 48;\n\t\t}else{\n\t\t\treturn unpack(\"v\", $str)[1] << 16 >> 16;\n\t\t}\n\t}\n\n\t/**\n\t * Writes a 16-bit signed/unsigned little-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeLShort($value){\n\t\treturn pack(\"v\", $value);\n\t}\n\n\tpublic static function readInt($str){\n\t\tself::checkLength($str, 4);\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn unpack(\"N\", $str)[1] << 32 >> 32;\n\t\t}else{\n\t\t\treturn unpack(\"N\", $str)[1];\n\t\t}\n\t}\n\n\tpublic static function writeInt($value){\n\t\treturn pack(\"N\", $value);\n\t}\n\n\tpublic static function readLInt($str){\n\t\tself::checkLength($str, 4);\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn unpack(\"V\", $str)[1] << 32 >> 32;\n\t\t}else{\n\t\t\treturn unpack(\"V\", $str)[1];\n\t\t}\n\t}\n\n\tpublic static function writeLInt($value){\n\t\treturn pack(\"V\", $value);\n\t}\n\n\tpublic static function readFloat($str, int $accuracy = -1){\n\t\tself::checkLength($str, 4);\n\t\t$value = ENDIANNESS === self::BIG_ENDIAN ? unpack(\"f\", $str)[1] : unpack(\"f\", strrev($str))[1];\n\t\tif($accuracy > -1){\n\t\t\treturn round($value, $accuracy);\n\t\t}else{\n\t\t\treturn $value;\n\t\t}\n\t}\n\n\tpublic static function writeFloat($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? pack(\"f\", $value) : strrev(pack(\"f\", $value));\n\t}\n\n\tpublic static function readLFloat($str, int $accuracy = -1){\n\t\tself::checkLength($str, 4);\n\t\t$value = ENDIANNESS === self::BIG_ENDIAN ? unpack(\"f\", strrev($str))[1] : unpack(\"f\", $str)[1];\n\t\tif($accuracy > -1){\n\t\t\treturn round($value, $accuracy);\n\t\t}else{\n\t\t\treturn $value;\n\t\t}\n\t}\n\n\tpublic static function writeLFloat($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? strrev(pack(\"f\", $value)) : pack(\"f\", $value);\n\t}\n\n\tpublic static function printFloat($value){\n\t\treturn preg_replace(\"/(\\\\.\\\\d+?)0+$/\", \"$1\", sprintf(\"%F\", $value));\n\t}\n\n\tpublic static function readDouble($str){\n\t\tself::checkLength($str, 8);\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? unpack(\"d\", $str)[1] : unpack(\"d\", strrev($str))[1];\n\t}\n\n\tpublic static function writeDouble($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? pack(\"d\", $value) : strrev(pack(\"d\", $value));\n\t}\n\n\tpublic static function readLDouble($str){\n\t\tself::checkLength($str, 8);\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? unpack(\"d\", strrev($str))[1] : unpack(\"d\", $str)[1];\n\t}\n\n\tpublic static function writeLDouble($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? strrev(pack(\"d\", $value)) : pack(\"d\", $value);\n\t}\n\n\tpublic static function readLong($x){\n\t\tself::checkLength($x, 8);\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\t$int = unpack(\"N*\", $x);\n\t\t\treturn ($int[1] << 32) | $int[2];\n\t\t}else{\n\t\t\t$value = \"0\";\n\t\t\tfor($i = 0; $i < 8; $i += 2){\n\t\t\t\t$value = bcmul($value, \"65536\", 0);\n\t\t\t\t$value = bcadd($value, self::readShort(substr($x, $i, 2)), 0);\n\t\t\t}\n\n\t\t\tif(bccomp($value, \"9223372036854775807\") == 1){\n\t\t\t\t$value = bcadd($value, \"-18446744073709551616\");\n\t\t\t}\n\n\t\t\treturn $value;\n\t\t}\n\t}\n\n\tpublic static function writeLong($value){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn pack(\"NN\", $value >> 32, $value & 0xFFFFFFFF);\n\t\t}else{\n\t\t\t$x = \"\";\n\n\t\t\tif(bccomp($value, \"0\") == -1){\n\t\t\t\t$value = bcadd($value, \"18446744073709551616\");\n\t\t\t}\n\n\t\t\t$x .= self::writeShort(bcmod(bcdiv($value, \"281474976710656\"), \"65536\"));\n\t\t\t$x .= self::writeShort(bcmod(bcdiv($value, \"4294967296\"), \"65536\"));\n\t\t\t$x .= self::writeShort(bcmod(bcdiv($value, \"65536\"), \"65536\"));\n\t\t\t$x .= self::writeShort(bcmod($value, \"65536\"));\n\n\t\t\treturn $x;\n\t\t}\n\t}\n\n\tpublic static function readLLong($str){\n\t\treturn self::readLong(strrev($str));\n\t}\n\n\tpublic static function writeLLong($value){\n\t\treturn strrev(self::writeLong($value));\n\t}\n\n\t//TODO: proper varlong support\n\n\tpublic static function readVarInt($stream){\n\t\t$shift = PHP_INT_SIZE === 8 ? 63 : 31;\n\t\t$raw = self::readUnsignedVarInt($stream);\n\t\t$temp = ((($raw << $shift) >> $shift) ^ $raw) >> 1;\n\t\treturn $temp ^ ($raw & (1 << $shift));\n\t}\n\n\tpublic static function readUnsignedVarInt($stream){\n\t\t$value = 0;\n\t\t$i = 0;\n\t\tdo{\n\t\t\tif($i > 63){\n\t\t\t\tthrow new \\InvalidArgumentException(\"Varint did not terminate after 10 bytes!\");\n\t\t\t}\n\t\t\t$value |= ((($b = $stream->getByte()) & 0x7f) << $i);\n\t\t\t$i += 7;\n\t\t}while($b & 0x80);\n\n\t\treturn $value;\n\t}\n\n\tpublic static function writeVarInt($v){\n\t\treturn self::writeUnsignedVarInt(($v << 1) ^ ($v >> (PHP_INT_SIZE === 8 ? 63 : 31)));\n\t}\n\n\tpublic static function writeUnsignedVarInt($value){\n\t\t$buf = \"\";\n\t\tfor($i = 0; $i < 10; ++$i){\n\t\t\tif(($value >> 7) !== 0){\n\t\t\t\t$buf .= chr($value | 0x80); //Let chr() take the last byte of this, it's faster than adding another & 0x7f.\n\t\t\t}else{\n\t\t\t\t$buf .= chr($value & 0x7f);\n\t\t\t\treturn $buf;\n\t\t\t}\n\n\t\t\t$value = (($value >> 7) & (PHP_INT_MAX >> 6)); //PHP really needs a logical right-shift operator\n\t\t}\n\n\t\tthrow new \\InvalidArgumentException(\"Value too large to be encoded as a varint\");\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/utils/BinaryStream.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\utils;\n\n#include <rules/DataPacket.h>\n#ifndef COMPILE\n#endif\n\nuse pocketmine\\item\\Item;\n\nclass BinaryStream extends \\stdClass{\n\n\tpublic $offset;\n\tpublic $buffer;\n\n\tpublic function __construct($buffer = \"\", $offset = 0){\n\t\t$this->buffer = $buffer;\n\t\t$this->offset = $offset;\n\t}\n\n\tpublic function reset(){\n\t\t$this->buffer = \"\";\n\t\t$this->offset = 0;\n\t}\n\n\tpublic function setBuffer($buffer = null, $offset = 0){\n\t\t$this->buffer = $buffer;\n\t\t$this->offset = (int) $offset;\n\t}\n\n\tpublic function getOffset(){\n\t\treturn $this->offset;\n\t}\n\n\tpublic function getBuffer(){\n\t\treturn $this->buffer;\n\t}\n\n\tpublic function get($len){\n\t\tif($len < 0){\n\t\t\t$this->offset = strlen($this->buffer) - 1;\n\t\t\treturn \"\";\n\t\t}elseif($len === true){\n\t\t\t$str = substr($this->buffer, $this->offset);\n\t\t\t$this->offset = strlen($this->buffer);\n\t\t\treturn $str;\n\t\t}\n\t\treturn $len === 1 ? $this->buffer{$this->offset++} : substr($this->buffer, ($this->offset += $len) - $len, $len);\n\t}\n\n\tpublic function put($str){\n\t\t$this->buffer .= $str;\n\t}\n\n\tpublic function getBool() : bool{\n\t\treturn (bool) $this->getByte();\n\t}\n\n\tpublic function putBool($v){\n\t\t$this->putByte((bool) $v);\n\t}\n\n\tpublic function getLong(){\n\t\treturn Binary::readLong($this->get(8));\n\t}\n\n\tpublic function putLong($v){\n\t\t$this->buffer .= Binary::writeLong($v);\n\t}\n\n\tpublic function getInt(){\n\t\treturn Binary::readInt($this->get(4));\n\t}\n\n\tpublic function putInt($v){\n\t\t$this->buffer .= Binary::writeInt($v);\n\t}\n\n\tpublic function getLLong(){\n\t\treturn Binary::readLLong($this->get(8));\n\t}\n\n\tpublic function putLLong($v){\n\t\t$this->buffer .= Binary::writeLLong($v);\n\t}\n\n\tpublic function getLInt(){\n\t\treturn Binary::readLInt($this->get(4));\n\t}\n\n\tpublic function putLInt($v){\n\t\t$this->buffer .= Binary::writeLInt($v);\n\t}\n\n\tpublic function getSignedShort(){\n\t\treturn Binary::readSignedShort($this->get(2));\n\t}\n\n\tpublic function putShort($v){\n\t\t$this->buffer .= Binary::writeShort($v);\n\t}\n\n\tpublic function getShort(){\n\t\treturn Binary::readShort($this->get(2));\n\t}\n\n\tpublic function putSignedShort($v){\n\t\t$this->buffer .= Binary::writeShort($v);\n\t}\n\n\tpublic function getFloat(int $accuracy = -1){\n\t\treturn Binary::readFloat($this->get(4), $accuracy);\n\t}\n\n\tpublic function putFloat($v){\n\t\t$this->buffer .= Binary::writeFloat($v);\n\t}\n\n\tpublic function getLShort($signed = true){\n\t\treturn $signed ? Binary::readSignedLShort($this->get(2)) : Binary::readLShort($this->get(2));\n\t}\n\n\tpublic function putLShort($v){\n\t\t$this->buffer .= Binary::writeLShort($v);\n\t}\n\n\tpublic function getLFloat(int $accuracy = -1){\n\t\treturn Binary::readLFloat($this->get(4), $accuracy);\n\t}\n\n\tpublic function putLFloat($v){\n\t\t$this->buffer .= Binary::writeLFloat($v);\n\t}\n\n\tpublic function getTriad(){\n\t\treturn Binary::readTriad($this->get(3));\n\t}\n\n\tpublic function putTriad($v){\n\t\t$this->buffer .= Binary::writeTriad($v);\n\t}\n\n\tpublic function getLTriad(){\n\t\treturn Binary::readLTriad($this->get(3));\n\t}\n\n\tpublic function putLTriad($v){\n\t\t$this->buffer .= Binary::writeLTriad($v);\n\t}\n\n\tpublic function getByte(){\n\t\treturn ord($this->buffer{$this->offset++});\n\t}\n\n\tpublic function putByte($v){\n\t\t$this->buffer .= chr($v);\n\t}\n\n\tpublic function getDataArray($len = 10){\n\t\t$data = [];\n\t\tfor($i = 1; $i <= $len and !$this->feof(); ++$i){\n\t\t\t$data[] = $this->get($this->getTriad());\n\t\t}\n\t\treturn $data;\n\t}\n\n\tpublic function putDataArray(array $data = []){\n\t\tforeach($data as $v){\n\t\t\t$this->putTriad(strlen($v));\n\t\t\t$this->put($v);\n\t\t}\n\t}\n\n\tpublic function getUUID(){\n\t\treturn UUID::fromBinary($this->get(16));\n\t}\n\n\tpublic function putUUID(UUID $uuid){\n\t\t$this->put($uuid->toBinary());\n\t}\n\n\tpublic function getSlot(){\n\t\t$id = $this->getVarInt();\n\n\t\tif($id <= 0){\n\t\t\treturn Item::get(0, 0, 0);\n\t\t}\n\t\t$auxValue = $this->getVarInt();\n\t\t$data = $auxValue >> 8;\n\t\t$cnt = $auxValue & 0xff;\n\n\t\t$nbtLen = $this->getLShort();\n\t\t$nbt = \"\";\n\n\t\tif($nbtLen > 0){\n\t\t\t$nbt = $this->get($nbtLen);\n\t\t}\n\t\treturn Item::get(\n\t\t\t$id,\n\t\t\t$data,\n\t\t\t$cnt,\n\t\t\t$nbt\n\t\t);\n\t}\n\n\n\tpublic function putSlot(Item $item){\n\t\tif($item->getId() === 0){\n\t\t\t$this->putVarInt(0);\n\t\t\treturn;\n\t\t}\n\n\t\t$this->putVarInt($item->getId());\n\t\t$auxValue = (($item->getDamage() ?? -1) << 8) | $item->getCount();\n\t\t$this->putVarInt($auxValue);\n\t\t$nbt = $item->getCompoundTag();\n\t\t$this->putLShort(strlen($nbt));\n\t\t$this->put($nbt);\n\t}\n\n\tpublic function getString(){\n\t\treturn $this->get($this->getUnsignedVarInt());\n\t}\n\n\tpublic function putString($v){\n\t\t$this->putUnsignedVarInt(strlen($v));\n\t\t$this->put($v);\n\t}\n\n\t//TODO: varint64\n\n\t/**\n\t * Reads an unsigned varint32 from the stream.\n\t */\n\tpublic function getUnsignedVarInt(){\n\t\treturn Binary::readUnsignedVarInt($this);\n\t}\n\n\t/**\n\t * Writes an unsigned varint32 to the stream.\n\t */\n\tpublic function putUnsignedVarInt($v){\n\t\t$this->put(Binary::writeUnsignedVarInt($v));\n\t}\n\n\t/**\n\t * Reads a signed varint32 from the stream.\n\t */\n\tpublic function getVarInt(){\n\t\treturn Binary::readVarInt($this);\n\t}\n\n\t/**\n\t * Writes a signed varint32 to the stream.\n\t */\n\tpublic function putVarInt($v){\n\t\t$this->put(Binary::writeVarInt($v));\n\t}\n\n\tpublic function getEntityId(){\n\t\treturn $this->getVarInt();\n\t}\n\t\n\tpublic function putEntityId($v){\n\t\t$this->putVarInt($v);\n\t}\n\n\tpublic function getBlockCoords(&$x, &$y, &$z){\n\t\t$x = $this->getVarInt();\n\t\t$y = $this->getUnsignedVarInt();\n\t\t$z = $this->getVarInt();\n\t}\n\n\tpublic function putBlockCoords($x, $y, $z){\n\t\t$this->putVarInt($x);\n\t\t$this->putUnsignedVarInt($y);\n\t\t$this->putVarInt($z);\n\t}\n\t\n\tpublic function getVector3f(&$x, &$y, &$z){\n\t\t$x = $this->getLFloat(4);\n\t\t$y = $this->getLFloat(4);\n\t\t$z = $this->getLFloat(4);\n\t}\n\t\n\tpublic function putVector3f($x, $y, $z){\n\t\t$this->putLFloat($x);\n\t\t$this->putLFloat($y);\n\t\t$this->putLFloat($z);\n\t}\n\n\tpublic function feof(){\n\t\treturn !isset($this->buffer{$this->offset});\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/utils/BlockIterator.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\n\n/**\n * This class performs ray tracing and iterates along blocks on a line\n */\nclass BlockIterator implements \\Iterator{\n\n\t/** @var Level */\n\tprivate $level;\n\tprivate $maxDistance;\n\n\tprivate static $gridSize = 16777216; //1 << 24\n\n\tprivate $end = false;\n\n\t/** @var \\SplFixedArray<Block>[3] */\n\tprivate $blockQueue;\n\tprivate $currentBlock = 0;\n\t/** @var Block */\n\tprivate $currentBlockObject = null;\n\tprivate $currentDistance = 0;\n\tprivate $maxDistanceInt = 0;\n\n\tprivate $secondError;\n\tprivate $thirdError;\n\n\tprivate $secondStep;\n\tprivate $thirdStep;\n\n\tprivate $mainFace;\n\tprivate $secondFace;\n\tprivate $thirdFace;\n\n\tpublic function __construct(Level $level, Vector3 $start, Vector3 $direction, $yOffset = 0, $maxDistance = 0){\n\t\t$this->level = $level;\n\t\t$this->maxDistance = (int) $maxDistance;\n\t\t$this->blockQueue = new \\SplFixedArray(3);\n\n\t\t$startClone = new Vector3($start->x, $start->y, $start->z);\n\t\t$startClone->y += $yOffset;\n\n\t\t$this->currentDistance = 0;\n\n\t\t$mainDirection = 0;\n\t\t$secondDirection = 0;\n\t\t$thirdDirection = 0;\n\n\t\t$mainPosition = 0;\n\t\t$secondPosition = 0;\n\t\t$thirdPosition = 0;\n\n\t\t$pos = new Vector3($startClone->x, $startClone->y, $startClone->z);\n\t\t$startBlock = $this->level->getBlock(new Vector3(floor($pos->x), floor($pos->y), floor($pos->z)));\n\n\t\tif($this->getXLength($direction) > $mainDirection){\n\t\t\t$this->mainFace = $this->getXFace($direction);\n\t\t\t$mainDirection = $this->getXLength($direction);\n\t\t\t$mainPosition = $this->getXPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->secondFace = $this->getYFace($direction);\n\t\t\t$secondDirection = $this->getYLength($direction);\n\t\t\t$secondPosition = $this->getYPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->thirdFace = $this->getZFace($direction);\n\t\t\t$thirdDirection = $this->getZLength($direction);\n\t\t\t$thirdPosition = $this->getZPosition($direction, $startClone, $startBlock);\n\t\t}\n\t\tif($this->getYLength($direction) > $mainDirection){\n\t\t\t$this->mainFace = $this->getYFace($direction);\n\t\t\t$mainDirection = $this->getYLength($direction);\n\t\t\t$mainPosition = $this->getYPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->secondFace = $this->getZFace($direction);\n\t\t\t$secondDirection = $this->getZLength($direction);\n\t\t\t$secondPosition = $this->getZPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->thirdFace = $this->getXFace($direction);\n\t\t\t$thirdDirection = $this->getXLength($direction);\n\t\t\t$thirdPosition = $this->getXPosition($direction, $startClone, $startBlock);\n\t\t}\n\t\tif($this->getZLength($direction) > $mainDirection){\n\t\t\t$this->mainFace = $this->getZFace($direction);\n\t\t\t$mainDirection = $this->getZLength($direction);\n\t\t\t$mainPosition = $this->getZPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->secondFace = $this->getXFace($direction);\n\t\t\t$secondDirection = $this->getXLength($direction);\n\t\t\t$secondPosition = $this->getXPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->thirdFace = $this->getYFace($direction);\n\t\t\t$thirdDirection = $this->getYLength($direction);\n\t\t\t$thirdPosition = $this->getYPosition($direction, $startClone, $startBlock);\n\t\t}\n\n\t\t$d = $mainPosition / $mainDirection;\n\t\t$secondd = $secondPosition - $secondDirection * $d;\n\t\t$thirdd = $thirdPosition - $thirdDirection * $d;\n\n\t\t$this->secondError = floor($secondd * self::$gridSize);\n\t\t$this->secondStep = round($secondDirection / $mainDirection * self::$gridSize);\n\t\t$this->thirdError = floor($thirdd * self::$gridSize);\n\t\t$this->thirdStep = round($thirdDirection / $mainDirection * self::$gridSize);\n\n\t\tif($this->secondError + $this->secondStep <= 0){\n\t\t\t$this->secondError = -$this->secondStep + 1;\n\t\t}\n\n\t\tif($this->thirdError + $this->thirdStep <= 0){\n\t\t\t$this->thirdError = -$this->thirdStep + 1;\n\t\t}\n\n\t\t$lastBlock = $startBlock->getSide(Vector3::getOppositeSide($this->mainFace));\n\n\t\tif($this->secondError < 0){\n\t\t\t$this->secondError += self::$gridSize;\n\t\t\t$lastBlock = $lastBlock->getSide(Vector3::getOppositeSide($this->secondFace));\n\t\t}\n\n\t\tif($this->thirdError < 0){\n\t\t\t$this->thirdError += self::$gridSize;\n\t\t\t$lastBlock = $lastBlock->getSide(Vector3::getOppositeSide($this->thirdFace));\n\t\t}\n\n\t\t$this->secondError -= self::$gridSize;\n\t\t$this->thirdError -= self::$gridSize;\n\n\t\t$this->blockQueue[0] = $lastBlock;\n\n\t\t$this->currentBlock = -1;\n\n\t\t$this->scan();\n\n\t\t$startBlockFound = false;\n\n\t\tfor($cnt = $this->currentBlock; $cnt >= 0; --$cnt){\n\t\t\tif($this->blockEquals($this->blockQueue[$cnt], $startBlock)){\n\t\t\t\t$this->currentBlock = $cnt;\n\t\t\t\t$startBlockFound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!$startBlockFound){\n\t\t\tthrow new \\InvalidStateException(\"Start block missed in BlockIterator\");\n\t\t}\n\n\t\t$this->maxDistanceInt = round($maxDistance / (sqrt($mainDirection ** 2 + $secondDirection ** 2 + $thirdDirection ** 2) / $mainDirection));\n\t}\n\n\tprivate function blockEquals(Block $a, Block $b){\n\t\treturn $a->x === $b->x and $a->y === $b->y and $a->z === $b->z;\n\t}\n\n\tprivate function getXFace(Vector3 $direction){\n\t\treturn (($direction->x) > 0) ? Vector3::SIDE_EAST : Vector3::SIDE_WEST;\n\t}\n\n\tprivate function getYFace(Vector3 $direction){\n\t\treturn (($direction->y) > 0) ? Vector3::SIDE_UP : Vector3::SIDE_DOWN;\n\t}\n\n\tprivate function getZFace(Vector3 $direction){\n\t\treturn (($direction->z) > 0) ? Vector3::SIDE_SOUTH : Vector3::SIDE_NORTH;\n\t}\n\n\tprivate function getXLength(Vector3 $direction){\n\t\treturn abs($direction->x);\n\t}\n\n\tprivate function getYLength(Vector3 $direction){\n\t\treturn abs($direction->y);\n\t}\n\n\tprivate function getZLength(Vector3 $direction){\n\t\treturn abs($direction->z);\n\t}\n\n\tprivate function getPosition($direction, $position, $blockPosition){\n\t\treturn $direction > 0 ? ($position - $blockPosition) : ($blockPosition + 1 - $position);\n\t}\n\n\tprivate function getXPosition(Vector3 $direction, Vector3 $position, Block $block){\n\t\treturn $this->getPosition($direction->x, $position->x, $block->x);\n\t}\n\n\tprivate function getYPosition(Vector3 $direction, Vector3 $position, Block $block){\n\t\treturn $this->getPosition($direction->y, $position->y, $block->y);\n\t}\n\n\tprivate function getZPosition(Vector3 $direction, Vector3 $position, Block $block){\n\t\treturn $this->getPosition($direction->z, $position->z, $block->z);\n\t}\n\n\tpublic function next(){\n\t\t$this->scan();\n\n\t\tif($this->currentBlock <= -1){\n\t\t\tthrow new \\OutOfBoundsException;\n\t\t}else{\n\t\t\t$this->currentBlockObject = $this->blockQueue[$this->currentBlock--];\n\t\t}\n\t}\n\n\t/**\n\t * @return Block\n\t *\n\t * @throws \\OutOfBoundsException\n\t */\n\tpublic function current(){\n\t\tif($this->currentBlockObject === null){\n\t\t\tthrow new \\OutOfBoundsException;\n\t\t}\n\t\treturn $this->currentBlockObject;\n\t}\n\n\tpublic function rewind(){\n\t\tthrow new \\InvalidStateException(\"BlockIterator doesn't support rewind()\");\n\t}\n\n\tpublic function key(){\n\t\treturn $this->currentBlock - 1;\n\t}\n\n\tpublic function valid(){\n\t\t$this->scan();\n\t\treturn $this->currentBlock !== -1;\n\t}\n\n\tprivate function scan(){\n\t\tif($this->currentBlock >= 0){\n\t\t\treturn;\n\t\t}\n\n\t\tif($this->maxDistance !== 0 and $this->currentDistance > $this->maxDistanceInt){\n\t\t\t$this->end = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif($this->end){\n\t\t\treturn;\n\t\t}\n\n\t\t++$this->currentDistance;\n\n\t\t$this->secondError += $this->secondStep;\n\t\t$this->thirdError += $this->thirdStep;\n\n\t\tif($this->secondError > 0 and $this->thirdError > 0){\n\t\t\t$this->blockQueue[2] = $this->blockQueue[0]->getSide($this->mainFace);\n\n\t\t\tif(($this->secondStep * $this->thirdError) < ($this->thirdStep * $this->secondError)){\n\t\t\t\t$this->blockQueue[1] = $this->blockQueue[2]->getSide($this->secondFace);\n\t\t\t\t$this->blockQueue[0] = $this->blockQueue[1]->getSide($this->thirdFace);\n\t\t\t}else{\n\t\t\t\t$this->blockQueue[1] = $this->blockQueue[2]->getSide($this->thirdFace);\n\t\t\t\t$this->blockQueue[0] = $this->blockQueue[1]->getSide($this->secondFace);\n\t\t\t}\n\n\t\t\t$this->thirdError -= self::$gridSize;\n\t\t\t$this->secondError -= self::$gridSize;\n\t\t\t$this->currentBlock = 2;\n\t\t}elseif($this->secondError > 0){\n\t\t\t$this->blockQueue[1] = $this->blockQueue[0]->getSide($this->mainFace);\n\t\t\t$this->blockQueue[0] = $this->blockQueue[1]->getSide($this->secondFace);\n\t\t\t$this->secondError -= self::$gridSize;\n\t\t\t$this->currentBlock = 1;\n\t\t}elseif($this->thirdError > 0){\n\t\t\t$this->blockQueue[1] = $this->blockQueue[0]->getSide($this->mainFace);\n\t\t\t$this->blockQueue[0] = $this->blockQueue[1]->getSide($this->thirdFace);\n\t\t\t$this->thirdError -= self::$gridSize;\n\t\t\t$this->currentBlock = 1;\n\t\t}else{\n\t\t\t$this->blockQueue[0] = $this->blockQueue[0]->getSide($this->mainFace);\n\t\t\t$this->currentBlock = 0;\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/utils/ChunkException.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nclass ChunkException extends \\RuntimeException{\n\n}"
  },
  {
    "path": "src/pocketmine/utils/Color.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\n/*\n* Copied from @beito123's FlowerPot plugin\n */\n\nnamespace pocketmine\\utils;\n\nclass Color {\n\n\tconst COLOR_DYE_BLACK = 0;//dye colors\n\tconst COLOR_DYE_RED = 1;\n\tconst COLOR_DYE_GREEN = 2;\n\tconst COLOR_DYE_BROWN = 3;\n\tconst COLOR_DYE_BLUE = 4;\n\tconst COLOR_DYE_PURPLE = 5;\n\tconst COLOR_DYE_CYAN = 6;\n\tconst COLOR_DYE_LIGHT_GRAY = 7;\n\tconst COLOR_DYE_GRAY = 8;\n\tconst COLOR_DYE_PINK = 9;\n\tconst COLOR_DYE_LIME = 10;\n\tconst COLOR_DYE_YELLOW = 11;\n\tconst COLOR_DYE_LIGHT_BLUE = 12;\n\tconst COLOR_DYE_MAGENTA = 13;\n\tconst COLOR_DYE_ORANGE = 14;\n\tconst COLOR_DYE_WHITE = 15;\n\n\tprivate $red = 0;\n\tprivate $green = 0;\n\tprivate $blue = 0;\n\n\t/** @var \\SplFixedArray */\n\tpublic static $dyeColors = null;\n\n\tpublic static function init(){\n\t\tif(self::$dyeColors === null){\n\t\t\tself::$dyeColors = new \\SplFixedArray(16); //What's the point of making a 256-long array for 16 objects?\n\t\t\tself::$dyeColors[self::COLOR_DYE_BLACK] = Color::getRGB(30, 27, 27);\n\t\t\tself::$dyeColors[self::COLOR_DYE_RED] = Color::getRGB(179, 49, 44);\n\t\t\tself::$dyeColors[self::COLOR_DYE_GREEN] = Color::getRGB(61, 81, 26);\n\t\t\tself::$dyeColors[self::COLOR_DYE_BROWN] = Color::getRGB(81, 48, 26);\n\t\t\tself::$dyeColors[self::COLOR_DYE_BLUE] = Color::getRGB(37, 49, 146);\n\t\t\tself::$dyeColors[self::COLOR_DYE_PURPLE] = Color::getRGB(123, 47, 190);\n\t\t\tself::$dyeColors[self::COLOR_DYE_CYAN] = Color::getRGB(40, 118, 151);\n\t\t\tself::$dyeColors[self::COLOR_DYE_LIGHT_GRAY] = Color::getRGB(153, 153, 153);\n\t\t\tself::$dyeColors[self::COLOR_DYE_GRAY] = Color::getRGB(67, 67, 67);\n\t\t\tself::$dyeColors[self::COLOR_DYE_PINK] = Color::getRGB(216, 129, 152);\n\t\t\tself::$dyeColors[self::COLOR_DYE_LIME] = Color::getRGB(65, 205, 52);\n\t\t\tself::$dyeColors[self::COLOR_DYE_YELLOW] = Color::getRGB(222, 207, 42);\n\t\t\tself::$dyeColors[self::COLOR_DYE_LIGHT_BLUE] = Color::getRGB(102, 137, 211);\n\t\t\tself::$dyeColors[self::COLOR_DYE_MAGENTA] = Color::getRGB(195, 84, 205);\n\t\t\tself::$dyeColors[self::COLOR_DYE_ORANGE] = Color::getRGB(235, 136, 68);\n\t\t\tself::$dyeColors[self::COLOR_DYE_WHITE] = Color::getRGB(240, 240, 240);\n\t\t}\n\t}\n\n\tpublic static function getRGB($r, $g, $b){\n\t\treturn new Color((int) $r, (int) $g, (int) $b);\n\t}\n\n\tpublic static function averageColor(Color ...$colors){\n\t\t$tr = 0;//total red\n\t\t$tg = 0;//green\n\t\t$tb = 0;//blue\n\t\t$count = 0;\n\t\tforeach($colors as $c){\n\t\t\t$tr += $c->getRed();\n\t\t\t$tg += $c->getGreen();\n\t\t\t$tb += $c->getBlue();\n\t\t\t++$count;\n\t\t}\n\t\treturn Color::getRGB($tr / $count, $tg / $count, $tb / $count);\n\t}\n\n\tpublic static function getDyeColor($id){\n\t\tif(isset(self::$dyeColors[$id])){\n\t\t\treturn clone self::$dyeColors[$id];\n\t\t}\n\t\treturn Color::getRGB(0, 0, 0);\n\t}\n\n\tpublic function __construct($r, $g, $b){\n\t\t$this->red = $r;\n\t\t$this->green = $g;\n\t\t$this->blue = $b;\n\t}\n\n\tpublic function getRed(){\n\t\treturn (int) $this->red;\n\t}\n\n\tpublic function getBlue(){\n\t\treturn (int) $this->blue;\n\t}\n\n\tpublic function getGreen(){\n\t\treturn (int) $this->green;\n\t}\n\n\tpublic function getColorCode(){\n\t\treturn ($this->red << 16 | $this->green << 8 | $this->blue) & 0xffffff;\n\t}\n\n\tpublic function __toString(){\n\t\treturn \"Color(red:\" . $this->red . \", green:\" . $this->green . \", blue:\" . $this->blue . \")\";\n\t}\n}"
  },
  {
    "path": "src/pocketmine/utils/Config.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\utils;\nuse pocketmine\\scheduler\\FileWriteTask;\nuse pocketmine\\Server;\n\n\n/**\n * Class Config\n *\n * Config Class for simple config manipulation of multiple formats.\n */\nclass Config{\n\tconst DETECT = -1; //Detect by file extension\n\tconst PROPERTIES = 0; // .properties\n\tconst CNF = Config::PROPERTIES; // .cnf\n\tconst JSON = 1; // .js, .json\n\tconst YAML = 2; // .yml, .yaml\n\t//const EXPORT = 3; // .export, .xport\n\tconst SERIALIZED = 4; // .sl\n\tconst ENUM = 5; // .txt, .list, .enum\n\tconst ENUMERATION = Config::ENUM;\n\n\t/** @var array */\n\tprivate $config = [];\n\n\tprivate $nestedCache = [];\n\n\t/** @var string */\n\tprivate $file;\n\t/** @var boolean */\n\tprivate $correct = false;\n\t/** @var integer */\n\tprivate $type = Config::DETECT;\n\n\tpublic static $formats = [\n\t\t\"properties\" => Config::PROPERTIES,\n\t\t\"cnf\" => Config::CNF,\n\t\t\"conf\" => Config::CNF,\n\t\t\"config\" => Config::CNF,\n\t\t\"json\" => Config::JSON,\n\t\t\"js\" => Config::JSON,\n\t\t\"yml\" => Config::YAML,\n\t\t\"yaml\" => Config::YAML,\n\t\t//\"export\" => Config::EXPORT,\n\t\t//\"xport\" => Config::EXPORT,\n\t\t\"sl\" => Config::SERIALIZED,\n\t\t\"serialize\" => Config::SERIALIZED,\n\t\t\"txt\" => Config::ENUM,\n\t\t\"list\" => Config::ENUM,\n\t\t\"enum\" => Config::ENUM,\n\t];\n\n\t/**\n\t * @param string $file     Path of the file to be loaded\n\t * @param int    $type     Config type to load, -1 by default (detect)\n\t * @param array  $default  Array with the default values that will be written to the file if it did not exist\n\t * @param null   &$correct Sets correct to true if everything has been loaded correctly\n\t */\n\tpublic function __construct($file, $type = Config::DETECT, $default = [], &$correct = null){\n\t\t$this->load($file, $type, $default);\n\t\t$correct = $this->correct;\n\t}\n\n\t/**\n\t * Removes all the changes in memory and loads the file again\n\t */\n\tpublic function reload(){\n\t\t$this->config = [];\n\t\t$this->nestedCache = [];\n\t\t$this->correct = false;\n\t\t$this->load($this->file, $this->type);\n\t}\n\n\t/**\n\t * @param $str\n\t *\n\t * @return mixed\n\t */\n\tpublic static function fixYAMLIndexes($str){\n\t\treturn preg_replace(\"#^([ ]*)([a-zA-Z_]{1}[ ]*)\\\\:$#m\", \"$1\\\"$2\\\":\", $str);\n\t}\n\n\t/**\n\t * @param       $file\n\t * @param int   $type\n\t * @param array $default\n\t *\n\t * @return bool\n\t */\n\tpublic function load($file, $type = Config::DETECT, $default = []){\n\t\t$this->correct = true;\n\t\t$this->type = (int) $type;\n\t\t$this->file = $file;\n\t\tif(!is_array($default)){\n\t\t\t$default = [];\n\t\t}\n\t\tif(!file_exists($file)){\n\t\t\t$this->config = $default;\n\t\t\t$this->save();\n\t\t}else{\n\t\t\tif($this->type === Config::DETECT){\n\t\t\t\t$extension = explode(\".\", basename($this->file));\n\t\t\t\t$extension = strtolower(trim(array_pop($extension)));\n\t\t\t\tif(isset(Config::$formats[$extension])){\n\t\t\t\t\t$this->type = Config::$formats[$extension];\n\t\t\t\t}else{\n\t\t\t\t\t$this->correct = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif($this->correct === true){\n\t\t\t\t$content = file_get_contents($this->file);\n\t\t\t\tswitch($this->type){\n\t\t\t\t\tcase Config::PROPERTIES:\n\t\t\t\t\tcase Config::CNF:\n\t\t\t\t\t\t$this->parseProperties($content);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::JSON:\n\t\t\t\t\t\t$this->config = json_decode($content, true);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::YAML:\n\t\t\t\t\t\t$content = self::fixYAMLIndexes($content);\n\t\t\t\t\t\t$this->config = yaml_parse($content);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::SERIALIZED:\n\t\t\t\t\t\t$this->config = unserialize($content);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::ENUM:\n\t\t\t\t\t\t$this->parseList($content);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tdefault:\n\t\t\t\t\t\t$this->correct = false;\n\n\t\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t\tif(!is_array($this->config)){\n\t\t\t\t\t$this->config = $default;\n\t\t\t\t}\n\t\t\t\tif($this->fillDefaults($default, $this->config) > 0){\n\t\t\t\t\t$this->save();\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\treturn true;\n\t}\n\n\t/**\n\t * @return boolean\n\t */\n\tpublic function check(){\n\t\treturn $this->correct === true;\n\t}\n\n\t/**\n\t * @param bool $async\n\t *\n\t * @return boolean\n\t */\n\tpublic function save($async = false){\n\t\tif($this->correct === true){\n\t\t\ttry{\n\t\t\t\t$content = null;\n\t\t\t\tswitch($this->type){\n\t\t\t\t\tcase Config::PROPERTIES:\n\t\t\t\t\tcase Config::CNF:\n\t\t\t\t\t\t$content = $this->writeProperties();\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::JSON:\n\t\t\t\t\t\t$content = json_encode($this->config, JSON_PRETTY_PRINT | JSON_BIGINT_AS_STRING);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::YAML:\n\t\t\t\t\t\t$content = yaml_emit($this->config, YAML_UTF8_ENCODING);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::SERIALIZED:\n\t\t\t\t\t\t$content = serialize($this->config);\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase Config::ENUM:\n\t\t\t\t\t\t$content = implode(\"\\r\\n\", array_keys($this->config));\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif($async){\n\t\t\t\t\tServer::getInstance()->getScheduler()->scheduleAsyncTask(new FileWriteTask($this->file, $content));\n\t\t\t\t}else{\n\t\t\t\t\tfile_put_contents($this->file, $content);\n\t\t\t\t}\n\t\t\t}catch(\\Throwable $e){\n\t\t\t\t$logger = Server::getInstance()->getLogger();\n\t\t\t\t$logger->critical(\"Could not save Config \" . $this->file . \": \" . $e->getMessage());\n\t\t\t\tif(\\pocketmine\\DEBUG > 1 and $logger instanceof MainLogger){\n\t\t\t\t\t$logger->logException($e);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}else{\n\t\t\treturn false;\n\t\t}\n\t}\n\n\t/**\n\t * @param $k\n\t *\n\t * @return boolean|mixed\n\t */\n\tpublic function __get($k){\n\t\treturn $this->get($k);\n\t}\n\n\t/**\n\t * @param $k\n\t * @param $v\n\t */\n\tpublic function __set($k, $v){\n\t\t$this->set($k, $v);\n\t}\n\n\t/**\n\t * @param $k\n\t *\n\t * @return boolean\n\t */\n\tpublic function __isset($k){\n\t\treturn $this->exists($k);\n\t}\n\n\t/**\n\t * @param $k\n\t */\n\tpublic function __unset($k){\n\t\t$this->remove($k);\n\t}\n\n\t/**\n\t * @param $key\n\t * @param $value\n\t */\n\tpublic function setNested($key, $value){\n\t\t$vars = explode(\".\", $key);\n\t\t$base = array_shift($vars);\n\n\t\tif(!isset($this->config[$base])){\n\t\t\t$this->config[$base] = [];\n\t\t}\n\n\t\t$base =& $this->config[$base];\n\n\t\twhile(count($vars) > 0){\n\t\t\t$baseKey = array_shift($vars);\n\t\t\tif(!isset($base[$baseKey])){\n\t\t\t\t$base[$baseKey] = [];\n\t\t\t}\n\t\t\t$base =& $base[$baseKey];\n\t\t}\n\n\t\t$base = $value;\n\t\t$this->nestedCache[$key] = $value;\n\t}\n\n\t/**\n\t * @param       $key\n\t * @param mixed $default\n\t *\n\t * @return mixed\n\t */\n\tpublic function getNested($key, $default = null){\n\t\tif(isset($this->nestedCache[$key])){\n\t\t\treturn $this->nestedCache[$key];\n\t\t}\n\n\t\t$vars = explode(\".\", $key);\n\t\t$base = array_shift($vars);\n\t\tif(isset($this->config[$base])){\n\t\t\t$base = $this->config[$base];\n\t\t}else{\n\t\t\treturn $default;\n\t\t}\n\n\t\twhile(count($vars) > 0){\n\t\t\t$baseKey = array_shift($vars);\n\t\t\tif(is_array($base) and isset($base[$baseKey])){\n\t\t\t\t$base = $base[$baseKey];\n\t\t\t}else{\n\t\t\t\treturn $default;\n\t\t\t}\n\t\t}\n\n\t\treturn $this->nestedCache[$key] = $base;\n\t}\n\n\t/**\n\t * @param       $k\n\t * @param mixed $default\n\t *\n\t * @return boolean|mixed\n\t */\n\tpublic function get($k, $default = false){\n\t\treturn ($this->correct and isset($this->config[$k])) ? $this->config[$k] : $default;\n\t}\n\n\t/**\n\t * @param string $k key to be set\n\t * @param mixed  $v value to set key\n\t */\n\tpublic function set($k, $v = true){\n\t\t$this->config[$k] = $v;\n\t\tforeach($this->nestedCache as $nestedKey => $nvalue){\n\t\t\tif(substr($nestedKey, 0, strlen($k) + 1) === ($k . \".\")){\n\t\t\t\tunset($this->nestedCache[$nestedKey]);\n  \t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * @param array $v\n\t */\n\tpublic function setAll($v){\n\t\t$this->config = $v;\n\t}\n\n\t/**\n\t * @param      $k\n\t * @param bool $lowercase If set, searches Config in single-case / lowercase.\n\t *\n\t * @return boolean\n\t */\n\tpublic function exists($k, $lowercase = false){\n\t\tif($lowercase === true){\n\t\t\t$k = strtolower($k); //Convert requested  key to lower\n\t\t\t$array = array_change_key_case($this->config, CASE_LOWER); //Change all keys in array to lower\n\t\t\treturn isset($array[$k]); //Find $k in modified array\n\t\t}else{\n\t\t\treturn isset($this->config[$k]);\n\t\t}\n\t}\n\n\t/**\n\t * @param $k\n\t */\n\tpublic function remove($k){\n\t\tunset($this->config[$k]);\n\t}\n\n\t/**\n\t * @param bool $keys\n\t *\n\t * @return array\n\t */\n\tpublic function getAll($keys = false){\n\t\treturn ($keys === true ? array_keys($this->config) : $this->config);\n\t}\n\n\t/**\n\t * @param array $defaults\n\t */\n\tpublic function setDefaults(array $defaults){\n\t\t$this->fillDefaults($defaults, $this->config);\n\t}\n\n\t/**\n\t * @param $default\n\t * @param $data\n\t *\n\t * @return integer\n\t */\n\tprivate function fillDefaults($default, &$data){\n\t\t$changed = 0;\n\t\tforeach($default as $k => $v){\n\t\t\tif(is_array($v)){\n\t\t\t\tif(!isset($data[$k]) or !is_array($data[$k])){\n\t\t\t\t\t$data[$k] = [];\n\t\t\t\t}\n\t\t\t\t$changed += $this->fillDefaults($v, $data[$k]);\n\t\t\t}elseif(!isset($data[$k])){\n\t\t\t\t$data[$k] = $v;\n\t\t\t\t++$changed;\n\t\t\t}\n\t\t}\n\n\t\treturn $changed;\n\t}\n\n\t/**\n\t * @param $content\n\t */\n\tprivate function parseList($content){\n\t\tforeach(explode(\"\\n\", trim(str_replace(\"\\r\\n\", \"\\n\", $content))) as $v){\n\t\t\t$v = trim($v);\n\t\t\tif($v == \"\"){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$this->config[$v] = true;\n\t\t}\n\t}\n\n\t/**\n\t * @return string\n\t */\n\tprivate function writeProperties(){\n\t\t$content = \"#Properties Config file\\r\\n#\" . date(\"D M j H:i:s T Y\") . \"\\r\\n\";\n\t\tforeach($this->config as $k => $v){\n\t\t\tif(is_bool($v) === true){\n\t\t\t\t$v = $v === true ? \"on\" : \"off\";\n\t\t\t}elseif(is_array($v)){\n\t\t\t\t$v = implode(\";\", $v);\n\t\t\t}\n\t\t\t$content .= $k . \"=\" . $v . \"\\r\\n\";\n\t\t}\n\n\t\treturn $content;\n\t}\n\n\t/**\n\t * @param $content\n\t */\n\tprivate function parseProperties($content){\n\t\tif(preg_match_all('/([a-zA-Z0-9\\-_\\.]*)=([^\\r\\n]*)/u', $content, $matches) > 0){ //false or 0 matches\n\t\t\tforeach($matches[1] as $i => $k){\n\t\t\t\t$v = trim($matches[2][$i]);\n\t\t\t\tswitch(strtolower($v)){\n\t\t\t\t\tcase \"on\":\n\t\t\t\t\tcase \"true\":\n\t\t\t\t\tcase \"yes\":\n\t\t\t\t\t\t$v = true;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"off\":\n\t\t\t\t\tcase \"false\":\n\t\t\t\t\tcase \"no\":\n\t\t\t\t\t\t$v = false;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\tif(isset($this->config[$k])){\n\t\t\t\t\tMainLogger::getLogger()->debug(\"[Config] Repeated property \" . $k . \" on file \" . $this->file);\n\t\t\t\t}\n\t\t\t\t$this->config[$k] = $v;\n\t\t\t}\n\t\t}\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/utils/LevelException.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nclass LevelException extends ServerException{\n\n}"
  },
  {
    "path": "src/pocketmine/utils/MainLogger.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nuse LogLevel;\nuse pocketmine\\Thread;\nuse pocketmine\\Worker;\n\nclass MainLogger extends \\AttachableThreadedLogger{\n\tprotected $logFile;\n\tprotected $logStream;\n\tprotected $shutdown;\n\tprotected $logDebug;\n\tprivate $logResource;\n\t/** @var MainLogger */\n\tpublic static $logger = null;\n\t\n\tprivate $consoleCallback;\n\n\t/** Extra Settings */\n\tprotected $write = false;\n\n\tpublic $shouldSendMsg = \"\";\n\tpublic $shouldRecordMsg = false;\n\tprivate $lastGet = 0;\n\n\tpublic function setSendMsg($b){\n\t\t$this->shouldRecordMsg = $b;\n\t\t$this->lastGet = time();\n\t}\n\n\tpublic function getMessages(){\n\t\t$msg = $this->shouldSendMsg;\n\t\t$this->shouldSendMsg = \"\";\n\t\t$this->lastGet = time();\n\t\treturn $msg;\n\t}\n\n\t/**\n\t * @param string $logFile\n\t * @param bool   $logDebug\n\t *\n\t * @throws \\RuntimeException\n\t */\n\tpublic function __construct($logFile, $logDebug = false){\n\t\tif(static::$logger instanceof MainLogger){\n\t\t\tthrow new \\RuntimeException(\"MainLogger has been already created\");\n\t\t}\n\t\tstatic::$logger = $this;\n\t\ttouch($logFile);\n\t\t$this->logFile = $logFile;\n\t\t$this->logDebug = (bool) $logDebug;\n\t\t$this->logStream = new \\Threaded;\n\t\t$this->start();\n\t}\n\n\t/**\n\t * @return MainLogger\n\t */\n\tpublic static function getLogger(){\n\t\treturn static::$logger;\n\t}\n\n\tpublic function emergency($message, $name = \"EMERGENCY\"){\n\t\t$this->send($message, \\LogLevel::EMERGENCY, $name, TextFormat::RED);\n\t}\n\n\tpublic function alert($message, $name = \"ALERT\"){\n\t\t$this->send($message, \\LogLevel::ALERT, $name, TextFormat::RED);\n\t}\n\n\tpublic function critical($message, $name = \"CRITICAL\"){\n\t\t$this->send($message, \\LogLevel::CRITICAL, $name, TextFormat::RED);\n\t}\n\n\tpublic function error($message, $name = \"ERROR\"){\n\t\t$this->send($message, \\LogLevel::ERROR, $name, TextFormat::DARK_RED);\n\t}\n\n\tpublic function warning($message, $name = \"WARNING\"){\n\t\t$this->send($message, \\LogLevel::WARNING, $name, TextFormat::YELLOW);\n\t}\n\n\tpublic function notice($message, $name = \"NOTICE\"){\n\t\t$this->send($message, \\LogLevel::NOTICE, $name, TextFormat::AQUA);\n\t}\n\n\tpublic function info($message, $name = \"INFO\"){\n\t\t$this->send($message, \\LogLevel::INFO, $name, TextFormat::WHITE);\n\t}\n\n\tpublic function debug($message, $name = \"DEBUG\"){\n\t\tif($this->logDebug === false){\n\t\t\treturn;\n\t\t}\n\t\t$this->send($message, \\LogLevel::DEBUG, $name, TextFormat::GRAY);\n\t}\n\n\t/**\n\t * @param bool $logDebug\n\t */\n\tpublic function setLogDebug($logDebug){\n\t\t$this->logDebug = (bool) $logDebug;\n\t}\n\n\tpublic function logException(\\Throwable $e, $trace = null){\n\t\tif($trace === null){\n\t\t\t$trace = $e->getTrace();\n\t\t}\n\t\t$errstr = $e->getMessage();\n\t\t$errfile = $e->getFile();\n\t\t$errno = $e->getCode();\n\t\t$errline = $e->getLine();\n\n\t\t$errorConversion = [\n\t\t\t0 => \"EXCEPTION\",\n\t\t\tE_ERROR => \"E_ERROR\",\n\t\t\tE_WARNING => \"E_WARNING\",\n\t\t\tE_PARSE => \"E_PARSE\",\n\t\t\tE_NOTICE => \"E_NOTICE\",\n\t\t\tE_CORE_ERROR => \"E_CORE_ERROR\",\n\t\t\tE_CORE_WARNING => \"E_CORE_WARNING\",\n\t\t\tE_COMPILE_ERROR => \"E_COMPILE_ERROR\",\n\t\t\tE_COMPILE_WARNING => \"E_COMPILE_WARNING\",\n\t\t\tE_USER_ERROR => \"E_USER_ERROR\",\n\t\t\tE_USER_WARNING => \"E_USER_WARNING\",\n\t\t\tE_USER_NOTICE => \"E_USER_NOTICE\",\n\t\t\tE_STRICT => \"E_STRICT\",\n\t\t\tE_RECOVERABLE_ERROR => \"E_RECOVERABLE_ERROR\",\n\t\t\tE_DEPRECATED => \"E_DEPRECATED\",\n\t\t\tE_USER_DEPRECATED => \"E_USER_DEPRECATED\",\n\t\t];\n\t\tif($errno === 0){\n\t\t\t$type = LogLevel::CRITICAL;\n\t\t}else{\n\t\t\t$type = ($errno === E_ERROR or $errno === E_USER_ERROR) ? LogLevel::ERROR : (($errno === E_USER_WARNING or $errno === E_WARNING) ? LogLevel::WARNING : LogLevel::NOTICE);\n\t\t}\n\t\t$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;\n\t\tif(($pos = strpos($errstr, \"\\n\")) !== false){\n\t\t\t$errstr = substr($errstr, 0, $pos);\n\t\t}\n\t\t$errfile = \\pocketmine\\cleanPath($errfile);\n\t\t$this->log($type, get_class($e) . \": \\\"$errstr\\\" ($errno) in \\\"$errfile\\\" at line $errline\");\n\t\tforeach(@\\pocketmine\\getTrace(1, $trace) as $i => $line){\n\t\t\t$this->debug($line);\n\t\t}\n\t}\n\n\tpublic function log($level, $message){\n\t\tswitch($level){\n\t\t\tcase LogLevel::EMERGENCY:\n\t\t\t\t$this->emergency($message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel::ALERT:\n\t\t\t\t$this->alert($message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel::CRITICAL:\n\t\t\t\t$this->critical($message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel::ERROR:\n\t\t\t\t$this->error($message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel::WARNING:\n\t\t\t\t$this->warning($message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel::NOTICE:\n\t\t\t\t$this->notice($message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel::INFO:\n\t\t\t\t$this->info($message);\n\t\t\t\tbreak;\n\t\t\tcase LogLevel::DEBUG:\n\t\t\t\t$this->debug($message);\n\t\t\t\tbreak;\n\t\t}\n\t}\n\n\tpublic function shutdown(){\n\t\t$this->shutdown = true;\n\t}\n\n\tprotected function send($message, $level, $prefix, $color){\n\t\t$now = time();\n\n\t\t$thread = \\Thread::getCurrentThread();\n\t\tif($thread === null){\n\t\t\t$threadName = \"Elywing thread\";\n\t\t}elseif($thread instanceof Thread or $thread instanceof Worker){\n\t\t\t$threadName = $thread->getThreadName() . \" thread\";\n\t\t}else{\n\t\t\t$threadName = (new \\ReflectionClass($thread))->getShortName() . \" thread\";\n\t\t}\n\n\t\tif($this->shouldRecordMsg){\n\t\t\tif((time() - $this->lastGet) >= 10) $this->shouldRecordMsg = false; // 10 secs timeout\n\t\t\telse{\n\t\t\t\tif(strlen($this->shouldSendMsg) >= 10000) $this->shouldSendMsg = \"\";\n\t\t\t\t$this->shouldSendMsg .= $color . \"|\" . $prefix . \"|\" . trim($message, \"\\r\\n\") . \"\\n\";\n\t\t\t}\n\t\t}\n\n\t\t$message = TextFormat::toANSI(TextFormat::AQUA . date(\"H:i:s\", $now) . TextFormat::DARK_AQUA . \" | \" . TextFormat::RESET . $color . $threadName . \":\" . $prefix . TextFormat::DARK_AQUA .\" > \" . TextFormat::RESET . $color . $message . TextFormat::RESET);\n\t\t//$message = TextFormat::toANSI(TextFormat::AQUA . \"[\" . date(\"H:i:s\") . \"] \". TextFormat::RESET . $color .\"<\".$prefix . \">\" . \" \" . $message . TextFormat::RESET);\n\t\t$cleanMessage = TextFormat::clean($message);\n\n\t\tif(!Terminal::hasFormattingCodes()){\n\t\t\techo $cleanMessage . PHP_EOL;\n\t\t}else{\n\t\t\techo $message . PHP_EOL;\n\t\t}\n\n\t\tif(isset($this->consoleCallback)){\n\t\t\tcall_user_func($this->consoleCallback);\n\t\t}\n\n\t\tif($this->attachment instanceof \\ThreadedLoggerAttachment){\n\t\t\t$this->attachment->call($level, $message);\n\t\t}\n\n\t\t$this->logStream[] = date(\"Y-m-d\", $now) . \" \" . $cleanMessage . \"\\n\";\n\t\tif($this->logStream->count() === 1){\n\t\t\t$this->synchronized(function(){\n\t\t\t\t$this->notify();\n\t\t\t});\n\t\t}\n\t}\n\n\t/*public function run(){\n\t\t$this->shutdown = false;\n\t\tif($this->write){\n\t\t\t$this->logResource = fopen($this->logFile, \"a+b\");\n\t\t\tif(!is_resource($this->logResource)){\n\t\t\t\tthrow new \\RuntimeException(\"Couldn't open log file\");\n\t\t\t}\n\n\t\t\twhile($this->shutdown === false){\n\t\t\t\tif(!$this->write) {\n\t\t\t\t\tfclose($this->logResource);\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\t$this->synchronized(function(){\n\t\t\t\t\twhile($this->logStream->count() > 0){\n\t\t\t\t\t\t$chunk = $this->logStream->shift();\n\t\t\t\t\t\tfwrite($this->logResource, $chunk);\n\t\t\t\t\t}\n\n\t\t\t\t\t$this->wait(25000);\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif($this->logStream->count() > 0){\n\t\t\t\twhile($this->logStream->count() > 0){\n\t\t\t\t\t$chunk = $this->logStream->shift();\n\t\t\t\t\tfwrite($this->logResource, $chunk);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tfclose($this->logResource);\n\t\t}\n\t}*/\n\n\tpublic function run(){\n\t\t$this->shutdown = false;\n\t\twhile($this->shutdown === false){\n\t\t\t$this->synchronized(function(){\n\t\t\t\twhile($this->logStream->count() > 0){\n\t\t\t\t\t$chunk = $this->logStream->shift();\n\t\t\t\t\tif($this->write){\n\t\t\t\t\t\t$this->logResource = file_put_contents($this->logFile, $chunk, FILE_APPEND);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t$this->wait(200000);\n\t\t\t});\n\t\t}\n\n\t\tif($this->logStream->count() > 0){\n\t\t\twhile($this->logStream->count() > 0){\n\t\t\t\t$chunk = $this->logStream->shift();\n\t\t\t\tif($this->write){\n\t\t\t\t\t$this->logResource = file_put_contents($this->logFile, $chunk, FILE_APPEND);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function setWrite($write){\n\t\t$this->write = $write;\n\t}\n\t\n\tpublic function setConsoleCallback($callback){\n\t\t$this->consoleCallback = $callback;\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/utils/MonkeyPatch.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nclass MonkeyPatch{\n\tpublic function __construct(){\n\n\t}\n}"
  },
  {
    "path": "src/pocketmine/utils/Patchable.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\n\n/**\n * All classes or interfaces (including plugins) that want to be able to be patched in runtime\n * need to implement this interface\n */\ninterface Patchable{\n\n}"
  },
  {
    "path": "src/pocketmine/utils/PluginException.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nclass PluginException extends ServerException{\n\n}"
  },
  {
    "path": "src/pocketmine/utils/Random.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\utils;\n\n/**\n * XorShift128Engine Random Number Noise, used for fast seeded values\n * Most of the code in this class was adapted from the XorShift128Engine in the php-random library.\n */\nclass Random{\n\tconst X = 123456789;\n\tconst Y = 362436069;\n\tconst Z = 521288629;\n\tconst W = 88675123;\n\n\t/**\n\t * @var int\n\t */\n\tprivate $x;\n\n\t/**\n\t * @var int\n\t */\n\tprivate $y;\n\n\t/**\n\t * @var int\n\t */\n\tprivate $z;\n\n\t/**\n\t * @var int\n\t */\n\tprivate $w;\n\n\tprotected $seed;\n\n\t/**\n\t * @param int $seed Integer to be used as seed.\n\t */\n\tpublic function __construct($seed = -1){\n\t\tif($seed === -1){\n\t\t\t$seed = time();\n\t\t}\n\n\t\t$this->setSeed($seed);\n\t}\n\n\t/**\n\t * @param int $seed Integer to be used as seed.\n\t */\n\tpublic function setSeed($seed){\n\t\t$this->seed = $seed;\n\t\t$this->x = self::X ^ $seed;\n\t\t$this->y = self::Y ^ ($seed << 17) | (($seed >> 15) & 0x7fffffff) & 0xffffffff;\n\t\t$this->z = self::Z ^ ($seed << 31) | (($seed >>  1) & 0x7fffffff) & 0xffffffff;\n\t\t$this->w = self::W ^ ($seed << 18) | (($seed >> 14) & 0x7fffffff) & 0xffffffff;\n\t}\n\tpublic function getSeed(){\n\t\treturn $this->seed;\n\t}\n\n\t/**\n\t * Returns an 31-bit integer (not signed)\n\t *\n\t * @return int\n\t */\n\tpublic function nextInt(){\n\t\treturn $this->nextSignedInt() & 0x7fffffff;\n\t}\n\n\t/**\n\t * Returns a 32-bit integer (signed)\n\t *\n\t * @return int\n\t */\n\tpublic function nextSignedInt(){\n\t\t$t = ($this->x ^ ($this->x << 11)) & 0xffffffff;\n\n\t\t$this->x = $this->y;\n\t\t$this->y = $this->z;\n\t\t$this->z = $this->w;\n\t\t$this->w = ($this->w ^ (($this->w >> 19) & 0x7fffffff)\n\t\t\t\t\t\t\t ^ ($t ^ (($t >> 8) & 0x7fffffff))) & 0xffffffff;\n\n\t\treturn $this->w;\n\t}\n\n\t/**\n\t * Returns a float between 0.0 and 1.0 (inclusive)\n\t *\n\t * @return float\n\t */\n\tpublic function nextFloat(){\n\t\treturn $this->nextInt() / 0x7fffffff;\n\t}\n\n\t/**\n\t * Returns a float between -1.0 and 1.0 (inclusive)\n\t *\n\t * @return float\n\t */\n\tpublic function nextSignedFloat(){\n\t\treturn $this->nextSignedInt() / 0x7fffffff;\n\t}\n\n\t/**\n\t * Returns a random boolean\n\t *\n\t * @return bool\n\t */\n\tpublic function nextBoolean(){\n\t\treturn ($this->nextSignedInt() & 0x01) === 0;\n\t}\n\n\t/**\n\t * Returns a random integer between $start and $end\n\t *\n\t * @param int $start default 0\n\t * @param int $end   default 0x7fffffff\n\t *\n\t * @return int\n\t */\n\tpublic function nextRange($start = 0, $end = 0x7fffffff){\n\t\treturn $start + ($this->nextInt() % ($end + 1 - $start));\n\t}\n\n\tpublic function nextBoundedInt($bound){\n\t\treturn $this->nextInt() % $bound;\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/utils/Range.php",
    "content": "<?php\n\n/*\n *\n *  _____   _____   __   _   _   _____  __    __  _____\n * /  ___| | ____| |  \\ | | | | /  ___/ \\ \\  / / /  ___/\n * | |     | |__   |   \\| | | | | |___   \\ \\/ /  | |___\n * | |  _  |  __|  | |\\   | | | \\___  \\   \\  /   \\___  \\\n * | |_| | | |___  | | \\  | | |  ___| |   / /     ___| |\n * \\_____/ |_____| |_|  \\_| |_| /_____/  /_/     /_____/\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author iTX Technologies\n * @link https://itxtech.org\n *\n */\n\nnamespace pocketmine\\utils;\n\nclass Range{\n\tpublic $minValue;\n\tpublic $maxValue;\n\n\tpublic function __construct(int $min, int $max){\n\t\t$this->minValue = $min;\n\t\t$this->maxValue = $max;\n\t}\n\n\tpublic function isInRange(int $v) : bool{\n\t\treturn $v >= $this->minValue && $v <= $this->maxValue;\n\t}\n}"
  },
  {
    "path": "src/pocketmine/utils/ReversePriorityQueue.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nclass ReversePriorityQueue extends \\SplPriorityQueue{\n\n\tpublic function compare($priority1, $priority2){\n\t\treturn (int) -($priority1 - $priority2);\n\t}\n}"
  },
  {
    "path": "src/pocketmine/utils/ServerException.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nclass ServerException extends \\RuntimeException{\n\n}"
  },
  {
    "path": "src/pocketmine/utils/ServerKiller.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nuse pocketmine\\Thread;\n\nclass ServerKiller extends Thread{\n\n\tpublic $time;\n\n\tpublic function __construct($time = 15){\n\t\t$this->time = $time;\n\t}\n\n\tpublic function run(){\n\t\t$start = time() + 1;\n\t\t$this->synchronized(function(){\n\t\t\t$this->wait($this->time * 1000000);\n\t\t});\n\t\tif(time() - $start >= $this->time){\n\t\t\techo \"\\nTook too long to stop, server was killed forcefully!\\n\";\n\t\t\t@\\pocketmine\\kill(getmypid());\n\t\t}\n\t}\n\n\tpublic function getThreadName(){\n\t\treturn \"Server Killer\";\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/utils/Terminal.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\utils;\n\nabstract class Terminal{\n\tpublic static $FORMAT_BOLD = \"\";\n\tpublic static $FORMAT_OBFUSCATED = \"\";\n\tpublic static $FORMAT_ITALIC = \"\";\n\tpublic static $FORMAT_UNDERLINE = \"\";\n\tpublic static $FORMAT_STRIKETHROUGH = \"\";\n\n\tpublic static $FORMAT_RESET = \"\";\n\n\tpublic static $COLOR_BLACK = \"\";\n\tpublic static $COLOR_DARK_BLUE = \"\";\n\tpublic static $COLOR_DARK_GREEN = \"\";\n\tpublic static $COLOR_DARK_AQUA = \"\";\n\tpublic static $COLOR_DARK_RED = \"\";\n\tpublic static $COLOR_PURPLE = \"\";\n\tpublic static $COLOR_GOLD = \"\";\n\tpublic static $COLOR_GRAY = \"\";\n\tpublic static $COLOR_DARK_GRAY = \"\";\n\tpublic static $COLOR_BLUE = \"\";\n\tpublic static $COLOR_GREEN = \"\";\n\tpublic static $COLOR_AQUA = \"\";\n\tpublic static $COLOR_RED = \"\";\n\tpublic static $COLOR_LIGHT_PURPLE = \"\";\n\tpublic static $COLOR_YELLOW = \"\";\n\tpublic static $COLOR_WHITE = \"\";\n\n\tprivate static $formattingCodes = null;\n\n\tpublic static function hasFormattingCodes(){\n\t\tif(self::$formattingCodes === null){\n\t\t\t$opts = getopt(\"\", [\"enable-ansi\", \"disable-ansi\"]);\n\t\t\tif(isset($opts[\"disable-ansi\"])){\n\t\t\t\tself::$formattingCodes = false;\n\t\t\t}else{\n\t\t\t\tself::$formattingCodes = ((Utils::getOS() !== \"win\" and getenv(\"TERM\") != \"\" and (!function_exists(\"posix_ttyname\") or !defined(\"STDOUT\") or posix_ttyname(STDOUT) !== false)) or isset($opts[\"enable-ansi\"]));\n\t\t\t}\n\t\t}\n\n\t\treturn self::$formattingCodes;\n\t}\n\n\tprotected static function getFallbackEscapeCodes(){\n\t\tself::$FORMAT_BOLD = \"\\x1b[1m\";\n\t\tself::$FORMAT_OBFUSCATED = \"\";\n\t\tself::$FORMAT_ITALIC = \"\\x1b[3m\";\n\t\tself::$FORMAT_UNDERLINE = \"\\x1b[4m\";\n\t\tself::$FORMAT_STRIKETHROUGH = \"\\x1b[9m\";\n\n\t\tself::$FORMAT_RESET = \"\\x1b[m\";\n\n\t\tself::$COLOR_BLACK = \"\\x1b[38;5;16m\";\n\t\tself::$COLOR_DARK_BLUE = \"\\x1b[38;5;19m\";\n\t\tself::$COLOR_DARK_GREEN = \"\\x1b[38;5;34m\";\n\t\tself::$COLOR_DARK_AQUA = \"\\x1b[38;5;37m\";\n\t\tself::$COLOR_DARK_RED = \"\\x1b[38;5;124m\";\n\t\tself::$COLOR_PURPLE = \"\\x1b[38;5;127m\";\n\t\tself::$COLOR_GOLD = \"\\x1b[38;5;214m\";\n\t\tself::$COLOR_GRAY = \"\\x1b[38;5;145m\";\n\t\tself::$COLOR_DARK_GRAY = \"\\x1b[38;5;59m\";\n\t\tself::$COLOR_BLUE = \"\\x1b[38;5;63m\";\n\t\tself::$COLOR_GREEN = \"\\x1b[38;5;83m\";\n\t\tself::$COLOR_AQUA = \"\\x1b[38;5;87m\";\n\t\tself::$COLOR_RED = \"\\x1b[38;5;203m\";\n\t\tself::$COLOR_LIGHT_PURPLE = \"\\x1b[38;5;207m\";\n\t\tself::$COLOR_YELLOW = \"\\x1b[38;5;227m\";\n\t\tself::$COLOR_WHITE = \"\\x1b[38;5;231m\";\n\t}\n\n\tprotected static function getEscapeCodes(){\n\t\tself::$FORMAT_BOLD = `tput bold`;\n\t\tself::$FORMAT_OBFUSCATED = `tput smacs`;\n\t\tself::$FORMAT_ITALIC = `tput sitm`;\n\t\tself::$FORMAT_UNDERLINE = `tput smul`;\n\t\tself::$FORMAT_STRIKETHROUGH = \"\\x1b[9m\"; //`tput `;\n\n\t\tself::$FORMAT_RESET = `tput sgr0`;\n\n\t\t$colors = (int) `tput colors`;\n\t\tif($colors > 8){\n\t\t\tself::$COLOR_BLACK = $colors >= 256 ? `tput setaf 16` : `tput setaf 0`;\n\t\t\tself::$COLOR_DARK_BLUE = $colors >= 256 ? `tput setaf 19` : `tput setaf 4`;\n\t\t\tself::$COLOR_DARK_GREEN = $colors >= 256 ? `tput setaf 34` : `tput setaf 2`;\n\t\t\tself::$COLOR_DARK_AQUA = $colors >= 256 ? `tput setaf 37` : `tput setaf 6`;\n\t\t\tself::$COLOR_DARK_RED = $colors >= 256 ? `tput setaf 124` : `tput setaf 1`;\n\t\t\tself::$COLOR_PURPLE = $colors >= 256 ? `tput setaf 127` : `tput setaf 5`;\n\t\t\tself::$COLOR_GOLD = $colors >= 256 ? `tput setaf 214` : `tput setaf 3`;\n\t\t\tself::$COLOR_GRAY = $colors >= 256 ? `tput setaf 145` : `tput setaf 7`;\n\t\t\tself::$COLOR_DARK_GRAY = $colors >= 256 ? `tput setaf 59` : `tput setaf 8`;\n\t\t\tself::$COLOR_BLUE = $colors >= 256 ? `tput setaf 63` : `tput setaf 12`;\n\t\t\tself::$COLOR_GREEN = $colors >= 256 ? `tput setaf 83` : `tput setaf 10`;\n\t\t\tself::$COLOR_AQUA = $colors >= 256 ? `tput setaf 87` : `tput setaf 14`;\n\t\t\tself::$COLOR_RED = $colors >= 256 ? `tput setaf 203` : `tput setaf 9`;\n\t\t\tself::$COLOR_LIGHT_PURPLE = $colors >= 256 ? `tput setaf 207` : `tput setaf 13`;\n\t\t\tself::$COLOR_YELLOW = $colors >= 256 ? `tput setaf 227` : `tput setaf 11`;\n\t\t\tself::$COLOR_WHITE = $colors >= 256 ? `tput setaf 231` : `tput setaf 15`;\n\t\t}else{\n\t\t\tself::$COLOR_BLACK = self::$COLOR_DARK_GRAY = `tput setaf 0`;\n\t\t\tself::$COLOR_RED = self::$COLOR_DARK_RED = `tput setaf 1`;\n\t\t\tself::$COLOR_GREEN = self::$COLOR_DARK_GREEN = `tput setaf 2`;\n\t\t\tself::$COLOR_YELLOW = self::$COLOR_GOLD = `tput setaf 3`;\n\t\t\tself::$COLOR_BLUE = self::$COLOR_DARK_BLUE = `tput setaf 4`;\n\t\t\tself::$COLOR_LIGHT_PURPLE = self::$COLOR_PURPLE = `tput setaf 5`;\n\t\t\tself::$COLOR_AQUA = self::$COLOR_DARK_AQUA = `tput setaf 6`;\n\t\t\tself::$COLOR_GRAY = self::$COLOR_WHITE = `tput setaf 7`;\n\t\t}\n\t}\n\n\tpublic static function init(){\n\t\tif(!self::hasFormattingCodes()){\n\t\t\treturn;\n\t\t}\n\n\t\tswitch(Utils::getOS()){\n\t\t\tcase \"linux\":\n\t\t\tcase \"mac\":\n\t\t\tcase \"bsd\":\n\t\t\t\tself::getEscapeCodes();\n\t\t\t\treturn;\n\n\t\t\tcase \"win\":\n\t\t\tcase \"android\":\n\t\t\t\tself::getFallbackEscapeCodes();\n\t\t\t\treturn;\n\t\t}\n\n\t\t//TODO: iOS\n\t}\n\n}"
  },
  {
    "path": "src/pocketmine/utils/TextFormat.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\utils;\n\n/**\n * Class used to handle Minecraft chat format, and convert it to other formats like ANSI or HTML\n */\nabstract class TextFormat{\n\tconst ESCAPE = \"\\xc2\\xa7\"; //§\n\t\n\tconst BLACK = TextFormat::ESCAPE . \"0\";\n\tconst DARK_BLUE = TextFormat::ESCAPE . \"1\";\n\tconst DARK_GREEN = TextFormat::ESCAPE . \"2\";\n\tconst DARK_AQUA = TextFormat::ESCAPE . \"3\";\n\tconst DARK_RED = TextFormat::ESCAPE . \"4\";\n\tconst DARK_PURPLE = TextFormat::ESCAPE . \"5\";\n\tconst GOLD = TextFormat::ESCAPE . \"6\";\n\tconst GRAY = TextFormat::ESCAPE . \"7\";\n\tconst DARK_GRAY = TextFormat::ESCAPE . \"8\";\n\tconst BLUE = TextFormat::ESCAPE . \"9\";\n\tconst GREEN = TextFormat::ESCAPE . \"a\";\n\tconst AQUA = TextFormat::ESCAPE . \"b\";\n\tconst RED = TextFormat::ESCAPE . \"c\";\n\tconst LIGHT_PURPLE = TextFormat::ESCAPE . \"d\";\n\tconst YELLOW = TextFormat::ESCAPE . \"e\";\n\tconst WHITE = TextFormat::ESCAPE . \"f\";\n\n\tconst OBFUSCATED = TextFormat::ESCAPE . \"k\";\n\tconst BOLD = TextFormat::ESCAPE . \"l\";\n\tconst STRIKETHROUGH = TextFormat::ESCAPE . \"m\";\n\tconst UNDERLINE = TextFormat::ESCAPE . \"n\";\n\tconst ITALIC = TextFormat::ESCAPE . \"o\";\n\tconst RESET = TextFormat::ESCAPE . \"r\";\n\n\t/**\n\t * Splits the string by Format tokens\n\t *\n\t * @param string $string\n\t *\n\t * @return array\n\t */\n\tpublic static function tokenize($string){\n\t\treturn preg_split(\"/(\". TextFormat::ESCAPE .\"[0123456789abcdefklmnor])/\", $string, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);\n\t}\n\n\t/**\n\t * Cleans the string from Minecraft codes and ANSI Escape Codes\n\t *\n\t * @param string $string\n\t * @param bool   $removeFormat\n\t *\n\t * @return mixed\n\t */\n\tpublic static function clean($string, $removeFormat = true){\n\t\tif($removeFormat){\n\t\t\treturn str_replace(TextFormat::ESCAPE, \"\", preg_replace([\"/\". TextFormat::ESCAPE .\"[0123456789abcdefklmnor]/\", \"/\\x1b[\\\\(\\\\][[0-9;\\\\[\\\\(]+[Bm]/\"], \"\", $string));\n\t\t}\n\t\treturn str_replace(\"\\x1b\", \"\", preg_replace(\"/\\x1b[\\\\(\\\\][[0-9;\\\\[\\\\(]+[Bm]/\", \"\", $string));\n\t}\n\n\t/**\n\t * Returns an JSON-formatted string with colors/markup\n\t *\n\t * @param string|array $string\n\t *\n\t * @return string\n\t */\n\tpublic static function toJSON($string){\n\t\tif(!is_array($string)){\n\t\t\t$string = self::tokenize($string);\n\t\t}\n\t\t$newString = [];\n\t\t$pointer =& $newString;\n\t\t$color = \"white\";\n\t\t$bold = false;\n\t\t$italic = false;\n\t\t$underlined = false;\n\t\t$strikethrough = false;\n\t\t$obfuscated = false;\n\t\t$index = 0;\n\n\t\tforeach($string as $token){\n\t\t\tif(isset($pointer[\"text\"])){\n\t\t\t\tif(!isset($newString[\"extra\"])){\n\t\t\t\t\t$newString[\"extra\"] = [];\n\t\t\t\t}\n\t\t\t\t$newString[\"extra\"][$index] = [];\n\t\t\t\t$pointer =& $newString[\"extra\"][$index];\n\t\t\t\tif($color !== \"white\"){\n\t\t\t\t\t$pointer[\"color\"] = $color;\n\t\t\t\t}\n\t\t\t\tif($bold !== false){\n\t\t\t\t\t$pointer[\"bold\"] = true;\n\t\t\t\t}\n\t\t\t\tif($italic !== false){\n\t\t\t\t\t$pointer[\"italic\"] = true;\n\t\t\t\t}\n\t\t\t\tif($underlined !== false){\n\t\t\t\t\t$pointer[\"underlined\"] = true;\n\t\t\t\t}\n\t\t\t\tif($strikethrough !== false){\n\t\t\t\t\t$pointer[\"strikethrough\"] = true;\n\t\t\t\t}\n\t\t\t\tif($obfuscated !== false){\n\t\t\t\t\t$pointer[\"obfuscated\"] = true;\n\t\t\t\t}\n\t\t\t\t++$index;\n\t\t\t}\n\t\t\tswitch($token){\n\t\t\t\tcase TextFormat::BOLD:\n\t\t\t\t\tif($bold === false){\n\t\t\t\t\t\t$pointer[\"bold\"] = true;\n\t\t\t\t\t\t$bold = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::OBFUSCATED:\n\t\t\t\t\tif($obfuscated === false){\n\t\t\t\t\t\t$pointer[\"obfuscated\"] = true;\n\t\t\t\t\t\t$obfuscated = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::ITALIC:\n\t\t\t\t\tif($italic === false){\n\t\t\t\t\t\t$pointer[\"italic\"] = true;\n\t\t\t\t\t\t$italic = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::UNDERLINE:\n\t\t\t\t\tif($underlined === false){\n\t\t\t\t\t\t$pointer[\"underlined\"] = true;\n\t\t\t\t\t\t$underlined = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::STRIKETHROUGH:\n\t\t\t\t\tif($strikethrough === false){\n\t\t\t\t\t\t$pointer[\"strikethrough\"] = true;\n\t\t\t\t\t\t$strikethrough = true;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::RESET:\n\t\t\t\t\tif($color !== \"white\"){\n\t\t\t\t\t\t$pointer[\"color\"] = \"white\";\n\t\t\t\t\t\t$color = \"white\";\n\t\t\t\t\t}\n\t\t\t\t\tif($bold !== false){\n\t\t\t\t\t\t$pointer[\"bold\"] = false;\n\t\t\t\t\t\t$bold = false;\n\t\t\t\t\t}\n\t\t\t\t\tif($italic !== false){\n\t\t\t\t\t\t$pointer[\"italic\"] = false;\n\t\t\t\t\t\t$italic = false;\n\t\t\t\t\t}\n\t\t\t\t\tif($underlined !== false){\n\t\t\t\t\t\t$pointer[\"underlined\"] = false;\n\t\t\t\t\t\t$underlined = false;\n\t\t\t\t\t}\n\t\t\t\t\tif($strikethrough !== false){\n\t\t\t\t\t\t$pointer[\"strikethrough\"] = false;\n\t\t\t\t\t\t$strikethrough = false;\n\t\t\t\t\t}\n\t\t\t\t\tif($obfuscated !== false){\n\t\t\t\t\t\t$pointer[\"obfuscated\"] = false;\n\t\t\t\t\t\t$obfuscated = false;\n\t\t\t\t\t}\n\t\t\t\t\tbreak;\n\n\t\t\t\t//Colors\n\t\t\t\tcase TextFormat::BLACK:\n\t\t\t\t\t$pointer[\"color\"] = \"black\";\n\t\t\t\t\t$color = \"black\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_BLUE:\n\t\t\t\t\t$pointer[\"color\"] = \"dark_blue\";\n\t\t\t\t\t$color = \"dark_blue\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_GREEN:\n\t\t\t\t\t$pointer[\"color\"] = \"dark_green\";\n\t\t\t\t\t$color = \"dark_green\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_AQUA:\n\t\t\t\t\t$pointer[\"color\"] = \"dark_aqua\";\n\t\t\t\t\t$color = \"dark_aqua\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_RED:\n\t\t\t\t\t$pointer[\"color\"] = \"dark_red\";\n\t\t\t\t\t$color = \"dark_red\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_PURPLE:\n\t\t\t\t\t$pointer[\"color\"] = \"dark_purple\";\n\t\t\t\t\t$color = \"dark_purple\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GOLD:\n\t\t\t\t\t$pointer[\"color\"] = \"gold\";\n\t\t\t\t\t$color = \"gold\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GRAY:\n\t\t\t\t\t$pointer[\"color\"] = \"gray\";\n\t\t\t\t\t$color = \"gray\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_GRAY:\n\t\t\t\t\t$pointer[\"color\"] = \"dark_gray\";\n\t\t\t\t\t$color = \"dark_gray\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::BLUE:\n\t\t\t\t\t$pointer[\"color\"] = \"blue\";\n\t\t\t\t\t$color = \"blue\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GREEN:\n\t\t\t\t\t$pointer[\"color\"] = \"green\";\n\t\t\t\t\t$color = \"green\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::AQUA:\n\t\t\t\t\t$pointer[\"color\"] = \"aqua\";\n\t\t\t\t\t$color = \"aqua\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::RED:\n\t\t\t\t\t$pointer[\"color\"] = \"red\";\n\t\t\t\t\t$color = \"red\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::LIGHT_PURPLE:\n\t\t\t\t\t$pointer[\"color\"] = \"light_purple\";\n\t\t\t\t\t$color = \"light_purple\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::YELLOW:\n\t\t\t\t\t$pointer[\"color\"] = \"yellow\";\n\t\t\t\t\t$color = \"yellow\";\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::WHITE:\n\t\t\t\t\t$pointer[\"color\"] = \"white\";\n\t\t\t\t\t$color = \"white\";\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$pointer[\"text\"] = $token;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(isset($newString[\"extra\"])){\n\t\t\tforeach($newString[\"extra\"] as $k => $d){\n\t\t\t\tif(!isset($d[\"text\"])){\n\t\t\t\t\tunset($newString[\"extra\"][$k]);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn json_encode($newString, JSON_UNESCAPED_SLASHES);\n\t}\n\n\t/**\n\t * Returns an HTML-formatted string with colors/markup\n\t *\n\t * @param string|array $string\n\t *\n\t * @return string\n\t */\n\tpublic static function toHTML($string){\n\t\tif(!is_array($string)){\n\t\t\t$string = self::tokenize($string);\n\t\t}\n\t\t$newString = \"\";\n\t\t$tokens = 0;\n\t\tforeach($string as $token){\n\t\t\tswitch($token){\n\t\t\t\tcase TextFormat::BOLD:\n\t\t\t\t\t$newString .= \"<span style=font-weight:bold>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::OBFUSCATED:\n\t\t\t\t\t//$newString .= \"<span style=text-decoration:line-through>\";\n\t\t\t\t\t//++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::ITALIC:\n\t\t\t\t\t$newString .= \"<span style=font-style:italic>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::UNDERLINE:\n\t\t\t\t\t$newString .= \"<span style=text-decoration:underline>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::STRIKETHROUGH:\n\t\t\t\t\t$newString .= \"<span style=text-decoration:line-through>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::RESET:\n\t\t\t\t\t$newString .= str_repeat(\"</span>\", $tokens);\n\t\t\t\t\t$tokens = 0;\n\t\t\t\t\tbreak;\n\n\t\t\t\t//Colors\n\t\t\t\tcase TextFormat::BLACK:\n\t\t\t\t\t$newString .= \"<span style=color:#000>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_BLUE:\n\t\t\t\t\t$newString .= \"<span style=color:#00A>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_GREEN:\n\t\t\t\t\t$newString .= \"<span style=color:#0A0>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_AQUA:\n\t\t\t\t\t$newString .= \"<span style=color:#0AA>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_RED:\n\t\t\t\t\t$newString .= \"<span style=color:#A00>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_PURPLE:\n\t\t\t\t\t$newString .= \"<span style=color:#A0A>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GOLD:\n\t\t\t\t\t$newString .= \"<span style=color:#FA0>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GRAY:\n\t\t\t\t\t$newString .= \"<span style=color:#AAA>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_GRAY:\n\t\t\t\t\t$newString .= \"<span style=color:#555>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::BLUE:\n\t\t\t\t\t$newString .= \"<span style=color:#55F>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GREEN:\n\t\t\t\t\t$newString .= \"<span style=color:#5F5>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::AQUA:\n\t\t\t\t\t$newString .= \"<span style=color:#5FF>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::RED:\n\t\t\t\t\t$newString .= \"<span style=color:#F55>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::LIGHT_PURPLE:\n\t\t\t\t\t$newString .= \"<span style=color:#F5F>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::YELLOW:\n\t\t\t\t\t$newString .= \"<span style=color:#FF5>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::WHITE:\n\t\t\t\t\t$newString .= \"<span style=color:#FFF>\";\n\t\t\t\t\t++$tokens;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$newString .= $token;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t$newString .= str_repeat(\"</span>\", $tokens);\n\n\t\treturn $newString;\n\t}\n\n\t/**\n\t * Returns a string with colorized ANSI Escape codes\n\t *\n\t * @param $string\n\t *\n\t * @return string\n\t */\n\tpublic static function toANSI($string){\n\t\tif(!is_array($string)){\n\t\t\t$string = self::tokenize($string);\n\t\t}\n\n\t\t$newString = \"\";\n\t\tforeach($string as $token){\n\t\t\tswitch($token){\n\t\t\t\tcase TextFormat::BOLD:\n\t\t\t\t\t$newString .= Terminal::$FORMAT_BOLD;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::OBFUSCATED:\n\t\t\t\t\t$newString .= Terminal::$FORMAT_OBFUSCATED;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::ITALIC:\n\t\t\t\t\t$newString .= Terminal::$FORMAT_ITALIC;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::UNDERLINE:\n\t\t\t\t\t$newString .= Terminal::$FORMAT_UNDERLINE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::STRIKETHROUGH:\n\t\t\t\t\t$newString .= Terminal::$FORMAT_STRIKETHROUGH;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::RESET:\n\t\t\t\t\t$newString .= Terminal::$FORMAT_RESET;\n\t\t\t\t\tbreak;\n\n\t\t\t\t//Colors\n\t\t\t\tcase TextFormat::BLACK:\n\t\t\t\t\t$newString .= Terminal::$COLOR_BLACK;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_BLUE:\n\t\t\t\t\t$newString .= Terminal::$COLOR_DARK_BLUE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_GREEN:\n\t\t\t\t\t$newString .= Terminal::$COLOR_DARK_GREEN;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_AQUA:\n\t\t\t\t\t$newString .= Terminal::$COLOR_DARK_AQUA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_RED:\n\t\t\t\t\t$newString .= Terminal::$COLOR_DARK_RED;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_PURPLE:\n\t\t\t\t\t$newString .= Terminal::$COLOR_PURPLE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GOLD:\n\t\t\t\t\t$newString .= Terminal::$COLOR_GOLD;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GRAY:\n\t\t\t\t\t$newString .= Terminal::$COLOR_GRAY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::DARK_GRAY:\n\t\t\t\t\t$newString .= Terminal::$COLOR_DARK_GRAY;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::BLUE:\n\t\t\t\t\t$newString .= Terminal::$COLOR_BLUE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::GREEN:\n\t\t\t\t\t$newString .= Terminal::$COLOR_GREEN;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::AQUA:\n\t\t\t\t\t$newString .= Terminal::$COLOR_AQUA;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::RED:\n\t\t\t\t\t$newString .= Terminal::$COLOR_RED;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::LIGHT_PURPLE:\n\t\t\t\t\t$newString .= Terminal::$COLOR_LIGHT_PURPLE;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::YELLOW:\n\t\t\t\t\t$newString .= Terminal::$COLOR_YELLOW;\n\t\t\t\t\tbreak;\n\t\t\t\tcase TextFormat::WHITE:\n\t\t\t\t\t$newString .= Terminal::$COLOR_WHITE;\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\t$newString .= $token;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn $newString;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/utils/UUID.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nclass UUID{\n\n\tprivate $parts = [0, 0, 0, 0];\n\tprivate $version = null;\n\n\tpublic function __construct($part1 = 0, $part2 = 0, $part3 = 0, $part4 = 0, $version = null){\n\t\t$this->parts[0] = (int) $part1;\n\t\t$this->parts[1] = (int) $part2;\n\t\t$this->parts[2] = (int) $part3;\n\t\t$this->parts[3] = (int) $part4;\n\n\t\t$this->version = $version === null ? ($this->parts[1] & 0xf000) >> 12 : (int) $version;\n\t}\n\n\tpublic function getVersion(){\n\t\treturn $this->version;\n\t}\n\n\tpublic function equals(UUID $uuid){\n\t\treturn $uuid->parts[0] === $this->parts[0] and $uuid->parts[1] === $this->parts[1] and $uuid->parts[2] === $this->parts[2] and $uuid->parts[3] === $this->parts[3];\n\t}\n\n\t/**\n\t * Creates an UUID from an hexadecimal representation\n\t *\n\t * @param string $uuid\n\t * @param int    $version\n\t * @return UUID\n\t */\n\tpublic static function fromString($uuid, $version = null){\n\t\treturn self::fromBinary(hex2bin(str_replace(\"-\", \"\", trim($uuid))), $version);\n\t}\n\n\t/**\n\t * Creates an UUID from a binary representation\n\t *\n\t * @param string $uuid\n\t * @param int    $version\n\t * @return UUID\n\t */\n\tpublic static function fromBinary($uuid, $version = null){\n\t\tif(strlen($uuid) !== 16){\n\t\t\tthrow new \\InvalidArgumentException(\"Must have exactly 16 bytes\");\n\t\t}\n\n\t\treturn new UUID(Binary::readInt(substr($uuid, 0, 4)), Binary::readInt(substr($uuid, 4, 4)), Binary::readInt(substr($uuid, 8, 4)), Binary::readInt(substr($uuid, 12, 4)), $version);\n\t}\n\n\t/**\n\t * Creates an UUIDv3 from binary data or list of binary data\n\t *\n\t * @param string ...$data\n\t * @return UUID\n\t */\n\tpublic static function fromData(...$data){\n\t\t$hash = hash(\"md5\", implode($data), true);\n\n\t\treturn self::fromBinary($hash, 3);\n\t}\n\n\tpublic static function fromRandom(){\n\t\treturn self::fromData(Binary::writeInt(time()), Binary::writeShort(getmypid()), Binary::writeShort(getmyuid()), Binary::writeInt(mt_rand(-0x7fffffff, 0x7fffffff)), Binary::writeInt(mt_rand(-0x7fffffff, 0x7fffffff)));\n\t}\n\n\tpublic function toBinary(){\n\t\treturn Binary::writeInt($this->parts[0]) . Binary::writeInt($this->parts[1]) . Binary::writeInt($this->parts[2]) . Binary::writeInt($this->parts[3]);\n\t}\n\n\tpublic function toString(){\n\t\t$hex = bin2hex(self::toBinary());\n\n\t\t//xxxxxxxx-xxxx-Mxxx-Nxxx-xxxxxxxxxxxx 8-4-4-12\n\t\tif($this->version !== null){\n\t\t\treturn substr($hex, 0, 8) . \"-\" . substr($hex, 8, 4) . \"-\" . hexdec($this->version) . substr($hex, 13, 3) . \"-8\" . substr($hex, 17, 3) . \"-\" . substr($hex, 20, 12);\n\t\t}\n\t\treturn substr($hex, 0, 8) . \"-\" . substr($hex, 8, 4) . \"-\" . substr($hex, 12, 4) . \"-\" . substr($hex, 16, 4) . \"-\" . substr($hex, 20, 12);\n\t}\n\n\tpublic function __toString(){\n\t\treturn $this->toString();\n\t}\n}"
  },
  {
    "path": "src/pocketmine/utils/Utils.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Various Utilities used around the code\n */\nnamespace pocketmine\\utils;\nuse pocketmine\\ThreadManager;\n\n/**\n * Big collection of functions\n */\nclass Utils{\n\tpublic static $online = true;\n\tpublic static $ip = false;\n\tpublic static $os;\n\tprivate static $serverUniqueId = null;\n\n\t/**\n\t * Generates an unique identifier to a callable\n\t *\n\t * @param callable $variable\n\t *\n\t * @return string\n\t */\n\tpublic static function getCallableIdentifier(callable $variable){\n\t\tif(is_array($variable)){\n\t\t\treturn sha1(strtolower(spl_object_hash($variable[0])) . \"::\" . strtolower($variable[1]));\n\t\t}else{\n\t\t\treturn sha1(strtolower($variable));\n\t\t}\n\t}\n\n\t/**\n\t * Gets this machine / server instance unique ID\n\t * Returns a hash, the first 32 characters (or 16 if raw)\n\t * will be an identifier that won't change frequently.\n\t * The rest of the hash will change depending on other factors.\n\t *\n\t * @param string $extra optional, additional data to identify the machine\n\t *\n\t * @return UUID\n\t */\n\tpublic static function getMachineUniqueId($extra = \"\"){\n\t\tif(self::$serverUniqueId !== null and $extra === \"\"){\n\t\t\treturn self::$serverUniqueId;\n\t\t}\n\n\t\t$machine = php_uname(\"a\");\n\t\t$machine .= file_exists(\"/proc/cpuinfo\") ? implode(preg_grep(\"/(model name|Processor|Serial)/\", file(\"/proc/cpuinfo\"))) : \"\";\n\t\t$machine .= sys_get_temp_dir();\n\t\t$machine .= $extra;\n\t\t$os = Utils::getOS();\n\t\tif($os === \"win\"){\n\t\t\t@exec(\"ipconfig /ALL\", $mac);\n\t\t\t$mac = implode(\"\\n\", $mac);\n\t\t\tif(preg_match_all(\"#Physical Address[. ]{1,}: ([0-9A-F\\\\-]{17})#\", $mac, $matches)){\n\t\t\t\tforeach($matches[1] as $i => $v){\n\t\t\t\t\tif($v == \"00-00-00-00-00-00\"){\n\t\t\t\t\t\tunset($matches[1][$i]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t$machine .= implode(\" \", $matches[1]); //Mac Addresses\n\t\t\t}\n\t\t}elseif($os === \"linux\"){\n\t\t\tif(file_exists(\"/etc/machine-id\")){\n\t\t\t\t$machine .= file_get_contents(\"/etc/machine-id\");\n\t\t\t}else{\n\t\t\t\t@exec(\"ifconfig\", $mac);\n\t\t\t\t$mac = implode(\"\\n\", $mac);\n\t\t\t\tif(preg_match_all(\"#HWaddr[ \\t]{1,}([0-9a-f:]{17})#\", $mac, $matches)){\n\t\t\t\t\tforeach($matches[1] as $i => $v){\n\t\t\t\t\t\tif($v == \"00:00:00:00:00:00\"){\n\t\t\t\t\t\t\tunset($matches[1][$i]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\t$machine .= implode(\" \", $matches[1]); //Mac Addresses\n\t\t\t\t}\n\t\t\t}\n\t\t}elseif($os === \"android\"){\n\t\t\t$machine .= @file_get_contents(\"/system/build.prop\");\n\t\t}elseif($os === \"mac\"){\n\t\t\t$machine .= `system_profiler SPHardwareDataType | grep UUID`;\n\t\t}\n\t\t$data = $machine . PHP_MAXPATHLEN;\n\t\t$data .= PHP_INT_MAX;\n\t\t$data .= PHP_INT_SIZE;\n\t\t$data .= get_current_user();\n\t\tforeach(get_loaded_extensions() as $ext){\n\t\t\t$data .= $ext . \":\" . phpversion($ext);\n\t\t}\n\n\t\t$uuid = UUID::fromData($machine, $data);\n\n\t\tif($extra === \"\"){\n\t\t\tself::$serverUniqueId = $uuid;\n\t\t}\n\n\t\treturn $uuid;\n\t}\n\n\t/**\n\t * Gets the External IP using an external service, it is cached\n\t *\n\t * @param bool $force default false, force IP check even when cached\n\t *\n\t * @return string\n\t */\n\n\tpublic static function getIP($force = false){\n\t\tif(Utils::$online === false){\n\t\t\treturn false;\n\t\t}elseif(Utils::$ip !== false and $force !== true){\n\t\t\treturn Utils::$ip;\n\t\t}\n\t\t$ip = trim(strip_tags(Utils::getURL(\"https://api.ipify.org\")));\n\t\tif($ip){\n\t\t\tUtils::$ip = $ip;\n\t\t}else{\n\t\t\t$ip = Utils::getURL(\"http://www.checkip.org/\");\n\t\t\tif(preg_match('#\">([0-9a-fA-F\\:\\.]*)</span>#', $ip, $matches) > 0){\n\t\t\t\tUtils::$ip = $matches[1];\n\t\t\t}else{\n\t\t\t\t$ip = Utils::getURL(\"http://checkmyip.org/\");\n\t\t\t\tif(preg_match('#Your IP address is ([0-9a-fA-F\\:\\.]*)#', $ip, $matches) > 0){\n\t\t\t\t\tUtils::$ip = $matches[1];\n\t\t\t\t}else{\n\t\t\t\t\t$ip = trim(Utils::getURL(\"http://ifconfig.me/ip\"));\n\t\t\t\t\tif($ip != \"\"){\n\t\t\t\t\t\tUtils::$ip = $ip;\n\t\t\t\t\t}else{\n\t\t\t\t\t\treturn false;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn Utils::$ip;\n\n\t}\n\n\t/**\n\t * Returns the current Operating System\n\t * Windows => win\n\t * MacOS => mac\n\t * iOS => ios\n\t * Android => android\n\t * Linux => Linux\n\t * BSD => bsd\n\t * Other => other\n\t *\n\t * @return string\n\t */\n\tpublic static function getOS($recalculate = false){\n\t\tif(self::$os === null or $recalculate){\n\t\t\t$uname = php_uname(\"s\");\n\t\t\tif(stripos($uname, \"Darwin\") !== false){\n\t\t\t\tif(strpos(php_uname(\"m\"), \"iP\") === 0){\n\t\t\t\t\tself::$os = \"ios\";\n\t\t\t\t}else{\n\t\t\t\t\tself::$os = \"mac\";\n\t\t\t\t}\n\t\t\t}elseif(stripos($uname, \"Win\") !== false or $uname === \"Msys\"){\n\t\t\t\tself::$os = \"win\";\n\t\t\t}elseif(stripos($uname, \"Linux\") !== false){\n\t\t\t\tif(@file_exists(\"/system/build.prop\")){\n\t\t\t\t\tself::$os = \"android\";\n\t\t\t\t}else{\n\t\t\t\t\tself::$os = \"linux\";\n\t\t\t\t}\n\t\t\t}elseif(stripos($uname, \"BSD\") !== false or $uname === \"DragonFly\"){\n\t\t\t\tself::$os = \"bsd\";\n\t\t\t}else{\n\t\t\t\tself::$os = \"other\";\n\t\t\t}\n\t\t}\n\t\t\n\t\treturn self::$os;\n\t}\n\n\n\tpublic static function getRealMemoryUsage(){\n\t\t$stack = 0;\n\t\t$heap = 0;\n\n\t\tif(Utils::getOS() === \"linux\" or Utils::getOS() === \"android\"){\n\t\t\t$mappings = file(\"/proc/self/maps\");\n\t\t\tforeach($mappings as $line){\n\t\t\t\tif(preg_match(\"#([a-z0-9]+)\\\\-([a-z0-9]+) [rwxp\\\\-]{4} [a-z0-9]+ [^\\\\[]*\\\\[([a-zA-z0-9]+)\\\\]#\", trim($line), $matches) > 0){\n\t\t\t\t\tif(strpos($matches[3], \"heap\") === 0){\n\t\t\t\t\t\t$heap += hexdec($matches[2]) - hexdec($matches[1]);\n\t\t\t\t\t}elseif(strpos($matches[3], \"stack\") === 0){\n\t\t\t\t\t\t$stack += hexdec($matches[2]) - hexdec($matches[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn [$heap, $stack];\n\t}\n\n\tpublic static function getMemoryUsage($advanced = false){\n\t\t$reserved = memory_get_usage();\n\t\t$VmSize = null;\n\t\t$VmRSS = null;\n\t\tif(Utils::getOS() === \"linux\" or Utils::getOS() === \"android\"){\n\t\t\t$status = file_get_contents(\"/proc/self/status\");\n\t\t\tif(preg_match(\"/VmRSS:[ \\t]+([0-9]+) kB/\", $status, $matches) > 0){\n\t\t\t\t$VmRSS = $matches[1] * 1024;\n\t\t\t}\n\n\t\t\tif(preg_match(\"/VmSize:[ \\t]+([0-9]+) kB/\", $status, $matches) > 0){\n\t\t\t\t$VmSize = $matches[1] * 1024;\n\t\t\t}\n\t\t}\n\n\t\t//TODO: more OS\n\n\t\tif($VmRSS === null){\n\t\t\t$VmRSS = memory_get_usage();\n\t\t}\n\n\t\tif(!$advanced){\n\t\t\treturn $VmRSS;\n\t\t}\n\n\t\tif($VmSize === null){\n\t\t\t$VmSize = memory_get_usage(true);\n\t\t}\n\n\t\treturn [$reserved, $VmRSS, $VmSize];\n\t}\n\n\tpublic static function getThreadCount(){\n\t\tif(Utils::getOS() === \"linux\" or Utils::getOS() === \"android\"){\n\t\t\tif(preg_match(\"/Threads:[ \\t]+([0-9]+)/\", file_get_contents(\"/proc/self/status\"), $matches) > 0){\n\t\t\t\treturn (int) $matches[1];\n\t\t\t}\n\t\t}\n\t\t//TODO: more OS\n\n\t\treturn count(ThreadManager::getInstance()->getAll()) + 3; //RakLib + MainLogger + Main Thread\n\t}\n\n\tpublic static function getCoreCount($recalculate = false){\n\t\tstatic $processors = 0;\n\n\t\tif($processors > 0 and !$recalculate){\n\t\t\treturn $processors;\n\t\t}else{\n\t\t\t$processors = 0;\n\t\t}\n\n\t\tswitch(Utils::getOS()){\n\t\t\tcase \"linux\":\n\t\t\tcase \"android\":\n\t\t\t\tif(file_exists(\"/proc/cpuinfo\")){\n\t\t\t\t\tforeach(file(\"/proc/cpuinfo\") as $l){\n\t\t\t\t\t\tif(preg_match('/^processor[ \\t]*:[ \\t]*[0-9]+$/m', $l) > 0){\n\t\t\t\t\t\t\t++$processors;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}else{\n\t\t\t\t\tif(preg_match(\"/^([0-9]+)\\\\-([0-9]+)$/\", trim(@file_get_contents(\"/sys/devices/system/cpu/present\")), $matches) > 0){\n\t\t\t\t\t\t$processors = (int) ($matches[2] - $matches[1]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \"bsd\":\n\t\t\tcase \"mac\":\n\t\t\t\t$processors = (int) `sysctl -n hw.ncpu`;\n\t\t\t\t$processors = (int) `sysctl -n hw.ncpu`;\n\t\t\t\tbreak;\n\t\t\tcase \"win\":\n\t\t\t\t$processors = (int) getenv(\"NUMBER_OF_PROCESSORS\");\n\t\t\t\tbreak;\n\t\t}\n\t\treturn $processors;\n\t}\n\n\t/**\n\t * Returns a prettified hexdump\n\t *\n\t * @param string $bin\n\t *\n\t * @return string\n\t */\n\tpublic static function hexdump($bin){\n\t\t$output = \"\";\n\t\t$bin = str_split($bin, 16);\n\t\tforeach($bin as $counter => $line){\n\t\t\t$hex = chunk_split(chunk_split(str_pad(bin2hex($line), 32, \" \", STR_PAD_RIGHT), 2, \" \"), 24, \" \");\n\t\t\t$ascii = preg_replace('#([^\\x20-\\x7E])#', \".\", $line);\n\t\t\t$output .= str_pad(dechex($counter << 4), 4, \"0\", STR_PAD_LEFT) . \"  \" . $hex . \" \" . $ascii . PHP_EOL;\n\t\t}\n\n\t\treturn $output;\n\t}\n\n\n\t/**\n\t * Returns a string that can be printed, replaces non-printable characters\n\t *\n\t * @param $str\n\t *\n\t * @return string\n\t */\n\tpublic static function printable($str){\n\t\tif(!is_string($str)){\n\t\t\treturn gettype($str);\n\t\t}\n\n\t\treturn preg_replace('#([^\\x20-\\x7E])#', '.', $str);\n\t}\n\n\t/**\n\t * This function tries to get all the entropy available in PHP, and distills it to get a good RNG.\n\t *\n\t * This function simply forwards to the PHP random_bytes function.\n\t *\n\t * @param int    $length       default 16, Number of bytes to generate\n\t * @param bool   $secure       default true, Generate secure distilled bytes, slower\n\t * @param bool   $raw          default true, returns a binary string if true, or an hexadecimal one\n\t * @param string $startEntropy default null, adds more initial entropy\n\t * @param int    &$rounds      Will be set to the number of rounds taken\n\t * @param int    &$drop        Will be set to the amount of dropped bytes\n\t *\n\t * @deprecated prefer PHP 7 random_bytes()\n\t * @return string\n\t */\n\tpublic static function getRandomBytes($length = 16, $secure = true, $raw = true, $startEntropy = \"\", &$rounds = 0, &$drop = 0){\n\t\t$raw_output = random_bytes($length);\n\t\tif ($raw) {\n\t\t\treturn $raw_output;\n\t\t} else {\n\t\t\treturn bin2hex($raw_output);\n\t\t}\n\t}\n\n\t/*\n\tpublic static function angle3D($pos1, $pos2){\n\t\t$X = $pos1[\"x\"] - $pos2[\"x\"];\n\t\t$Z = $pos1[\"z\"] - $pos2[\"z\"];\n\t\t$dXZ = sqrt(pow($X, 2) + pow($Z, 2));\n\t\t$Y = $pos1[\"y\"] - $pos2[\"y\"];\n\t\t$hAngle = rad2deg(atan2($Z, $X) - M_PI_2);\n\t\t$vAngle = rad2deg(-atan2($Y, $dXZ));\n\n\t\treturn array(\"yaw\" => $hAngle, \"pitch\" => $vAngle);\n\t}*/\n\n\t/**\n\t * GETs an URL using cURL\n\t *\n\t * @param     $page\n\t * @param int $timeout default 10\n\t * @param array $extraHeaders\n\t *\n\t * @return bool|mixed\n\t */\n\tpublic static function getURL($page, $timeout = 10, array $extraHeaders = []){\n\t\tif(Utils::$online === false){\n\t\t\treturn false;\n\t\t}\n\n\t\t$ch = curl_init($page);\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array_merge([\"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP\"], $extraHeaders));\n\t\tcurl_setopt($ch, CURLOPT_AUTOREFERER, true);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n\t\tcurl_setopt($ch, CURLOPT_FORBID_REUSE, 1);\n\t\tcurl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);\n\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int) $timeout);\n\t\tcurl_setopt($ch, CURLOPT_TIMEOUT, (int) $timeout);\n\t\t$ret = curl_exec($ch);\n\t\tcurl_close($ch);\n\n\t\treturn $ret;\n\t}\n\n\t/**\n\t * POSTs data to an URL\n\t *\n\t * @param              $page\n\t * @param array|string $args\n\t * @param int          $timeout\n\t * @param array $extraHeaders\n\t *\n\t * @return bool|mixed\n\t */\n\tpublic static function postURL($page, $args, $timeout = 10, array $extraHeaders = []){\n\t\tif(Utils::$online === false){\n\t\t\treturn false;\n\t\t}\n\n\t\t$ch = curl_init($page);\n\t\tcurl_setopt($ch, CURLOPT_POST, 1);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);\n\t\tcurl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);\n\t\tcurl_setopt($ch, CURLOPT_FORBID_REUSE, 1);\n\t\tcurl_setopt($ch, CURLOPT_FRESH_CONNECT, 1);\n\t\tcurl_setopt($ch, CURLOPT_POSTFIELDS, $args);\n\t\tcurl_setopt($ch, CURLOPT_AUTOREFERER, true);\n\t\tcurl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);\n\t\tcurl_setopt($ch, CURLOPT_HTTPHEADER, array_merge([\"User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:12.0) Gecko/20100101 Firefox/12.0 PocketMine-MP\"], $extraHeaders));\n\t\tcurl_setopt($ch, CURLOPT_RETURNTRANSFER, true);\n\t\tcurl_setopt($ch, CURLOPT_CONNECTTIMEOUT, (int) $timeout);\n\t\tcurl_setopt($ch, CURLOPT_TIMEOUT, (int) $timeout);\n\t\t$ret = curl_exec($ch);\n\t\tcurl_close($ch);\n\n\t\treturn $ret;\n\t}\n\n\tpublic static function javaStringHash($string){\n\t\t$hash = 0;\n\t\tfor($i = 0; $i < strlen($string); $i++){\n\t\t\t$ord = ord($string{$i});\n\t\t\tif($ord & 0x80){\n\t\t\t\t$ord -= 0x100;\n\t\t\t}\n\t\t\t$hash = 31 * $hash + $ord;\n\t\t\twhile($hash > 0x7FFFFFFF){\n\t\t\t\t$hash -= 0x100000000;\n\t\t\t}\n\t\t\twhile($hash < -0x80000000){\n\t\t\t\t$hash += 0x100000000;\n\t\t\t}\n\t\t\t$hash &= 0xFFFFFFFF;\n\t\t}\n\t\treturn $hash;\n\t}\n\n}\n"
  },
  {
    "path": "src/pocketmine/utils/VectorIterator.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace pocketmine\\utils;\n\nuse pocketmine\\block\\Block;\nuse pocketmine\\level\\ChunkManager;\nuse pocketmine\\level\\Level;\nuse pocketmine\\math\\Vector3;\n\n/**\n * This class performs ray tracing and iterates along blocks on a line\n */\nclass VectorIterator implements \\Iterator{\n\n\t/** @var ChunkManager */\n\tprivate $level;\n\tprivate $maxDistance;\n\n\tprivate static $gridSize = 16777216; //1 << 24\n\n\tprivate $end = false;\n\n\t/** @var \\SplFixedArray<Vector3>[3] */\n\tprivate $positionQueue;\n\tprivate $currentBlock = 0;\n\t/** @var Vector3 */\n\tprivate $currentBlockObject = null;\n\tprivate $currentDistance = 0;\n\tprivate $maxDistanceInt = 0;\n\n\tprivate $secondError;\n\tprivate $thirdError;\n\n\tprivate $secondStep;\n\tprivate $thirdStep;\n\n\tprivate $mainFace;\n\tprivate $secondFace;\n\tprivate $thirdFace;\n\n\tpublic function __construct(ChunkManager $level, Vector3 $from, Vector3 $to){\n\t\tif($from->equals($to)){\n\t\t\t$this->end = true;\n\t\t\t$this->currentBlock = -1;\n\t\t\treturn;\n\t\t}\n\t\t$direction = $to->subtract($from)->normalize();\n\t\t$maxDistance = $from->distance($to);\n\t\t$this->level = $level;\n\t\t$this->maxDistance = (int) $maxDistance;\n\t\t$this->positionQueue = new \\SplFixedArray(3);\n\n\t\t$startClone = new Vector3($from->x, $from->y, $from->z);\n\n\t\t$this->currentDistance = 0;\n\n\t\t$mainDirection = 0;\n\t\t$secondDirection = 0;\n\t\t$thirdDirection = 0;\n\n\t\t$mainPosition = 0;\n\t\t$secondPosition = 0;\n\t\t$thirdPosition = 0;\n\n\t\t$pos = new Vector3($startClone->x, $startClone->y, $startClone->z);\n\t\t$startBlock = new Vector3(floor($pos->x), floor($pos->y), floor($pos->z));\n\n\t\tif($this->getXLength($direction) > $mainDirection){\n\t\t\t$this->mainFace = $this->getXFace($direction);\n\t\t\t$mainDirection = $this->getXLength($direction);\n\t\t\t$mainPosition = $this->getXPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->secondFace = $this->getYFace($direction);\n\t\t\t$secondDirection = $this->getYLength($direction);\n\t\t\t$secondPosition = $this->getYPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->thirdFace = $this->getZFace($direction);\n\t\t\t$thirdDirection = $this->getZLength($direction);\n\t\t\t$thirdPosition = $this->getZPosition($direction, $startClone, $startBlock);\n\t\t}\n\t\tif($this->getYLength($direction) > $mainDirection){\n\t\t\t$this->mainFace = $this->getYFace($direction);\n\t\t\t$mainDirection = $this->getYLength($direction);\n\t\t\t$mainPosition = $this->getYPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->secondFace = $this->getZFace($direction);\n\t\t\t$secondDirection = $this->getZLength($direction);\n\t\t\t$secondPosition = $this->getZPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->thirdFace = $this->getXFace($direction);\n\t\t\t$thirdDirection = $this->getXLength($direction);\n\t\t\t$thirdPosition = $this->getXPosition($direction, $startClone, $startBlock);\n\t\t}\n\t\tif($this->getZLength($direction) > $mainDirection){\n\t\t\t$this->mainFace = $this->getZFace($direction);\n\t\t\t$mainDirection = $this->getZLength($direction);\n\t\t\t$mainPosition = $this->getZPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->secondFace = $this->getXFace($direction);\n\t\t\t$secondDirection = $this->getXLength($direction);\n\t\t\t$secondPosition = $this->getXPosition($direction, $startClone, $startBlock);\n\n\t\t\t$this->thirdFace = $this->getYFace($direction);\n\t\t\t$thirdDirection = $this->getYLength($direction);\n\t\t\t$thirdPosition = $this->getYPosition($direction, $startClone, $startBlock);\n\t\t}\n\n\t\t$d = $mainPosition / $mainDirection;\n\t\t$secondd = $secondPosition - $secondDirection * $d;\n\t\t$thirdd = $thirdPosition - $thirdDirection * $d;\n\n\t\t$this->secondError = floor($secondd * self::$gridSize);\n\t\t$this->secondStep = round($secondDirection / $mainDirection * self::$gridSize);\n\t\t$this->thirdError = floor($thirdd * self::$gridSize);\n\t\t$this->thirdStep = round($thirdDirection / $mainDirection * self::$gridSize);\n\n\t\tif($this->secondError + $this->secondStep <= 0){\n\t\t\t$this->secondError = -$this->secondStep + 1;\n\t\t}\n\n\t\tif($this->thirdError + $this->thirdStep <= 0){\n\t\t\t$this->thirdError = -$this->thirdStep + 1;\n\t\t}\n\n\t\t$lastBlock = $startBlock->getSide(Vector3::getOppositeSide($this->mainFace));\n\n\t\tif($this->secondError < 0){\n\t\t\t$this->secondError += self::$gridSize;\n\t\t\t$lastBlock = $lastBlock->getSide(Vector3::getOppositeSide($this->secondFace));\n\t\t}\n\n\t\tif($this->thirdError < 0){\n\t\t\t$this->thirdError += self::$gridSize;\n\t\t\t$lastBlock = $lastBlock->getSide(Vector3::getOppositeSide($this->thirdFace));\n\t\t}\n\n\t\t$this->secondError -= self::$gridSize;\n\t\t$this->thirdError -= self::$gridSize;\n\n\t\t$this->positionQueue[0] = $lastBlock;\n\n\t\t$this->currentBlock = -1;\n\n\t\t$this->scan();\n\n\t\t$startBlockFound = false;\n\n\t\tfor($cnt = $this->currentBlock; $cnt >= 0; --$cnt){\n\t\t\tif($this->posEquals($this->positionQueue[$cnt], $startBlock)){\n\t\t\t\t$this->currentBlock = $cnt;\n\t\t\t\t$startBlockFound = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tif(!$startBlockFound){\n\t\t\tthrow new \\InvalidStateException(\"Start block missed in BlockIterator\");\n\t\t}\n\n\t\t$this->maxDistanceInt = round($maxDistance / (sqrt($mainDirection ** 2 + $secondDirection ** 2 + $thirdDirection ** 2) / $mainDirection));\n\t}\n\n\tprivate function posEquals(Vector3 $a, Vector3 $b){\n\t\treturn $a->x === $b->x and $a->y === $b->y and $a->z === $b->z;\n\t}\n\n\tprivate function getXFace(Vector3 $direction){\n\t\treturn (($direction->x) > 0) ? Vector3::SIDE_EAST : Vector3::SIDE_WEST;\n\t}\n\n\tprivate function getYFace(Vector3 $direction){\n\t\treturn (($direction->y) > 0) ? Vector3::SIDE_UP : Vector3::SIDE_DOWN;\n\t}\n\n\tprivate function getZFace(Vector3 $direction){\n\t\treturn (($direction->z) > 0) ? Vector3::SIDE_SOUTH : Vector3::SIDE_NORTH;\n\t}\n\n\tprivate function getXLength(Vector3 $direction){\n\t\treturn abs($direction->x);\n\t}\n\n\tprivate function getYLength(Vector3 $direction){\n\t\treturn abs($direction->y);\n\t}\n\n\tprivate function getZLength(Vector3 $direction){\n\t\treturn abs($direction->z);\n\t}\n\n\tprivate function getPosition($direction, $position, $blockPosition){\n\t\treturn $direction > 0 ? ($position - $blockPosition) : ($blockPosition + 1 - $position);\n\t}\n\n\tprivate function getXPosition(Vector3 $direction, Vector3 $position, Vector3 $block){\n\t\treturn $this->getPosition($direction->x, $position->x, $block->x);\n\t}\n\n\tprivate function getYPosition(Vector3 $direction, Vector3 $position, Vector3 $block){\n\t\treturn $this->getPosition($direction->y, $position->y, $block->y);\n\t}\n\n\tprivate function getZPosition(Vector3 $direction, Vector3 $position, Vector3 $block){\n\t\treturn $this->getPosition($direction->z, $position->z, $block->z);\n\t}\n\n\tpublic function next(){\n\t\t$this->scan();\n\n\t\tif($this->currentBlock <= -1){\n\t\t\tthrow new \\OutOfBoundsException;\n\t\t}else{\n\t\t\t$this->currentBlockObject = $this->positionQueue[$this->currentBlock--];\n\t\t}\n\t}\n\n\t/**\n\t * @return Block\n\t *\n\t * @throws \\OutOfBoundsException\n\t */\n\tpublic function current(){\n\t\tif($this->currentBlockObject === null){\n\t\t\tthrow new \\OutOfBoundsException;\n\t\t}\n\t\treturn $this->currentBlockObject;\n\t}\n\n\tpublic function rewind(){\n\t\tthrow new \\InvalidStateException(\"BlockIterator doesn't support rewind()\");\n\t}\n\n\tpublic function key(){\n\t\treturn $this->currentBlock - 1;\n\t}\n\n\tpublic function valid(){\n\t\t$this->scan();\n\t\treturn $this->currentBlock !== -1;\n\t}\n\n\tprivate function scan(){\n\t\tif($this->currentBlock >= 0){\n\t\t\treturn;\n\t\t}\n\n\t\tif($this->maxDistance !== 0 and $this->currentDistance > $this->maxDistanceInt){\n\t\t\t$this->end = true;\n\t\t\treturn;\n\t\t}\n\n\t\tif($this->end){\n\t\t\treturn;\n\t\t}\n\n\t\t++$this->currentDistance;\n\n\t\t$this->secondError += $this->secondStep;\n\t\t$this->thirdError += $this->thirdStep;\n\n\t\tif($this->secondError > 0 and $this->thirdError > 0){\n\t\t\t$this->positionQueue[2] = $this->positionQueue[0]->getSide($this->mainFace);\n\n\t\t\tif(($this->secondStep * $this->thirdError) < ($this->thirdStep * $this->secondError)){\n\t\t\t\t$this->positionQueue[1] = $this->positionQueue[2]->getSide($this->secondFace);\n\t\t\t\t$this->positionQueue[0] = $this->positionQueue[1]->getSide($this->thirdFace);\n\t\t\t}else{\n\t\t\t\t$this->positionQueue[1] = $this->positionQueue[2]->getSide($this->thirdFace);\n\t\t\t\t$this->positionQueue[0] = $this->positionQueue[1]->getSide($this->secondFace);\n\t\t\t}\n\n\t\t\t$this->thirdError -= self::$gridSize;\n\t\t\t$this->secondError -= self::$gridSize;\n\t\t\t$this->currentBlock = 2;\n\t\t}elseif($this->secondError > 0){\n\t\t\t$this->positionQueue[1] = $this->positionQueue[0]->getSide($this->mainFace);\n\t\t\t$this->positionQueue[0] = $this->positionQueue[1]->getSide($this->secondFace);\n\t\t\t$this->secondError -= self::$gridSize;\n\t\t\t$this->currentBlock = 1;\n\t\t}elseif($this->thirdError > 0){\n\t\t\t$this->positionQueue[1] = $this->positionQueue[0]->getSide($this->mainFace);\n\t\t\t$this->positionQueue[0] = $this->positionQueue[1]->getSide($this->thirdFace);\n\t\t\t$this->thirdError -= self::$gridSize;\n\t\t\t$this->currentBlock = 1;\n\t\t}else{\n\t\t\t$this->positionQueue[0] = $this->positionQueue[0]->getSide($this->mainFace);\n\t\t\t$this->currentBlock = 0;\n\t\t}\n\t}\n}"
  },
  {
    "path": "src/pocketmine/utils/VersionString.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\utils;\n\n\n/**\n * Manages PocketMine-MP version strings, and compares them\n */\nclass VersionString{\n\tprivate $major;\n\tprivate $build;\n\tprivate $minor;\n\tprivate $development = false;\n\n\tpublic function __construct($version = \\pocketmine\\VERSION){\n\t\tif(is_int($version)){\n\t\t\t$this->minor = $version & 0x1F;\n\t\t\t$this->major = ($version >> 5) & 0x0F;\n\t\t\t$this->generation = ($version >> 9) & 0x0F;\n\t\t}else{\n\t\t\t$this->generation = 0;\n\t\t\t$this->major = 0;\n\t\t\t$this->minor = 0;\n\t\t\t$this->development = true;\n\t\t\t$this->build = 0;\n\t\t}\n\t}\n\n\tpublic function getNumber(){\n\t\treturn (int) (($this->generation << 9) + ($this->major << 5) + $this->minor);\n\t}\n\n\t/**\n\t * @deprecated\n\t */\n\tpublic function getStage(){\n\t\treturn \"final\";\n\t}\n\n\tpublic function getGeneration(){\n\t\treturn $this->generation;\n\t}\n\n\tpublic function getMajor(){\n\t\treturn $this->major;\n\t}\n\n\tpublic function getMinor(){\n\t\treturn $this->minor;\n\t}\n\n\tpublic function getRelease(){\n\t\treturn $this->generation . \".\" . $this->major . ($this->minor > 0 ? \".\" . $this->minor : \"\");\n\t}\n\n\tpublic function getBuild(){\n\t\treturn $this->build;\n\t}\n\n\tpublic function isDev(){\n\t\treturn $this->development === true;\n\t}\n\n\tpublic function get($build = false){\n\t\treturn $this->getRelease() . ($this->development === true ? \"dev\" : \"\") . (($this->build > 0 and $build === true) ? \"-\" . $this->build : \"\");\n\t}\n\n\tpublic function __toString(){\n\t\treturn $this->get();\n\t}\n\n\tpublic function compare($target, $diff = false){\n\t\tif(($target instanceof VersionString) === false){\n\t\t\t$target = new VersionString($target);\n\t\t}\n\t\t$number = $this->getNumber();\n\t\t$tNumber = $target->getNumber();\n\t\tif($diff === true){\n\t\t\treturn $tNumber - $number;\n\t\t}\n\t\tif($number > $tNumber){\n\t\t\treturn -1; //Target is older\n\t\t}elseif($number < $tNumber){\n\t\t\treturn 1; //Target is newer\n\t\t}elseif($target->getBuild() > $this->getBuild()){\n\t\t\treturn 1;\n\t\t}elseif($target->getBuild() < $this->getBuild()){\n\t\t\treturn -1;\n\t\t}else{\n\t\t\treturn 0; //Same version\n\t\t}\n\t}\n}\n"
  },
  {
    "path": "src/pocketmine/wizard/Installer.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\n/**\n * Set-up wizard used on the first run\n * Can be disabled with --no-wizard\n */\nnamespace pocketmine\\wizard;\n\nuse pocketmine\\utils\\Config;\nuse pocketmine\\utils\\Utils;\n\nclass Installer{\n\tconst DEFAULT_NAME = \"Minecraft: PE Server\";\n\tconst DEFAULT_PORT = 19132;\n\tconst DEFAULT_MEMORY = 512;\n\tconst DEFAULT_PLAYERS = 20;\n\tconst DEFAULT_GAMEMODE = 0;\n\tconst DEFAULT_LEVEL_NAME = \"world\";\n\tconst DEFAULT_LEVEL_TYPE = \"DEFAULT\";\n\t\n\tconst LEVEL_TYPES = [\n\t\t\"DEFAULT\",\n\t\t\"FLAT\",\n\t\t\"NORMAL\",\n\t\t\"NORMAL2\",\n\t\t\"HELL\", //nether type, in case anyone wants to generate a blue-skies nether, which actually does look pretty awesome\n\t\t\"VOID\"\n\t];\n\n\tprivate $defaultLang;\n\n\tpublic function __construct(){\n\t\techo \"[*] Genisys set-up wizard\\n\";\n\t\techo \"[*] Please select a language:\\n\";\n\t\tforeach(InstallerLang::$languages as $short => $native){\n\t\t\techo \" $native => $short\\n\";\n\t\t}\n\t\tdo{\n\t\t\techo \"[?] Language (eng): \";\n\t\t\t$lang = strtolower($this->getInput(\"eng\"));\n\t\t\tif(!isset(InstallerLang::$languages[$lang])){\n\t\t\t\techo \"[!] Couldn't find the language\\n\";\n\t\t\t\t$lang = false;\n\t\t\t}\n\t\t\t$this->defaultLang = $lang;\n\t\t}while($lang == false);\n\t\t$this->lang = new InstallerLang($lang);\n\n\n\t\techo \"[*] \" . $this->lang->language_has_been_selected . \"\\n\";\n\n\t\tif(!$this->showLicense()){\n\t\t\t@\\pocketmine\\kill(getmypid());\n\t\t\texit(-1);\n\t\t}\n\n\t\techo \"[?] \" . $this->lang->skip_installer . \" (y/N): \";\n\t\tif(strtolower($this->getInput()) === \"y\"){\n\t\t\treturn;\n\t\t}\n\t\techo \"\\n\";\n\t\t$this->welcome();\n\t\t$this->generateBaseConfig();\n\t\t$this->generateUserFiles();\n\n\t\t$this->networkFunctions();\n\n\t\t$this->endWizard();\n\t}\n\n\tpublic function getDefaultLang(){\n\t\treturn $this->defaultLang;\n\t}\n\n\tprivate function showLicense(){\n\t\techo $this->lang->welcome_to_pocketmine . \"\\n\";\n\t\techo <<<LICENSE\n\n  This program is free software: you can redistribute it and/or modify\n  it under the terms of the GNU Lesser General Public License as published by\n  the Free Software Foundation, either version 3 of the License, or\n  (at your option) any later version.\n\nLICENSE;\n\t\techo \"\\n[?] \" . $this->lang->accept_license . \" (y/N): \";\n\t\tif(strtolower($this->getInput(\"n\")) != \"y\"){\n\t\t\techo \"[!] \" . $this->lang->you_have_to_accept_the_license . \"\\n\";\n\t\t\tsleep(5);\n\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tprivate function welcome(){\n\t\techo \"[*] \" . $this->lang->setting_up_server_now . \"\\n\";\n\t\techo \"[*] \" . $this->lang->default_values_info . \"\\n\";\n\t\techo \"[*] \" . $this->lang->server_properties . \"\\n\";\n\n\t}\n\n\tprivate function generateBaseConfig(){\n\t\t$config = new Config(\\pocketmine\\DATA . \"server.properties\", Config::PROPERTIES);\n\t\techo \"[?] \" . $this->lang->name_your_server . \" (\" . self::DEFAULT_NAME . \"): \";\n\t\t$server_name = $this->getInput(self::DEFAULT_NAME);\n\t\t$config->set(\"server-name\", $server_name);\n\t\t$config->set(\"motd\", $server_name); //MOTD is now used as server name\n\t\techo \"[*] \" . $this->lang->port_warning . \"\\n\";\n\t\tdo{\n\t\t\techo \"[?] \" . $this->lang->server_port . \" (\" . self::DEFAULT_PORT . \"): \";\n\t\t\t$port = (int) $this->getInput(self::DEFAULT_PORT);\n\t\t\tif($port <= 0 or $port > 65535){\n\t\t\t\techo \"[!] \" . $this->lang->invalid_port . \"\\n\";\n\t\t\t}\n\t\t}while($port <= 0 or $port > 65535);\n\t\t$config->set(\"server-port\", $port);\n\t\t\n\t\techo \"[*] \" . $this->lang->online_mode_info . \"\\n\";\n\t\techo \"[?] \" . $this->lang->online_mode . \" (y/N): \";\n\t\t$config->set(\"online-mode\", strtolower($this->getInput(\"y\")) == \"y\");\n\t\t\n\t\techo \"[?] \" . $this->lang->level_name . \" (\" . self::DEFAULT_LEVEL_NAME . \"): \";\n\t\t$config->set(\"level-name\", $this->getInput(self::DEFAULT_LEVEL_NAME));\n\t\t\n\t\tdo{\n\t\t\techo \"[?] \" . $this->lang->level_type . \" (\" . self::DEFAULT_LEVEL_TYPE . \"): \";\n\t\t\t$type = strtoupper((string) $this->getInput(self::DEFAULT_LEVEL_TYPE));\n\t\t\tif(!in_array($type, self::LEVEL_TYPES)){\n\t\t\t\techo \"[!] \" . $this->lang->invalid_level_type . \"\\n\";\n\t\t\t}\n\t\t}while(!in_array($type, self::LEVEL_TYPES));\n\t\t$config->set(\"level-type\", $type);\n\t\t\n\t\t/*echo \"[*] \" . $this->lang->ram_warning . \"\\n\";\n\t\techo \"[?] \" . $this->lang->server_ram . \" (\" . self::DEFAULT_MEMORY . \"): \";\n\t\t$config->set(\"memory-limit\", ((int) $this->getInput(self::DEFAULT_MEMORY)) . \"M\");*/\n\t\techo \"[*] \" . $this->lang->gamemode_info . \"\\n\";\n\t\tdo{\n\t\t\techo \"[?] \" . $this->lang->default_gamemode . \": (\" . self::DEFAULT_GAMEMODE . \"): \";\n\t\t\t$gamemode = (int) $this->getInput(self::DEFAULT_GAMEMODE);\n\t\t}while($gamemode < 0 or $gamemode > 3);\n\t\t$config->set(\"gamemode\", $gamemode);\n\t\techo \"[?] \" . $this->lang->max_players . \" (\" . self::DEFAULT_PLAYERS . \"): \";\n\t\t$config->set(\"max-players\", (int) $this->getInput(self::DEFAULT_PLAYERS));\n\t\techo \"[*] \" . $this->lang->spawn_protection_info . \"\\n\";\n\t\techo \"[?] \" . $this->lang->spawn_protection . \" (Y/n): \";\n\t\tif(strtolower($this->getInput(\"y\")) == \"n\"){\n\t\t\t$config->set(\"spawn-protection\", -1);\n\t\t}else{\n\t\t\t$config->set(\"spawn-protection\", 16);\n\t\t}\n\t\t\n\t\techo \"[?] \" . $this->lang->announce_player_achievements . \" (y/N): \";\n\t\tif(strtolower($this->getInput(\"n\")) === \"y\"){\n\t\t\t$config->set(\"announce-player-achievements\", \"on\");\n\t\t}else{\n\t\t\t$config->set(\"announce-player-achievements\", \"off\");\n\t\t}\n\t\t$config->save();\n\t}\n\n\tprivate function generateUserFiles(){\n\t\techo \"[*] \" . $this->lang->op_info . \"\\n\";\n\t\techo \"[?] \" . $this->lang->op_who . \": \";\n\t\t$op = strtolower($this->getInput(\"\"));\n\t\tif($op === \"\"){\n\t\t\techo \"[!] \" . $this->lang->op_warning . \"\\n\";\n\t\t}else{\n\t\t\t$ops = new Config(\\pocketmine\\DATA . \"ops.txt\", Config::ENUM);\n\t\t\t$ops->set($op, true);\n\t\t\t$ops->save();\n\t\t}\n\t\techo \"[*] \" . $this->lang->whitelist_info . \"\\n\";\n\t\techo \"[?] \" . $this->lang->whitelist_enable . \" (y/N): \";\n\t\t$config = new Config(\\pocketmine\\DATA . \"server.properties\", Config::PROPERTIES);\n\t\tif(strtolower($this->getInput(\"n\")) === \"y\"){\n\t\t\techo \"[!] \" . $this->lang->whitelist_warning . \"\\n\";\n\t\t\t$config->set(\"white-list\", true);\n\t\t}else{\n\t\t\t$config->set(\"white-list\", false);\n\t\t}\n\t\t$config->save();\n\t}\n\n\tprivate function networkFunctions(){\n\t\t$config = new Config(\\pocketmine\\DATA . \"server.properties\", Config::PROPERTIES);\n\t\techo \"[!] \" . $this->lang->query_warning1 . \"\\n\";\n\t\techo \"[!] \" . $this->lang->query_warning2 . \"\\n\";\n\t\techo \"[?] \" . $this->lang->query_disable . \" (y/N): \";\n\t\tif(strtolower($this->getInput(\"n\")) === \"y\"){\n\t\t\t$config->set(\"enable-query\", false);\n\t\t}else{\n\t\t\t$config->set(\"enable-query\", true);\n\t\t}\n\n\t\techo \"[*] \" . $this->lang->rcon_info . \"\\n\";\n\t\techo \"[?] \" . $this->lang->rcon_enable . \" (y/N): \";\n\t\tif(strtolower($this->getInput(\"n\")) === \"y\"){\n\t\t\t$config->set(\"enable-rcon\", true);\n\t\t\t$password = substr(base64_encode(random_bytes(20)), 3, 10);\n\t\t\t$config->set(\"rcon.password\", $password);\n\t\t\techo \"[*] \" . $this->lang->rcon_password . \": \" . $password . \"\\n\";\n\t\t}else{\n\t\t\t$config->set(\"enable-rcon\", false);\n\t\t}\n\n\t\t/*echo \"[*] \" . $this->lang->usage_info . \"\\n\";\n\t\techo \"[?] \" . $this->lang->usage_disable . \" (y/N): \";\n\t\tif(strtolower($this->getInput(\"n\")) === \"y\"){\n\t\t\t$config->set(\"send-usage\", false);\n\t\t}else{\n\t\t\t$config->set(\"send-usage\", true);\n\t\t}*/\n\t\t$config->save();\n\n\n\t\techo \"[*] \" . $this->lang->ip_get . \"\\n\";\n\n\t\t$externalIP = Utils::getIP();\n\t\t$internalIP = gethostbyname(trim(`hostname`));\n\n\t\techo \"[!] \" . $this->lang->get(\"ip_warning\", [\"{{EXTERNAL_IP}}\", \"{{INTERNAL_IP}}\"], [$externalIP, $internalIP]) . \"\\n\";\n\t\techo \"[!] \" . $this->lang->ip_confirm;\n\t\t$this->getInput();\n\t}\n\n\tprivate function endWizard(){\n\t\techo \"[*] \" . $this->lang->you_have_finished . \"\\n\";\n\t\techo \"[*] \" . $this->lang->pocketmine_plugins . \"\\n\";\n\t\techo \"[*] \" . $this->lang->pocketmine_will_start . \"\\n\\n\\n\";\n\t\tsleep(4);\n\t}\n\n\tprivate function getInput($default = \"\"){\n\t\t$input = trim(fgets(STDIN));\n\n\t\treturn $input === \"\" ? $default : $input;\n\t}\n\n\n}\n"
  },
  {
    "path": "src/pocketmine/wizard/InstallerLang.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____  \n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\ \n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/ \n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_| \n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace pocketmine\\wizard;\n\n\nclass InstallerLang{\n\tpublic static $languages = [\n\t\t\"eng\" => \"English\",\n\t\t\"chs\" => \"简体中文\",\n\t\t\"zho\" => \"繁體中文\",\n\t\t\"jpn\" => \"日本語\",\n\t\t\"rus\" => \"Русский\",\n\t\t\"ita\" => \"Italiano\",\n\t\t\"kor\" => \"한국어\",\n\t\t\"deu\" => \"Deutsch\"\n\t];\n\tprivate $texts = [];\n\tprivate $lang;\n\tprivate $langfile;\n\n\tpublic function __construct($lang = \"\"){\n\t\tif(file_exists(\\pocketmine\\PATH . \"src/pocketmine/lang/Installer/\" . $lang . \".ini\")){\n\t\t\t$this->lang = $lang;\n\t\t\t$this->langfile = \\pocketmine\\PATH . \"src/pocketmine/lang/Installer/\" . $lang . \".ini\";\n\t\t}else{\n\t\t\t$files = [];\n\t\t\tforeach(new \\DirectoryIterator(\\pocketmine\\PATH . \"src/pocketmine/lang/Installer/\") as $file){\n\t\t\t\tif($file->getExtension() === \"ini\" and substr($file->getFilename(), 0, 2) === $lang){\n\t\t\t\t\t$files[$file->getFilename()] = $file->getSize();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(count($files) > 0){\n\t\t\t\tarsort($files);\n\t\t\t\treset($files);\n\t\t\t\t$l = key($files);\n\t\t\t\t$l = substr($l, 0, -4);\n\t\t\t\t$this->lang = isset(self::$languages[$l]) ? $l : $lang;\n\t\t\t\t$this->langfile = \\pocketmine\\PATH . \"src/pocketmine/lang/Installer/\" . $l . \".ini\";\n\t\t\t}else{\n\t\t\t\t$this->lang = \"en\";\n\t\t\t\t$this->langfile = \\pocketmine\\PATH . \"src/pocketmine/lang/Installer/eng.ini\";\n\t\t\t}\n\t\t}\n\n\t\t$this->loadLang(\\pocketmine\\PATH . \"src/pocketmine/lang/Installer/eng.ini\", \"eng\");\n\t\tif($this->lang !== \"en\"){\n\t\t\t$this->loadLang($this->langfile, $this->lang);\n\t\t}\n\n\t}\n\n\tpublic function getLang(){\n\t\treturn ($this->lang);\n\t}\n\n\tpublic function loadLang($langfile, $lang = \"en\"){\n\t\t$this->texts[$lang] = [];\n\t\t$texts = explode(\"\\n\", str_replace([\"\\r\", \"\\\\/\\\\/\"], [\"\", \"//\"], file_get_contents($langfile)));\n\t\tforeach($texts as $line){\n\t\t\t$line = trim($line);\n\t\t\tif($line === \"\"){\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\t$line = explode(\"=\", $line);\n\t\t\t$this->texts[$lang][trim(array_shift($line))] = trim(str_replace([\"\\\\n\", \"\\\\N\",], \"\\n\", implode(\"=\", $line)));\n\t\t}\n\t}\n\n\tpublic function get($name, $search = [], $replace = []){\n\t\tif(!isset($this->texts[$this->lang][$name])){\n\t\t\tif($this->lang !== \"en\" and isset($this->texts[\"en\"][$name])){\n\t\t\t\treturn $this->texts[\"en\"][$name];\n\t\t\t}else{\n\t\t\t\treturn $name;\n\t\t\t}\n\t\t}elseif(count($search) > 0){\n\t\t\treturn str_replace($search, $replace, $this->texts[$this->lang][$name]);\n\t\t}else{\n\t\t\treturn $this->texts[$this->lang][$name];\n\t\t}\n\t}\n\n\tpublic function __get($name){\n\t\treturn $this->get($name);\n\t}\n\n}\n"
  },
  {
    "path": "src/raklib/Binary.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib;\n\nif(!defined(\"ENDIANNESS\")){\n\tdefine(\"ENDIANNESS\", (pack(\"d\", 1) === \"\\77\\360\\0\\0\\0\\0\\0\\0\" ? Binary::BIG_ENDIAN : Binary::LITTLE_ENDIAN));\n}\n\nclass Binary{\n\tconst BIG_ENDIAN = 0x00;\n\tconst LITTLE_ENDIAN = 0x01;\n\n\n\t/**\n\t * Reads a 3-byte big-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return mixed\n\t */\n\tpublic static function readTriad($str){\n\t\treturn unpack(\"N\", \"\\x00\" . $str)[1];\n\t}\n\n\t/**\n\t * Writes a 3-byte big-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeTriad($value){\n\t\treturn substr(pack(\"N\", $value), 1);\n\t}\n\n\t/**\n\t * Reads a 3-byte little-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return mixed\n\t */\n\tpublic static function readLTriad($str){\n\t\treturn unpack(\"V\", $str . \"\\x00\")[1];\n\t}\n\n\t/**\n\t * Writes a 3-byte little-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeLTriad($value){\n\t\treturn substr(pack(\"V\", $value), 0, -1);\n\t}\n\n\t/**\n\t * Reads a byte boolean\n\t *\n\t * @param $b\n\t *\n\t * @return bool\n\t */\n\tpublic static function readBool($b){\n\t\treturn self::readByte($b, false) === 0 ? false : true;\n\t}\n\n\t/**\n\t * Writes a byte boolean\n\t *\n\t * @param $b\n\t *\n\t * @return bool|string\n\t */\n\tpublic static function writeBool($b){\n\t\treturn self::writeByte($b === true ? 1 : 0);\n\t}\n\n\t/**\n\t * Reads an unsigned/signed byte\n\t *\n\t * @param string $c\n\t * @param bool   $signed\n\t *\n\t * @return int\n\t */\n\tpublic static function readByte($c, $signed = true){\n\t\t$b = ord($c{0});\n\n\t\tif($signed){\n\t\t\tif(PHP_INT_SIZE === 8){\n\t\t\t\treturn $b << 56 >> 56;\n\t\t\t}else{\n\t\t\t\treturn $b << 24 >> 24;\n\t\t\t}\n\t\t}else{\n\t\t\treturn $b;\n\t\t}\n\t}\n\n\t/**\n\t * Writes an unsigned/signed byte\n\t *\n\t * @param $c\n\t *\n\t * @return string\n\t */\n\tpublic static function writeByte($c){\n\t\treturn chr($c);\n\t}\n\n\t/**\n\t * Reads a 16-bit unsigned big-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return int\n\t */\n\tpublic static function readShort($str){\n\t\treturn unpack(\"n\", $str)[1];\n\t}\n\n\t/**\n\t * Reads a 16-bit signed big-endian number\n\t *\n\t * @param $str\n\t *\n\t * @return int\n\t */\n\tpublic static function readSignedShort($str){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn unpack(\"n\", $str)[1] << 48 >> 48;\n\t\t}else{\n\t\t\treturn unpack(\"n\", $str)[1] << 16 >> 16;\n\t\t}\n\t}\n\n\t/**\n\t * Writes a 16-bit signed/unsigned big-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeShort($value){\n\t\treturn pack(\"n\", $value);\n\t}\n\n\t/**\n\t * Reads a 16-bit signed/unsigned little-endian number\n\t *\n\t * @param      $str\n\t * @param bool $signed\n\t *\n\t * @return int\n\t */\n\tpublic static function readLShort($str, $signed = true){\n\t\t$unpacked = unpack(\"v\", $str)[1];\n\n\t\tif($signed){\n\t\t\tif(PHP_INT_SIZE === 8){\n\t\t\t\treturn $unpacked << 48 >> 48;\n\t\t\t}else{\n\t\t\t\treturn $unpacked << 16 >> 16;\n\t\t\t}\n\t\t}else{\n\t\t\treturn $unpacked;\n\t\t}\n\t}\n\n\t/**\n\t * Writes a 16-bit signed/unsigned little-endian number\n\t *\n\t * @param $value\n\t *\n\t * @return string\n\t */\n\tpublic static function writeLShort($value){\n\t\treturn pack(\"v\", $value);\n\t}\n\n\tpublic static function readInt($str){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn unpack(\"N\", $str)[1] << 32 >> 32;\n\t\t}else{\n\t\t\treturn unpack(\"N\", $str)[1];\n\t\t}\n\t}\n\n\tpublic static function writeInt($value){\n\t\treturn pack(\"N\", $value);\n\t}\n\n\tpublic static function readLInt($str){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn unpack(\"V\", $str)[1] << 32 >> 32;\n\t\t}else{\n\t\t\treturn unpack(\"V\", $str)[1];\n\t\t}\n\t}\n\n\tpublic static function writeLInt($value){\n\t\treturn pack(\"V\", $value);\n\t}\n\n\tpublic static function readFloat($str){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? unpack(\"f\", $str)[1] : unpack(\"f\", strrev($str))[1];\n\t}\n\n\tpublic static function writeFloat($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? pack(\"f\", $value) : strrev(pack(\"f\", $value));\n\t}\n\n\tpublic static function readLFloat($str){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? unpack(\"f\", strrev($str))[1] : unpack(\"f\", $str)[1];\n\t}\n\n\tpublic static function writeLFloat($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? strrev(pack(\"f\", $value)) : pack(\"f\", $value);\n\t}\n\n\tpublic static function readDouble($str){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? unpack(\"d\", $str)[1] : unpack(\"d\", strrev($str))[1];\n\t}\n\n\tpublic static function writeDouble($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? pack(\"d\", $value) : strrev(pack(\"d\", $value));\n\t}\n\n\tpublic static function readLDouble($str){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? unpack(\"d\", strrev($str))[1] : unpack(\"d\", $str)[1];\n\t}\n\n\tpublic static function writeLDouble($value){\n\t\treturn ENDIANNESS === self::BIG_ENDIAN ? strrev(pack(\"d\", $value)) : pack(\"d\", $value);\n\t}\n\n\tpublic static function readLong($x){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\tlist(, $int1, $int2) = unpack(\"N*\", $x);\n\n\t\t\treturn ($int1 << 32) | $int2;\n\t\t}else{\n\t\t\t$value = \"0\";\n\t\t\tfor($i = 0; $i < 8; $i += 2){\n\t\t\t\t$value = bcmul($value, \"65536\", 0);\n\t\t\t\t$value = bcadd($value, self::readShort(substr($x, $i, 2)), 0);\n\t\t\t}\n\n\t\t\tif(bccomp($value, \"9223372036854775807\") == 1){\n\t\t\t\t$value = bcadd($value, \"-18446744073709551616\");\n\t\t\t}\n\n\t\t\treturn $value;\n\t\t}\n\t}\n\n\tpublic static function writeLong($value){\n\t\tif(PHP_INT_SIZE === 8){\n\t\t\treturn pack(\"NN\", $value >> 32, $value & 0xFFFFFFFF);\n\t\t}else{\n\t\t\t$x = \"\";\n\n\t\t\tif(bccomp($value, \"0\") == -1){\n\t\t\t\t$value = bcadd($value, \"18446744073709551616\");\n\t\t\t}\n\n\t\t\t$x .= self::writeShort(bcmod(bcdiv($value, \"281474976710656\"), \"65536\"));\n\t\t\t$x .= self::writeShort(bcmod(bcdiv($value, \"4294967296\"), \"65536\"));\n\t\t\t$x .= self::writeShort(bcmod(bcdiv($value, \"65536\"), \"65536\"));\n\t\t\t$x .= self::writeShort(bcmod($value, \"65536\"));\n\n\t\t\treturn $x;\n\t\t}\n\t}\n\n\tpublic static function readLLong($str){\n\t\treturn self::readLong(strrev($str));\n\t}\n\n\tpublic static function writeLLong($value){\n\t\treturn strrev(self::writeLong($value));\n\t}\n\n}"
  },
  {
    "path": "src/raklib/RakLib.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib;\n\n\n//Dependencies check\n$errors = 0;\nif(version_compare(\"7.0\", PHP_VERSION) > 0){\n\techo \"[CRITICAL] Use PHP >= 7.0\" . PHP_EOL;\n\t++$errors;\n}\n\nif(!extension_loaded(\"sockets\")){\n\techo \"[CRITICAL] Unable to find the Socket extension.\" . PHP_EOL;\n\t++$errors;\n}\n\nif(!extension_loaded(\"pthreads\")){\n\techo \"[CRITICAL] Unable to find the pthreads extension.\" . PHP_EOL;\n\t++$errors;\n}else{\n\t$pthreads_version = phpversion(\"pthreads\");\n\tif(substr_count($pthreads_version, \".\") < 2){\n\t\t$pthreads_version = \"0.$pthreads_version\";\n\t}\n\n\tif(version_compare($pthreads_version, \"3.0.0\") < 0){\n\t\techo \"[CRITICAL] pthreads >= 3.0.0 is required, while you have $pthreads_version.\";\n\t\t++$errors;\n\t}\n}\n\nif($errors > 0){\n\texit(1); //Exit with error\n}\nunset($errors);\n\nabstract class RakLib{\n\tconst VERSION = \"0.8.0\";\n\tconst PROTOCOL = 6;\n\tconst MAGIC = \"\\x00\\xff\\xff\\x00\\xfe\\xfe\\xfe\\xfe\\xfd\\xfd\\xfd\\xfd\\x12\\x34\\x56\\x78\";\n\n\tconst PRIORITY_NORMAL = 0;\n\tconst PRIORITY_IMMEDIATE = 1;\n\n\tconst FLAG_NEED_ACK = 0b00001000;\n\n\t/*\n\t * Internal Packet:\n\t * int32 (length without this field)\n\t * byte (packet ID)\n\t * payload\n\t */\n\n\t/*\n\t * ENCAPSULATED payload:\n\t * byte (identifier length)\n\t * byte[] (identifier)\n\t * byte (flags, last 3 bits, priority)\n\t * payload (binary internal EncapsulatedPacket)\n\t */\n\tconst PACKET_ENCAPSULATED = 0x01;\n\n\t/*\n\t * OPEN_SESSION payload:\n\t * byte (identifier length)\n\t * byte[] (identifier)\n\t * byte (address length)\n\t * byte[] (address)\n\t * short (port)\n\t * long (clientID)\n\t */\n\tconst PACKET_OPEN_SESSION = 0x02;\n\n\t/*\n\t * CLOSE_SESSION payload:\n\t * byte (identifier length)\n\t * byte[] (identifier)\n\t * string (reason)\n\t */\n\tconst PACKET_CLOSE_SESSION = 0x03;\n\n\t/*\n\t * INVALID_SESSION payload:\n\t * byte (identifier length)\n\t * byte[] (identifier)\n\t */\n\tconst PACKET_INVALID_SESSION = 0x04;\n\n\t/* TODO: implement this\n\t * SEND_QUEUE payload:\n\t * byte (identifier length)\n\t * byte[] (identifier)\n\t */\n\tconst PACKET_SEND_QUEUE = 0x05;\n\n\t/*\n\t * ACK_NOTIFICATION payload:\n\t * byte (identifier length)\n\t * byte[] (identifier)\n\t * int (identifierACK)\n\t */\n\tconst PACKET_ACK_NOTIFICATION = 0x06;\n\n\t/*\n\t * SET_OPTION payload:\n\t * byte (option name length)\n\t * byte[] (option name)\n\t * byte[] (option value)\n\t */\n\tconst PACKET_SET_OPTION = 0x07;\n\n\t/*\n\t * RAW payload:\n\t * byte (address length)\n\t * byte[] (address from/to)\n\t * short (port)\n\t * byte[] (payload)\n\t */\n\tconst PACKET_RAW = 0x08;\n\n\t/*\n\t * RAW payload:\n\t * byte (address length)\n\t * byte[] (address)\n\t * int (timeout)\n\t */\n\tconst PACKET_BLOCK_ADDRESS = 0x09;\n\n\t/*\n\t * RAW payload:\n\t * byte (address length)\n\t * byte[] (address)\n\t */\n\n\tconst PACKET_UNBLOCK_ADDRESS = 0x0a;\n\n\t/*\n\t * No payload\n\t *\n\t * Sends the disconnect message, removes sessions correctly, closes sockets.\n\t */\n\tconst PACKET_SHUTDOWN = 0x7e;\n\n\t/*\n\t * No payload\n\t *\n\t * Leaves everything as-is and halts, other Threads can be in a post-crash condition.\n\t */\n\tconst PACKET_EMERGENCY_SHUTDOWN = 0x7f;\n\n\tpublic static function bootstrap(\\ClassLoader $loader){\n\t\t$loader->addPath(dirname(__FILE__) . DIRECTORY_SEPARATOR . \"..\");\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/ACK.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\nclass ACK extends AcknowledgePacket{\n\tpublic static $ID = 0xc0;\n}"
  },
  {
    "path": "src/raklib/protocol/ADVERTISE_SYSTEM.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\nclass ADVERTISE_SYSTEM extends UNCONNECTED_PONG{\n\tpublic static $ID = 0x1d;\n}"
  },
  {
    "path": "src/raklib/protocol/AcknowledgePacket.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#ifndef COMPILE\nuse raklib\\Binary;\n#endif\n\n#include <rules/RakLibPacket.h>\n\nabstract class AcknowledgePacket extends Packet{\n\t/** @var int[] */\n\tpublic $packets = [];\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$payload = \"\";\n\t\tsort($this->packets, SORT_NUMERIC);\n\t\t$count = count($this->packets);\n\t\t$records = 0;\n\n\t\tif($count > 0){\n\t\t\t$pointer = 1;\n\t\t\t$start = $this->packets[0];\n\t\t\t$last = $this->packets[0];\n\n\t\t\twhile($pointer < $count){\n\t\t\t\t$current = $this->packets[$pointer++];\n\t\t\t\t$diff = $current - $last;\n\t\t\t\tif($diff === 1){\n\t\t\t\t\t$last = $current;\n\t\t\t\t}elseif($diff > 1){ //Forget about duplicated packets (bad queues?)\n\t\t\t\t\tif($start === $last){\n\t\t\t\t\t\t$payload .= \"\\x01\";\n\t\t\t\t\t\t$payload .= Binary::writeLTriad($start);\n\t\t\t\t\t\t$start = $last = $current;\n\t\t\t\t\t}else{\n\t\t\t\t\t\t$payload .= \"\\x00\";\n\t\t\t\t\t\t$payload .= Binary::writeLTriad($start);\n\t\t\t\t\t\t$payload .= Binary::writeLTriad($last);\n\t\t\t\t\t\t$start = $last = $current;\n\t\t\t\t\t}\n\t\t\t\t\t++$records;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif($start === $last){\n\t\t\t\t$payload .= \"\\x01\";\n\t\t\t\t$payload .= Binary::writeLTriad($start);\n\t\t\t}else{\n\t\t\t\t$payload .= \"\\x00\";\n\t\t\t\t$payload .= Binary::writeLTriad($start);\n\t\t\t\t$payload .= Binary::writeLTriad($last);\n\t\t\t}\n\t\t\t++$records;\n\t\t}\n\n\t\t$this->putShort($records);\n\t\t$this->buffer .= $payload;\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$count = $this->getShort();\n\t\t$this->packets = [];\n\t\t$cnt = 0;\n\t\tfor($i = 0; $i < $count and !$this->feof() and $cnt < 4096; ++$i){\n\t\t\tif($this->getByte() === 0){\n\t\t\t\t$start = $this->getLTriad();\n\t\t\t\t$end = $this->getLTriad();\n\t\t\t\tif(($end - $start) > 512){\n\t\t\t\t\t$end = $start + 512;\n\t\t\t\t}\n\t\t\t\tfor($c = $start; $c <= $end; ++$c){\n\t\t\t\t\t$this->packets[$cnt++] = $c;\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->packets[$cnt++] = $this->getLTriad();\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function clean(){\n\t\t$this->packets = [];\n\t\treturn parent::clean();\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/CLIENT_CONNECT_DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\nclass CLIENT_CONNECT_DataPacket extends Packet{\n\tpublic static $ID = 0x09;\n\n\tpublic $clientID;\n\tpublic $sendPing;\n\tpublic $useSecurity = false;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->putLong($this->clientID);\n\t\t$this->putLong($this->sendPing);\n\t\t$this->putByte($this->useSecurity ? 1 : 0);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->clientID = $this->getLong();\n\t\t$this->sendPing = $this->getLong();\n\t\t$this->useSecurity = $this->getByte() > 0;\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/CLIENT_DISCONNECT_DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\nclass CLIENT_DISCONNECT_DataPacket extends Packet{\n\tpublic static $ID = 0x15;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/CLIENT_HANDSHAKE_DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\nclass CLIENT_HANDSHAKE_DataPacket extends Packet{\n\tpublic static $ID = 0x13;\n\n\tpublic $address;\n\tpublic $port;\n\t\n\tpublic $systemAddresses = [];\n\t\n\tpublic $sendPing;\n\tpublic $sendPong;\n\n\tpublic function encode(){\n\t\t\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->getAddress($this->address, $this->port);\n\t\t for($i = 0; $i < 10; ++$i){\n\t\t\t$this->getAddress($addr, $port, $version);\n\t\t\t$this->systemAddresses[$i] = [$addr, $port, $version];\n\t\t}\n\t\t\n\t\t$this->sendPing = $this->getLong();\n\t\t$this->sendPong = $this->getLong();\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_0.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\nclass DATA_PACKET_0 extends DataPacket{\n\tpublic static $ID = 0x80;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_1.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\nclass DATA_PACKET_1 extends DataPacket{\n\tpublic static $ID = 0x81;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_2.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\nclass DATA_PACKET_2 extends DataPacket{\n\tpublic static $ID = 0x82;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_3.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\nclass DATA_PACKET_3 extends DataPacket{\n\tpublic static $ID = 0x83;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_4.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_4 extends DataPacket{\n\tpublic static $ID = 0x84;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_5.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_5 extends DataPacket{\n\tpublic static $ID = 0x85;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_6.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_6 extends DataPacket{\n\tpublic static $ID = 0x86;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_7.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_7 extends DataPacket{\n\tpublic static $ID = 0x87;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_8.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_8 extends DataPacket{\n\tpublic static $ID = 0x88;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_9.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_9 extends DataPacket{\n\tpublic static $ID = 0x89;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_A.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_A extends DataPacket{\n\tpublic static $ID = 0x8A;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_B.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_B extends DataPacket{\n\tpublic static $ID = 0x8B;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_C.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_C extends DataPacket{\n\tpublic static $ID = 0x8C;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_D.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_D extends DataPacket{\n\tpublic static $ID = 0x8D;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_E.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_E extends DataPacket{\n\tpublic static $ID = 0x8E;\n}"
  },
  {
    "path": "src/raklib/protocol/DATA_PACKET_F.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass DATA_PACKET_F extends DataPacket{\n\tpublic static $ID = 0x8F;\n}"
  },
  {
    "path": "src/raklib/protocol/DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\nabstract class DataPacket extends Packet{\n\n\t/** @var EncapsulatedPacket[] */\n\tpublic $packets = [];\n\n\tpublic $seqNumber;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->putLTriad($this->seqNumber);\n\t\tforeach($this->packets as $packet){\n\t\t\t$this->put($packet instanceof EncapsulatedPacket ? $packet->toBinary() : (string) $packet);\n\t\t}\n\t}\n\n\tpublic function length(){\n\t\t$length = 4;\n\t\tforeach($this->packets as $packet){\n\t\t\t$length += $packet instanceof EncapsulatedPacket ? $packet->getTotalLength() : strlen($packet);\n\t\t}\n\n\t\treturn $length;\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->seqNumber = $this->getLTriad();\n\n\t\twhile(!$this->feof()){\n\t\t\t$offset = 0;\n\t\t\t$data = substr($this->buffer, $this->offset);\n\t\t\t$packet = EncapsulatedPacket::fromBinary($data, false, $offset);\n\t\t\t$this->offset += $offset;\n\t\t\tif(strlen($packet->buffer) === 0){\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t$this->packets[] = $packet;\n\t\t}\n\t}\n\n\tpublic function clean(){\n\t\t$this->packets = [];\n\t\t$this->seqNumber = null;\n\t\treturn parent::clean();\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/EncapsulatedPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\n#ifndef COMPILE\nuse raklib\\Binary;\n#endif\n\n#include <rules/RakLibPacket.h>\n\nclass EncapsulatedPacket{\n\n\tpublic $reliability;\n\tpublic $hasSplit = false;\n\tpublic $length = 0;\n\tpublic $messageIndex = null;\n\tpublic $orderIndex = null;\n\tpublic $orderChannel = null;\n\tpublic $splitCount = null;\n\tpublic $splitID = null;\n\tpublic $splitIndex = null;\n\tpublic $buffer;\n\tpublic $needACK = false;\n\tpublic $identifierACK = null;\n\n\t/**\n\t * @param string $binary\n\t * @param bool   $internal\n\t * @param int\t&$offset\n\t *\n\t * @return EncapsulatedPacket\n\t */\n\tpublic static function fromBinary($binary, $internal = false, &$offset = null){\n\n\t\t$packet = new EncapsulatedPacket();\n\n\t\t$flags = ord($binary{0});\n\t\t$packet->reliability = $reliability = ($flags & 0b11100000) >> 5;\n\t\t$packet->hasSplit = $hasSplit = ($flags & 0b00010000) > 0;\n\t\tif($internal){\n\t\t\t$length = Binary::readInt(substr($binary, 1, 4));\n\t\t\t$packet->identifierACK = Binary::readInt(substr($binary, 5, 4));\n\t\t\t$offset = 9;\n\t\t}else{\n\t\t\t$length = (int) ceil(Binary::readShort(substr($binary, 1, 2)) / 8);\n\t\t\t$offset = 3;\n\t\t\t$packet->identifierACK = null;\n\t\t}\n\n\t\tif($reliability > PacketReliability::UNRELIABLE){\n\t\t\tif($reliability >= PacketReliability::RELIABLE and $reliability !== PacketReliability::UNRELIABLE_WITH_ACK_RECEIPT){\n\t\t\t\t$packet->messageIndex = Binary::readLTriad(substr($binary, $offset, 3));\n\t\t\t\t$offset += 3;\n\t\t\t}\n\n\t\t\tif($reliability <= PacketReliability::RELIABLE_SEQUENCED and $reliability !== PacketReliability::RELIABLE){\n\t\t\t\t$packet->orderIndex = Binary::readLTriad(substr($binary, $offset, 3));\n\t\t\t\t$offset += 3;\n\t\t\t\t$packet->orderChannel = ord($binary{$offset++});\n\t\t\t}\n\t\t}\n\n\t\tif($hasSplit){\n\t\t\t$packet->splitCount = Binary::readInt(substr($binary, $offset, 4));\n\t\t\t$offset += 4;\n\t\t\t$packet->splitID = Binary::readShort(substr($binary, $offset, 2));\n\t\t\t$offset += 2;\n\t\t\t$packet->splitIndex = Binary::readInt(substr($binary, $offset, 4));\n\t\t\t$offset += 4;\n\t\t}\n\n\t\t$packet->buffer = substr($binary, $offset, $length);\n\t\t$offset += $length;\n\n\t\treturn $packet;\n\t}\n\n\tpublic function getTotalLength(){\n\t\treturn 3 + strlen($this->buffer) + ($this->messageIndex !== null ? 3 : 0) + ($this->orderIndex !== null ? 4 : 0) + ($this->hasSplit ? 10 : 0);\n\t}\n\n\t/**\n\t * @param bool $internal\n\t *\n\t * @return string\n\t */\n\tpublic function toBinary($internal = false){\n\t\treturn\n\t\t\tchr(($this->reliability << 5) | ($this->hasSplit ? 0b00010000 : 0)) .\n\t\t\t($internal ? Binary::writeInt(strlen($this->buffer)) . Binary::writeInt($this->identifierACK) : Binary::writeShort(strlen($this->buffer) << 3)) .\n\t\t\t($this->reliability > PacketReliability::UNRELIABLE ?\n\t\t\t\t(($this->reliability >= PacketReliability::RELIABLE and $this->reliability !== PacketReliability::UNRELIABLE_WITH_ACK_RECEIPT) ? Binary::writeLTriad($this->messageIndex) : \"\") .\n\t\t\t\t(($this->reliability <= PacketReliability::RELIABLE_SEQUENCED and $this->reliability !== PacketReliability::RELIABLE) ? Binary::writeLTriad($this->orderIndex) . chr($this->orderChannel) : \"\")\n\t\t\t\t: \"\"\n\t\t\t) .\n\t\t\t($this->hasSplit ? Binary::writeInt($this->splitCount) . Binary::writeShort($this->splitID) . Binary::writeInt($this->splitIndex) : \"\")\n\t\t\t. $this->buffer;\n\t}\n\n\tpublic function __toString(){\n\t\treturn $this->toBinary();\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/NACK.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n\nclass NACK extends AcknowledgePacket{\n\tpublic static $ID = 0xa0;\n}"
  },
  {
    "path": "src/raklib/protocol/OPEN_CONNECTION_REPLY_1.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\n\nuse raklib\\RakLib;\n\nclass OPEN_CONNECTION_REPLY_1 extends Packet{\n\tpublic static $ID = 0x06;\n\n\tpublic $serverID;\n\tpublic $mtuSize;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->put(RakLib::MAGIC);\n\t\t$this->putLong($this->serverID);\n\t\t$this->putByte(0); //Server security\n\t\t$this->putShort($this->mtuSize);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->offset += 16; //Magic\n\t\t$this->serverID = $this->getLong();\n\t\t$this->getByte(); //security\n\t\t$this->mtuSize = $this->getShort();\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/OPEN_CONNECTION_REPLY_2.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\n\nuse raklib\\RakLib;\n\nclass OPEN_CONNECTION_REPLY_2 extends Packet{\n\tpublic static $ID = 0x08;\n\n\tpublic $serverID;\n\tpublic $clientAddress;\n\tpublic $clientPort;\n\tpublic $mtuSize;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->put(RakLib::MAGIC);\n\t\t$this->putLong($this->serverID);\n\t\t$this->putAddress($this->clientAddress, $this->clientPort, 4);\n\t\t$this->putShort($this->mtuSize);\n\t\t$this->putByte(0); //server security\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->offset += 16; //Magic\n\t\t$this->serverID = $this->getLong();\n\t\t$this->getAddress($this->clientAddress, $this->clientPort);\n\t\t$this->mtuSize = $this->getShort();\n\t\t//server security\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/OPEN_CONNECTION_REQUEST_1.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\n\nuse raklib\\RakLib;\n\nclass OPEN_CONNECTION_REQUEST_1 extends Packet{\n\tpublic static $ID = 0x05;\n\n\tpublic $protocol = RakLib::PROTOCOL;\n\tpublic $mtuSize;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->put(RakLib::MAGIC);\n\t\t$this->putByte($this->protocol);\n\t\t$this->put(str_repeat(chr(0x00), $this->mtuSize - 18));\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->offset += 16; //Magic\n\t\t$this->protocol = $this->getByte();\n\t\t$this->mtuSize = strlen($this->get(true)) + 18;\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/OPEN_CONNECTION_REQUEST_2.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\n\nuse raklib\\RakLib;\n\nclass OPEN_CONNECTION_REQUEST_2 extends Packet{\n\tpublic static $ID = 0x07;\n\n\tpublic $clientID;\n\tpublic $serverAddress;\n\tpublic $serverPort;\n\tpublic $mtuSize;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->put(RakLib::MAGIC);\n\t\t$this->putAddress($this->serverAddress, $this->serverPort, 4);\n\t\t$this->putShort($this->mtuSize);\n\t\t$this->putLong($this->clientID);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->offset += 16; //Magic\n\t\t$this->getAddress($this->serverAddress, $this->serverPort);\n\t\t$this->mtuSize = $this->getShort();\n\t\t$this->clientID = $this->getLong();\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/PING_DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\nclass PING_DataPacket extends Packet{\n\tpublic static $ID = 0x00;\n\n\tpublic $pingID;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->putLong($this->pingID);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->pingID = $this->getLong();\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/PONG_DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\nclass PONG_DataPacket extends Packet{\n\tpublic static $ID = 0x03;\n\n\tpublic $pingID;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->putLong($this->pingID);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->pingID = $this->getLong();\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/Packet.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#ifndef COMPILE\nuse raklib\\Binary;\n#endif\n\n#include <rules/RakLibPacket.h>\n\nabstract class Packet{\n\tpublic static $ID = -1;\n\n\tprotected $offset = 0;\n\tpublic $buffer;\n\tpublic $sendTime;\n\n\tprotected function get($len){\n\t\tif($len < 0){\n\t\t\t$this->offset = strlen($this->buffer) - 1;\n\n\t\t\treturn \"\";\n\t\t}elseif($len === true){\n\t\t\treturn substr($this->buffer, $this->offset);\n\t\t}\n\n\t\t$buffer = \"\";\n\t\tfor(; $len > 0; --$len, ++$this->offset){\n\t\t\t$buffer .= $this->buffer{$this->offset};\n\t\t}\n\n\t\treturn $buffer;\n\t}\n\n\tprotected function getLong($signed = true){\n\t\treturn Binary::readLong($this->get(8));\n\t}\n\n\tprotected function getInt(){\n\t\treturn Binary::readInt($this->get(4));\n\t}\n\n\tprotected function getShort($signed = true){\n\t\treturn $signed ? Binary::readSignedShort($this->get(2)) : Binary::readShort($this->get(2));\n\t}\n\n\tprotected function getTriad(){\n\t\treturn Binary::readTriad($this->get(3));\n\t}\n\n\tprotected function getLTriad(){\n\t\treturn Binary::readLTriad($this->get(3));\n\t}\n\n\tprotected function getByte(){\n\t\treturn ord($this->buffer{$this->offset++});\n\t}\n\n\tprotected function getString(){\n\t\treturn $this->get($this->getShort());\n\t}\n\n\tprotected function getAddress(&$addr, &$port, &$version = null){\n\t\t$version = $this->getByte();\n\t\tif($version === 4){\n\t\t\t$addr = ((~$this->getByte()) & 0xff) .\".\". ((~$this->getByte()) & 0xff) .\".\". ((~$this->getByte()) & 0xff) .\".\". ((~$this->getByte()) & 0xff);\n\t\t\t$port = $this->getShort(false);\n\t\t}else{\n\t\t\t//TODO: IPv6\n\t\t}\n\t}\n\n\tprotected function feof(){\n\t\treturn !isset($this->buffer{$this->offset});\n\t}\n\n\tprotected function put($str){\n\t\t$this->buffer .= $str;\n\t}\n\n\tprotected function putLong($v){\n\t\t$this->buffer .= Binary::writeLong($v);\n\t}\n\n\tprotected function putInt($v){\n\t\t$this->buffer .= Binary::writeInt($v);\n\t}\n\n\tprotected function putShort($v){\n\t\t$this->buffer .= Binary::writeShort($v);\n\t}\n\n\tprotected function putTriad($v){\n\t\t$this->buffer .= Binary::writeTriad($v);\n\t}\n\n\tprotected function putLTriad($v){\n\t\t$this->buffer .= Binary::writeLTriad($v);\n\t}\n\n\tprotected function putByte($v){\n\t\t$this->buffer .= chr($v);\n\t}\n\n\tprotected function putString($v){\n\t\t$this->putShort(strlen($v));\n\t\t$this->put($v);\n\t}\n\t\n\tprotected function putAddress($addr, $port, $version = 4){\n\t\t$this->putByte($version);\n\t\tif($version === 4){\n\t\t\tforeach(explode(\".\", $addr) as $b){\n\t\t\t\t$this->putByte((~((int) $b)) & 0xff);\n\t\t\t}\n\t\t\t$this->putShort($port);\n\t\t}else{\n\t\t\t//IPv6\n\t\t}\n\t}\n\n\tpublic function encode(){\n\t\t$this->buffer = chr(static::$ID);\n\t}\n\n\tpublic function decode(){\n\t\t$this->offset = 1;\n\t}\n\n\tpublic function clean(){\n\t\t$this->buffer = null;\n\t\t$this->offset = 0;\n\t\t$this->sendTime = null;\n\t\treturn $this;\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/PacketReliability.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\nclass PacketReliability {\n\t\n\t//pure UDP, but will discard duplicate packets\n\tconst UNRELIABLE = 0;\n\n\t//same as unreliable, but will discard messages\n\t//that arrive out of order\n\tconst UNRELIABLE_SEQUENCED = 1;\n\n\t//ensures that the packet reaches the destination\n\t//but can arrive in any order\n\tconst RELIABLE = 2;\n\n\t//same as reliable, but ensures the packets arrive\n\t//in the correct order.\n\tconst RELIABLE_ORDERED = 3;\n\n\t//same as reliable, but out of order messages will be dropped\n\tconst RELIABLE_SEQUENCED = 4;\n\n\tconst UNRELIABLE_WITH_ACK_RECEIPT = 5;\n\tconst RELIABLE_WITH_ACK_RECEIPT = 6;\n\n\t//basically the same as TCP\n\tconst RELIABLE_ORDERED_WITH_ACK_RECEIPT = 7;\n}\n"
  },
  {
    "path": "src/raklib/protocol/SERVER_HANDSHAKE_DataPacket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n *\n *\n*/\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\nclass SERVER_HANDSHAKE_DataPacket extends Packet{\n\tpublic static $ID = 0x10;\n\n\tpublic $address;\n\tpublic $port;\n\tpublic $systemAddresses = [\n\t\t[\"127.0.0.1\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4],\n\t\t[\"0.0.0.0\", 0, 4]\n\t];\n\t\n\tpublic $sendPing;\n\tpublic $sendPong;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->putAddress($this->address, $this->port, 4);\n\t\t$this->putShort(0);\n\t\tfor($i = 0; $i < 10; ++$i){\n\t\t\t$this->putAddress($this->systemAddresses[$i][0], $this->systemAddresses[$i][1], $this->systemAddresses[$i][2]);\n\t\t}\n\t\t\n\t\t$this->putLong($this->sendPing);\n\t\t$this->putLong($this->sendPong);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t//TODO, not needed yet\n\t}\n}\n"
  },
  {
    "path": "src/raklib/protocol/UNCONNECTED_PING.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\n\nuse raklib\\RakLib;\n\nclass UNCONNECTED_PING extends Packet{\n\tpublic static $ID = 0x01;\n\n\tpublic $pingID;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->putLong($this->pingID);\n\t\t$this->put(RakLib::MAGIC);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->pingID = $this->getLong();\n\t\t//magic\n\t}\n}"
  },
  {
    "path": "src/raklib/protocol/UNCONNECTED_PING_OPEN_CONNECTIONS.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\n\nclass UNCONNECTED_PING_OPEN_CONNECTIONS extends UNCONNECTED_PING{\n\tpublic static $ID = 0x02;\n}"
  },
  {
    "path": "src/raklib/protocol/UNCONNECTED_PONG.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\protocol;\n\n#include <rules/RakLibPacket.h>\n\n\nuse raklib\\RakLib;\n\nclass UNCONNECTED_PONG extends Packet{\n\tpublic static $ID = 0x1c;\n\n\tpublic $pingID;\n\tpublic $serverID;\n\tpublic $serverName;\n\n\tpublic function encode(){\n\t\tparent::encode();\n\t\t$this->putLong($this->pingID);\n\t\t$this->putLong($this->serverID);\n\t\t$this->put(RakLib::MAGIC);\n\t\t$this->putString($this->serverName);\n\t}\n\n\tpublic function decode(){\n\t\tparent::decode();\n\t\t$this->pingID = $this->getLong();\n\t\t$this->serverID = $this->getLong();\n\t\t$this->offset += 16; //magic\n\t\t$this->serverName = $this->getString();\n\t}\n}"
  },
  {
    "path": "src/raklib/server/RakLibServer.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\server;\n\n\nclass RakLibServer extends \\Thread{\n\tprotected $port;\n\tprotected $interface;\n\t/** @var \\ThreadedLogger */\n\tprotected $logger;\n\tprotected $loader;\n\n\tpublic $loadPaths;\n\n\tprotected $shutdown;\n\n\t/** @var \\Threaded */\n\tprotected $externalQueue;\n\t/** @var \\Threaded */\n\tprotected $internalQueue;\n\n\tprotected $mainPath;\n\n\t/**\n\t * @param \\ThreadedLogger $logger\n\t * @param \\ClassLoader    $loader\n\t * @param int             $port\n\t * @param string          $interface\n\t *\n\t * @throws \\Throwable\n\t */\n\tpublic function __construct(\\ThreadedLogger $logger, \\ClassLoader $loader, $port, $interface = \"0.0.0.0\"){\n\t\t$this->port = (int) $port;\n\t\tif($port < 1 or $port > 65536){\n\t\t\tthrow new \\Exception(\"Invalid port range\");\n\t\t}\n\n\t\t$this->interface = $interface;\n\t\t$this->logger = $logger;\n\t\t$this->loader = $loader;\n\t\t$loadPaths = [];\n\t\t$this->addDependency($loadPaths, new \\ReflectionClass($logger));\n\t\t$this->addDependency($loadPaths, new \\ReflectionClass($loader));\n\t\t$this->loadPaths = array_reverse($loadPaths);\n\t\t$this->shutdown = false;\n\n\t\t$this->externalQueue = new \\Threaded;\n\t\t$this->internalQueue = new \\Threaded;\n\n\t\tif(\\Phar::running(true) !== \"\"){\n\t\t\t$this->mainPath = \\Phar::running(true);\n\t\t}else{\n\t\t\t$this->mainPath = \\getcwd() . DIRECTORY_SEPARATOR;\n\t\t}\n\t\t$this->start();\n\t}\n\n\tprotected function addDependency(array &$loadPaths, \\ReflectionClass $dep){\n\t\tif($dep->getFileName() !== false){\n\t\t\t$loadPaths[$dep->getName()] = $dep->getFileName();\n\t\t}\n\n\t\tif($dep->getParentClass() instanceof \\ReflectionClass){\n\t\t\t$this->addDependency($loadPaths, $dep->getParentClass());\n\t\t}\n\n\t\tforeach($dep->getInterfaces() as $interface){\n\t\t\t$this->addDependency($loadPaths, $interface);\n\t\t}\n\t}\n\n\tpublic function isShutdown(){\n\t\treturn $this->shutdown === true;\n\t}\n\n\tpublic function shutdown(){\n\t\t$this->shutdown = true;\n\t}\n\n\tpublic function getPort(){\n\t\treturn $this->port;\n\t}\n\n\tpublic function getInterface(){\n\t\treturn $this->interface;\n\t}\n\n\t/**\n\t * @return \\ThreadedLogger\n\t */\n\tpublic function getLogger(){\n\t\treturn $this->logger;\n\t}\n\n\t/**\n\t * @return \\Threaded\n\t */\n\tpublic function getExternalQueue(){\n\t\treturn $this->externalQueue;\n\t}\n\n\t/**\n\t * @return \\Threaded\n\t */\n\tpublic function getInternalQueue(){\n\t\treturn $this->internalQueue;\n\t}\n\n\tpublic function pushMainToThreadPacket($str){\n\t\t$this->internalQueue[] = $str;\n\t}\n\n\tpublic function readMainToThreadPacket(){\n\t\treturn $this->internalQueue->shift();\n\t}\n\n\tpublic function pushThreadToMainPacket($str){\n\t\t$this->externalQueue[] = $str;\n\t}\n\n\tpublic function readThreadToMainPacket(){\n\t\treturn $this->externalQueue->shift();\n\t}\n\n\tpublic function shutdownHandler(){\n\t\tif($this->shutdown !== true){\n\t\t\t$this->getLogger()->emergency(\"RakLib crashed!\");\n\t\t}\n\t}\n\n\tpublic function errorHandler($errno, $errstr, $errfile, $errline, $context, $trace = null){\n\t\tif(error_reporting() === 0){\n\t\t\treturn false;\n\t\t}\n\t\t$errorConversion = [\n\t\t\tE_ERROR => \"E_ERROR\",\n\t\t\tE_WARNING => \"E_WARNING\",\n\t\t\tE_PARSE => \"E_PARSE\",\n\t\t\tE_NOTICE => \"E_NOTICE\",\n\t\t\tE_CORE_ERROR => \"E_CORE_ERROR\",\n\t\t\tE_CORE_WARNING => \"E_CORE_WARNING\",\n\t\t\tE_COMPILE_ERROR => \"E_COMPILE_ERROR\",\n\t\t\tE_COMPILE_WARNING => \"E_COMPILE_WARNING\",\n\t\t\tE_USER_ERROR => \"E_USER_ERROR\",\n\t\t\tE_USER_WARNING => \"E_USER_WARNING\",\n\t\t\tE_USER_NOTICE => \"E_USER_NOTICE\",\n\t\t\tE_STRICT => \"E_STRICT\",\n\t\t\tE_RECOVERABLE_ERROR => \"E_RECOVERABLE_ERROR\",\n\t\t\tE_DEPRECATED => \"E_DEPRECATED\",\n\t\t\tE_USER_DEPRECATED => \"E_USER_DEPRECATED\",\n\t\t];\n\t\t$errno = isset($errorConversion[$errno]) ? $errorConversion[$errno] : $errno;\n\t\tif(($pos = strpos($errstr, \"\\n\")) !== false){\n\t\t\t$errstr = substr($errstr, 0, $pos);\n\t\t}\n\t\t$oldFile = $errfile;\n\t\t$errfile = $this->cleanPath($errfile);\n\n\t\t$this->getLogger()->debug(\"An $errno error happened: \\\"$errstr\\\" in \\\"$errfile\\\" at line $errline\");\n\n\t\tforeach(($trace = $this->getTrace($trace === null ? 3 : 0, $trace)) as $i => $line){\n\t\t\t$this->getLogger()->debug($line);\n\t\t}\n\n\t\treturn true;\n\t}\n\n\tpublic function getTrace($start = 1, $trace = null){\n\t\tif($trace === null){\n\t\t\tif(function_exists(\"xdebug_get_function_stack\")){\n\t\t\t\t$trace = array_reverse(xdebug_get_function_stack());\n\t\t\t}else{\n\t\t\t\t$e = new \\Exception();\n\t\t\t\t$trace = $e->getTrace();\n\t\t\t}\n\t\t}\n\n\t\t$messages = [];\n\t\t$j = 0;\n\t\tfor($i = (int) $start; isset($trace[$i]); ++$i, ++$j){\n\t\t\t$params = \"\";\n\t\t\tif(isset($trace[$i][\"args\"]) or isset($trace[$i][\"params\"])){\n\t\t\t\tif(isset($trace[$i][\"args\"])){\n\t\t\t\t\t$args = $trace[$i][\"args\"];\n\t\t\t\t}else{\n\t\t\t\t\t$args = $trace[$i][\"params\"];\n\t\t\t\t}\n\t\t\t\tforeach($args as $name => $value){\n\t\t\t\t\t$params .= (is_object($value) ? get_class($value) . \" \" . (method_exists($value, \"__toString\") ? $value->__toString() : \"object\") : gettype($value) . \" \" . @strval($value)) . \", \";\n\t\t\t\t}\n\t\t\t}\n\t\t\t$messages[] = \"#$j \" . (isset($trace[$i][\"file\"]) ? $this->cleanPath($trace[$i][\"file\"]) : \"\") . \"(\" . (isset($trace[$i][\"line\"]) ? $trace[$i][\"line\"] : \"\") . \"): \" . (isset($trace[$i][\"class\"]) ? $trace[$i][\"class\"] . (($trace[$i][\"type\"] === \"dynamic\" or $trace[$i][\"type\"] === \"->\") ? \"->\" : \"::\") : \"\") . $trace[$i][\"function\"] . \"(\" . substr($params, 0, -2) . \")\";\n\t\t}\n\n\t\treturn $messages;\n\t}\n\n\tpublic function cleanPath($path){\n\t\treturn rtrim(str_replace([\"\\\\\", \".php\", \"phar://\", rtrim(str_replace([\"\\\\\", \"phar://\"], [\"/\", \"\"], $this->mainPath), \"/\")], [\"/\", \"\", \"\", \"\"], $path), \"/\");\n\t}\n\n\tpublic function run(){\n\t\t//Load removed dependencies, can't use require_once()\n\t\tforeach($this->loadPaths as $name => $path){\n\t\t\tif(!class_exists($name, false) and !interface_exists($name, false)){\n\t\t\t\trequire($path);\n\t\t\t}\n\t\t}\n\t\t$this->loader->register(true);\n\n\t\tgc_enable();\n\t\terror_reporting(-1);\n\t\tini_set(\"display_errors\", 1);\n\t\tini_set(\"display_startup_errors\", 1);\n\n\t\tset_error_handler([$this, \"errorHandler\"], E_ALL);\n\t\tregister_shutdown_function([$this, \"shutdownHandler\"]);\n\n\n\t\t$socket = new UDPServerSocket($this->getLogger(), $this->port, $this->interface);\n\t\tnew SessionManager($this, $socket);\n\t}\n\n}\n"
  },
  {
    "path": "src/raklib/server/ServerHandler.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\server;\n\nuse raklib\\Binary;\nuse raklib\\protocol\\EncapsulatedPacket;\nuse raklib\\RakLib;\n\nclass ServerHandler{\n\n\t/** @var RakLibServer */\n\tprotected $server;\n\t/** @var ServerInstance */\n\tprotected $instance;\n\n\tpublic function __construct(RakLibServer $server, ServerInstance $instance){\n\t\t$this->server = $server;\n\t\t$this->instance = $instance;\n\t}\n\n\tpublic function sendEncapsulated($identifier, EncapsulatedPacket $packet, $flags = RakLib::PRIORITY_NORMAL){\n\t\t$buffer = chr(RakLib::PACKET_ENCAPSULATED) . chr(strlen($identifier)) . $identifier . chr($flags) . $packet->toBinary(true);\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t}\n\n\tpublic function sendRaw($address, $port, $payload){\n\t\t$buffer = chr(RakLib::PACKET_RAW) . chr(strlen($address)) . $address . Binary::writeShort($port) . $payload;\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t}\n\n\tpublic function closeSession($identifier, $reason){\n\t\t$buffer = chr(RakLib::PACKET_CLOSE_SESSION) . chr(strlen($identifier)) . $identifier . chr(strlen($reason)) . $reason;\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t}\n\n\tpublic function sendOption($name, $value){\n\t\t$buffer = chr(RakLib::PACKET_SET_OPTION) . chr(strlen($name)) . $name . $value;\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t}\n\n\tpublic function blockAddress($address, $timeout){\n\t\t$buffer = chr(RakLib::PACKET_BLOCK_ADDRESS) . chr(strlen($address)) . $address . Binary::writeInt($timeout);\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t}\n\n\tpublic function unblockAddress($address){\n\t\t$buffer = chr(RakLib::PACKET_UNBLOCK_ADDRESS) . chr(strlen($address)) . $address;\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t}\n\n\tpublic function shutdown(){\n\t\t$buffer = chr(RakLib::PACKET_SHUTDOWN);\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t\t$this->server->shutdown();\n\t\t$this->server->synchronized(function(){\n\t\t\tif($this->server !== null){ #pthreadssucks\n\t\t\t\t$this->server->wait(20000);\n\t\t\t}\n\t\t});\n\t\t$this->server->join();\n\t}\n\n\tpublic function emergencyShutdown(){\n\t\t$this->server->shutdown();\n\t\t$this->server->pushMainToThreadPacket(\"\\x7f\"); //RakLib::PACKET_EMERGENCY_SHUTDOWN\n\t}\n\n\tprotected function invalidSession($identifier){\n\t\t$buffer = chr(RakLib::PACKET_INVALID_SESSION) . chr(strlen($identifier)) . $identifier;\n\t\t$this->server->pushMainToThreadPacket($buffer);\n\t}\n\n\t/**\n\t * @return bool\n\t */\n\tpublic function handlePacket(){\n\t\tif(strlen($packet = $this->server->readThreadToMainPacket()) > 0){\n\t\t\t$id = ord($packet{0});\n\t\t\t$offset = 1;\n\t\t\tif($id === RakLib::PACKET_ENCAPSULATED){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$flags = ord($packet{$offset++});\n\t\t\t\t$buffer = substr($packet, $offset);\n\t\t\t\t$this->instance->handleEncapsulated($identifier, EncapsulatedPacket::fromBinary($buffer, true), $flags);\n\t\t\t}elseif($id === RakLib::PACKET_RAW){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$address = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$port = Binary::readShort(substr($packet, $offset, 2));\n\t\t\t\t$offset += 2;\n\t\t\t\t$payload = substr($packet, $offset);\n\t\t\t\t$this->instance->handleRaw($address, $port, $payload);\n\t\t\t}elseif($id === RakLib::PACKET_SET_OPTION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$name = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$value = substr($packet, $offset);\n\t\t\t\t$this->instance->handleOption($name, $value);\n\t\t\t}elseif($id === RakLib::PACKET_OPEN_SESSION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$address = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$port = Binary::readShort(substr($packet, $offset, 2));\n\t\t\t\t$offset += 2;\n\t\t\t\t$clientID = Binary::readLong(substr($packet, $offset, 8));\n\t\t\t\t$this->instance->openSession($identifier, $address, $port, $clientID);\n\t\t\t}elseif($id === RakLib::PACKET_CLOSE_SESSION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$reason = substr($packet, $offset, $len);\n\t\t\t\t$this->instance->closeSession($identifier, $reason);\n\t\t\t}elseif($id === RakLib::PACKET_INVALID_SESSION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\t$this->instance->closeSession($identifier, \"Invalid session\");\n\t\t\t}elseif($id === RakLib::PACKET_ACK_NOTIFICATION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$identifierACK = Binary::readInt(substr($packet, $offset, 4));\n\t\t\t\t$this->instance->notifyACK($identifier, $identifierACK);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n}\n"
  },
  {
    "path": "src/raklib/server/ServerInstance.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\server;\n\nuse raklib\\protocol\\EncapsulatedPacket;\n\ninterface ServerInstance{\n\n\t/**\n\t * @param string     $identifier\n\t * @param string     $address\n\t * @param int        $port\n\t * @param string|int $clientID\n\t */\n\tpublic function openSession($identifier, $address, $port, $clientID);\n\n\t/**\n\t * @param string $identifier\n\t * @param string $reason\n\t */\n\tpublic function closeSession($identifier, $reason);\n\n\t/**\n\t * @param string             $identifier\n\t * @param EncapsulatedPacket $packet\n\t * @param int                $flags\n\t */\n\tpublic function handleEncapsulated($identifier, EncapsulatedPacket $packet, $flags);\n\n\t/**\n\t * @param string $address\n\t * @param int    $port\n\t * @param string $payload\n\t */\n\tpublic function handleRaw($address, $port, $payload);\n\n\t/**\n\t * @param string $identifier\n\t * @param int    $identifierACK\n\t */\n\tpublic function notifyACK($identifier, $identifierACK);\n\n\t/**\n\t * @param string $option\n\t * @param string $value\n\t */\n\tpublic function handleOption($option, $value);\n}"
  },
  {
    "path": "src/raklib/server/Session.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\server;\n\nuse raklib\\Binary;\nuse raklib\\protocol\\ACK;\nuse raklib\\protocol\\CLIENT_CONNECT_DataPacket;\nuse raklib\\protocol\\CLIENT_DISCONNECT_DataPacket;\nuse raklib\\protocol\\CLIENT_HANDSHAKE_DataPacket;\nuse raklib\\protocol\\DATA_PACKET_0;\nuse raklib\\protocol\\DATA_PACKET_4;\nuse raklib\\protocol\\DataPacket;\nuse raklib\\protocol\\EncapsulatedPacket;\nuse raklib\\protocol\\NACK;\nuse raklib\\protocol\\OPEN_CONNECTION_REPLY_1;\nuse raklib\\protocol\\OPEN_CONNECTION_REPLY_2;\nuse raklib\\protocol\\OPEN_CONNECTION_REQUEST_1;\nuse raklib\\protocol\\OPEN_CONNECTION_REQUEST_2;\nuse raklib\\protocol\\Packet;\nuse raklib\\protocol\\PacketReliability;\nuse raklib\\protocol\\PING_DataPacket;\nuse raklib\\protocol\\PONG_DataPacket;\nuse raklib\\protocol\\SERVER_HANDSHAKE_DataPacket;\nuse raklib\\protocol\\UNCONNECTED_PING;\nuse raklib\\protocol\\UNCONNECTED_PONG;\nuse raklib\\RakLib;\n\nclass Session{\n\tconst STATE_UNCONNECTED = 0;\n\tconst STATE_CONNECTING_1 = 1;\n\tconst STATE_CONNECTING_2 = 2;\n\tconst STATE_CONNECTED = 3;\n\n\tconst MAX_SPLIT_SIZE = 128;\n\tconst MAX_SPLIT_COUNT = 4;\n\n\tpublic static $WINDOW_SIZE = 2048;\n\n\tprivate $messageIndex = 0;\n\tprivate $channelIndex = [];\n\n\t/** @var SessionManager */\n\tprivate $sessionManager;\n\tprivate $address;\n\tprivate $port;\n\tprivate $state = self::STATE_UNCONNECTED;\n\tprivate $mtuSize = 508; //(Max IP Header Size) — (UDP Header Size) = 576 — 60 — 8 = 508\n\tprivate $id = 0;\n\tprivate $splitID = 0;\n\n\tprivate $sendSeqNumber = 0;\n\tprivate $lastSeqNumber = -1;\n\n\tprivate $lastUpdate;\n\tprivate $startTime;\n\n\tprivate $isTemporal = true;\n\n\t/** @var DataPacket[] */\n\tprivate $packetToSend = [];\n\n\tprivate $isActive;\n\n\t/** @var int[] */\n\tprivate $ACKQueue = [];\n\t/** @var int[] */\n\tprivate $NACKQueue = [];\n\n\t/** @var DataPacket[] */\n\tprivate $recoveryQueue = [];\n\n\t/** @var DataPacket[][] */\n\tprivate $splitPackets = [];\n\n\t/** @var int[][] */\n\tprivate $needACK = [];\n\n\t/** @var DataPacket */\n\tprivate $sendQueue;\n\n\tprivate $windowStart;\n\tprivate $receivedWindow = [];\n\tprivate $windowEnd;\n\n\tprivate $reliableWindowStart;\n\tprivate $reliableWindowEnd;\n\tprivate $reliableWindow = [];\n\tprivate $lastReliableIndex = -1;\n\n\tpublic function __construct(SessionManager $sessionManager, $address, $port){\n\t\t$this->sessionManager = $sessionManager;\n\t\t$this->address = $address;\n\t\t$this->port = $port;\n\t\t$this->sendQueue = new DATA_PACKET_4();\n\t\t$this->lastUpdate = microtime(true);\n\t\t$this->startTime = microtime(true);\n\t\t$this->isActive = false;\n\t\t$this->windowStart = -1;\n\t\t$this->windowEnd = self::$WINDOW_SIZE;\n\n\t\t$this->reliableWindowStart = 0;\n\t\t$this->reliableWindowEnd = self::$WINDOW_SIZE;\n\n\t\tfor($i = 0; $i < 32; ++$i){\n\t\t\t$this->channelIndex[$i] = 0;\n\t\t}\n\t}\n\n\tpublic function getAddress(){\n\t\treturn $this->address;\n\t}\n\n\tpublic function getPort(){\n\t\treturn $this->port;\n\t}\n\n\tpublic function getID(){\n\t\treturn $this->id;\n\t}\n\n\tpublic function update($time){\n\t\tif(!$this->isActive and ($this->lastUpdate + 10) < $time){\n\t\t\t$this->disconnect(\"timeout\");\n\n\t\t\treturn;\n\t\t}\n\t\t$this->isActive = false;\n\n\t\tif(count($this->ACKQueue) > 0){\n\t\t\t$pk = new ACK();\n\t\t\t$pk->packets = $this->ACKQueue;\n\t\t\t$this->sendPacket($pk);\n\t\t\t$this->ACKQueue = [];\n\t\t}\n\n\t\tif(count($this->NACKQueue) > 0){\n\t\t\t$pk = new NACK();\n\t\t\t$pk->packets = $this->NACKQueue;\n\t\t\t$this->sendPacket($pk);\n\t\t\t$this->NACKQueue = [];\n\t\t}\n\n\t\tif(count($this->packetToSend) > 0){\n\t\t\t$limit = 16;\n\t\t\tforeach($this->packetToSend as $k => $pk){\n\t\t\t\t$pk->sendTime = $time;\n\t\t\t\t$pk->encode();\n\t\t\t\t$this->recoveryQueue[$pk->seqNumber] = $pk;\n\t\t\t\tunset($this->packetToSend[$k]);\n\t\t\t\t$this->sendPacket($pk);\n\n\t\t\t\tif(--$limit <= 0){\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(count($this->packetToSend) > self::$WINDOW_SIZE){\n\t\t\t\t$this->packetToSend = [];\n\t\t\t}\n\t\t}\n\n\t\tif(count($this->needACK) > 0){\n\t\t\tforeach($this->needACK as $identifierACK => $indexes){\n\t\t\t\tif(count($indexes) === 0){\n\t\t\t\t\tunset($this->needACK[$identifierACK]);\n\t\t\t\t\t$this->sessionManager->notifyACK($this, $identifierACK);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\n\t\tforeach($this->recoveryQueue as $seq => $pk){\n\t\t\tif($pk->sendTime < (time() - 8)){\n\t\t\t\t$this->packetToSend[] = $pk;\n\t\t\t\tunset($this->recoveryQueue[$seq]);\n\t\t\t}else{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\tforeach($this->receivedWindow as $seq => $bool){\n\t\t\tif($seq < $this->windowStart){\n\t\t\t\tunset($this->receivedWindow[$seq]);\n\t\t\t}else{\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\t$this->sendQueue();\n\t}\n\n\tpublic function disconnect($reason = \"unknown\"){\n\t\t$this->sessionManager->removeSession($this, $reason);\n\t}\n\n\tprivate function sendPacket(Packet $packet){\n\t\t$this->sessionManager->sendPacket($packet, $this->address, $this->port);\n\t}\n\n\tpublic function sendQueue(){\n\t\tif(count($this->sendQueue->packets) > 0){\n\t\t\t$this->sendQueue->seqNumber = $this->sendSeqNumber++;\n\t\t\t$this->sendPacket($this->sendQueue);\n\t\t\t$this->sendQueue->sendTime = microtime(true);\n\t\t\t$this->recoveryQueue[$this->sendQueue->seqNumber] = $this->sendQueue;\n\t\t\t$this->sendQueue = new DATA_PACKET_4();\n\t\t}\n\t}\n\n\t/**\n\t * @param EncapsulatedPacket $pk\n\t * @param int                $flags\n\t */\n\tprivate function addToQueue(EncapsulatedPacket $pk, $flags = RakLib::PRIORITY_NORMAL){\n\t\t$priority = $flags & 0b0000111;\n\t\tif($pk->needACK and $pk->messageIndex !== null){\n\t\t\t$this->needACK[$pk->identifierACK][$pk->messageIndex] = $pk->messageIndex;\n\t\t}\n\t\tif($priority === RakLib::PRIORITY_IMMEDIATE){ //Skip queues\n\t\t\t$packet = new DATA_PACKET_0();\n\t\t\t$packet->seqNumber = $this->sendSeqNumber++;\n\t\t\tif($pk->needACK){\n\t\t\t\t$packet->packets[] = clone $pk;\n\t\t\t\t$pk->needACK = false;\n\t\t\t}else{\n\t\t\t\t$packet->packets[] = $pk->toBinary();\n\t\t\t}\n\n\t\t\t$this->sendPacket($packet);\n\t\t\t$packet->sendTime = microtime(true);\n\t\t\t$this->recoveryQueue[$packet->seqNumber] = $packet;\n\n\t\t\treturn;\n\t\t}\n\t\t$length = $this->sendQueue->length();\n\t\tif($length + $pk->getTotalLength() > $this->mtuSize){\n\t\t\t$this->sendQueue();\n\t\t}\n\n\t\tif($pk->needACK){\n\t\t\t$this->sendQueue->packets[] = clone $pk;\n\t\t\t$pk->needACK = false;\n\t\t}else{\n\t\t\t$this->sendQueue->packets[] = $pk->toBinary();\n\t\t}\n\t}\n\n\t/**\n\t * @param EncapsulatedPacket $packet\n\t * @param int                $flags\n\t */\n\tpublic function addEncapsulatedToQueue(EncapsulatedPacket $packet, $flags = RakLib::PRIORITY_NORMAL){\n\n\t\tif(($packet->needACK = ($flags & RakLib::FLAG_NEED_ACK) > 0) === true){\n\t\t\t$this->needACK[$packet->identifierACK] = [];\n\t\t}\n\n\t\tif(\n\t\t\t$packet->reliability === PacketReliability::RELIABLE or\n\t\t\t$packet->reliability === PacketReliability::RELIABLE_ORDERED or\n\t\t\t$packet->reliability === PacketReliability::RELIABLE_SEQUENCED or\n\t\t\t$packet->reliability === PacketReliability::RELIABLE_WITH_ACK_RECEIPT or\n\t\t\t$packet->reliability === PacketReliability::RELIABLE_ORDERED_WITH_ACK_RECEIPT\n\t\t){\n\t\t\t$packet->messageIndex = $this->messageIndex++;\n\n\t\t\tif($packet->reliability === PacketReliability::RELIABLE_ORDERED){\n\t\t\t\t$packet->orderIndex = $this->channelIndex[$packet->orderChannel]++;\n\t\t\t}\n\t\t}\n\n\t\tif($packet->getTotalLength() + 4 > $this->mtuSize){\n\t\t\t$buffers = str_split($packet->buffer, $this->mtuSize - 34);\n\t\t\t$splitID = ++$this->splitID % 65536;\n\t\t\tforeach($buffers as $count => $buffer){\n\t\t\t\t$pk = new EncapsulatedPacket();\n\t\t\t\t$pk->splitID = $splitID;\n\t\t\t\t$pk->hasSplit = true;\n\t\t\t\t$pk->splitCount = count($buffers);\n\t\t\t\t$pk->reliability = $packet->reliability;\n\t\t\t\t$pk->splitIndex = $count;\n\t\t\t\t$pk->buffer = $buffer;\n\t\t\t\tif($count > 0){\n\t\t\t\t\t$pk->messageIndex = $this->messageIndex++;\n\t\t\t\t}else{\n\t\t\t\t\t$pk->messageIndex = $packet->messageIndex;\n\t\t\t\t}\n\t\t\t\tif($pk->reliability === PacketReliability::RELIABLE_ORDERED){\n\t\t\t\t\t$pk->orderChannel = $packet->orderChannel;\n\t\t\t\t\t$pk->orderIndex = $packet->orderIndex;\n\t\t\t\t}\n\t\t\t\t$this->addToQueue($pk, $flags | RakLib::PRIORITY_IMMEDIATE);\n\t\t\t}\n\t\t}else{\n\t\t\t$this->addToQueue($packet, $flags);\n\t\t}\n\t}\n\n\tprivate function handleSplit(EncapsulatedPacket $packet){\n\t\tif($packet->splitCount >= self::MAX_SPLIT_SIZE or $packet->splitIndex >= self::MAX_SPLIT_SIZE or $packet->splitIndex < 0){\n\t\t\treturn;\n\t\t}\n\n\n\t\tif(!isset($this->splitPackets[$packet->splitID])){\n\t\t\tif(count($this->splitPackets) >= self::MAX_SPLIT_COUNT){\n\t\t\t\treturn;\n\t\t\t}\n\t\t\t$this->splitPackets[$packet->splitID] = [$packet->splitIndex => $packet];\n\t\t}else{\n\t\t\t$this->splitPackets[$packet->splitID][$packet->splitIndex] = $packet;\n\t\t}\n\n\t\tif(count($this->splitPackets[$packet->splitID]) === $packet->splitCount){\n\t\t\t$pk = new EncapsulatedPacket();\n\t\t\t$pk->buffer = \"\";\n\t\t\tfor($i = 0; $i < $packet->splitCount; ++$i){\n\t\t\t\t$pk->buffer .= $this->splitPackets[$packet->splitID][$i]->buffer;\n\t\t\t}\n\n\t\t\t$pk->length = strlen($pk->buffer);\n\t\t\tunset($this->splitPackets[$packet->splitID]);\n\n\t\t\t$this->handleEncapsulatedPacketRoute($pk);\n\t\t}\n\t}\n\n\tprivate function handleEncapsulatedPacket(EncapsulatedPacket $packet){\n\t\tif($packet->messageIndex === null){\n\t\t\t$this->handleEncapsulatedPacketRoute($packet);\n\t\t}else{\n\t\t\tif($packet->messageIndex < $this->reliableWindowStart or $packet->messageIndex > $this->reliableWindowEnd){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif(($packet->messageIndex - $this->lastReliableIndex) === 1){\n\t\t\t\t$this->lastReliableIndex++;\n\t\t\t\t$this->reliableWindowStart++;\n\t\t\t\t$this->reliableWindowEnd++;\n\t\t\t\t$this->handleEncapsulatedPacketRoute($packet);\n\n\t\t\t\tif(count($this->reliableWindow) > 0){\n\t\t\t\t\tksort($this->reliableWindow);\n\n\t\t\t\t\tforeach($this->reliableWindow as $index => $pk){\n\t\t\t\t\t\tif(($index - $this->lastReliableIndex) !== 1){\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t$this->lastReliableIndex++;\n\t\t\t\t\t\t$this->reliableWindowStart++;\n\t\t\t\t\t\t$this->reliableWindowEnd++;\n\t\t\t\t\t\t$this->handleEncapsulatedPacketRoute($pk);\n\t\t\t\t\t\tunset($this->reliableWindow[$index]);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\t$this->reliableWindow[$packet->messageIndex] = $packet;\n\t\t\t}\n\t\t}\n\n\t}\n\n\tpublic function getState(){\n\t\treturn $this->state;\n\t}\n\n\tpublic function isTemporal(){\n\t\treturn $this->isTemporal;\n\t}\n\n\tprivate function handleEncapsulatedPacketRoute(EncapsulatedPacket $packet){\n\t\tif($this->sessionManager === null){\n\t\t\treturn;\n\t\t}\n\n\t\tif($packet->hasSplit){\n\t\t\tif($this->state === self::STATE_CONNECTED){\n\t\t\t\t$this->handleSplit($packet);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\n\t\t$id = ord($packet->buffer{0});\n\t\tif($id < 0x80){ //internal data packet\n\t\t\tif($this->state === self::STATE_CONNECTING_2){\n\t\t\t\tif($id === CLIENT_CONNECT_DataPacket::$ID){\n\t\t\t\t\t$dataPacket = new CLIENT_CONNECT_DataPacket;\n\t\t\t\t\t$dataPacket->buffer = $packet->buffer;\n\t\t\t\t\t$dataPacket->decode();\n\t\t\t\t\t$pk = new SERVER_HANDSHAKE_DataPacket;\n\t\t\t\t\t$pk->address = $this->address;\n\t\t\t\t\t$pk->port = $this->port;\n\t\t\t\t\t$pk->sendPing = $dataPacket->sendPing;\n\t\t\t\t\t$pk->sendPong = bcadd($pk->sendPing, \"1000\");\n\t\t\t\t\t$pk->encode();\n\n\t\t\t\t\t$sendPacket = new EncapsulatedPacket();\n\t\t\t\t\t$sendPacket->reliability = PacketReliability::UNRELIABLE;\n\t\t\t\t\t$sendPacket->buffer = $pk->buffer;\n\t\t\t\t\t$this->addToQueue($sendPacket, RakLib::PRIORITY_IMMEDIATE);\n\t\t\t\t}elseif($id === CLIENT_HANDSHAKE_DataPacket::$ID){\n\t\t\t\t\t$dataPacket = new CLIENT_HANDSHAKE_DataPacket;\n\t\t\t\t\t$dataPacket->buffer = $packet->buffer;\n\t\t\t\t\t$dataPacket->decode();\n\n\t\t\t\t\tif($dataPacket->port === $this->sessionManager->getPort() or !$this->sessionManager->portChecking){\n\t\t\t\t\t\t$this->state = self::STATE_CONNECTED; //FINALLY!\n\t\t\t\t\t\t$this->isTemporal = false;\n\t\t\t\t\t\t$this->sessionManager->openSession($this);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}elseif($id === CLIENT_DISCONNECT_DataPacket::$ID){\n\t\t\t\t$this->disconnect(\"client disconnect\");\n\t\t\t}elseif($id === PING_DataPacket::$ID){\n\t\t\t\t$dataPacket = new PING_DataPacket;\n\t\t\t\t$dataPacket->buffer = $packet->buffer;\n\t\t\t\t$dataPacket->decode();\n\n\t\t\t\t$pk = new PONG_DataPacket;\n\t\t\t\t$pk->pingID = $dataPacket->pingID;\n\t\t\t\t$pk->encode();\n\n\t\t\t\t$sendPacket = new EncapsulatedPacket();\n\t\t\t\t$sendPacket->reliability = PacketReliability::UNRELIABLE;\n\t\t\t\t$sendPacket->buffer = $pk->buffer;\n\t\t\t\t$this->addToQueue($sendPacket);\n\t\t\t}//TODO: add PING/PONG (0x00/0x03) automatic latency measure\n\t\t}elseif($this->state === self::STATE_CONNECTED){\n\t\t\t$this->sessionManager->streamEncapsulated($this, $packet);\n\n\t\t\t//TODO: stream channels\n\t\t}else{\n\t\t\t//$this->sessionManager->getLogger()->notice(\"Received packet before connection: \" . bin2hex($packet->buffer));\n\t\t}\n\t}\n\n\tpublic function handlePacket(Packet $packet){\n\t\t$this->isActive = true;\n\t\t$this->lastUpdate = microtime(true);\n\t\tif($this->state === self::STATE_CONNECTED or $this->state === self::STATE_CONNECTING_2){\n\t\t\tif($packet::$ID >= 0x80 and $packet::$ID <= 0x8f and $packet instanceof DataPacket){ //Data packet\n\t\t\t\t$packet->decode();\n\n\t\t\t\tif($packet->seqNumber < $this->windowStart or $packet->seqNumber > $this->windowEnd or isset($this->receivedWindow[$packet->seqNumber])){\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t$diff = $packet->seqNumber - $this->lastSeqNumber;\n\n\t\t\t\tunset($this->NACKQueue[$packet->seqNumber]);\n\t\t\t\t$this->ACKQueue[$packet->seqNumber] = $packet->seqNumber;\n\t\t\t\t$this->receivedWindow[$packet->seqNumber] = $packet->seqNumber;\n\n\t\t\t\tif($diff !== 1){\n\t\t\t\t\tfor($i = $this->lastSeqNumber + 1; $i < $packet->seqNumber; ++$i){\n\t\t\t\t\t\tif(!isset($this->receivedWindow[$i])){\n\t\t\t\t\t\t\t$this->NACKQueue[$i] = $i;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif($diff >= 1){\n\t\t\t\t\t$this->lastSeqNumber = $packet->seqNumber;\n\t\t\t\t\t$this->windowStart += $diff;\n\t\t\t\t\t$this->windowEnd += $diff;\n\t\t\t\t}\n\n\t\t\t\tforeach($packet->packets as $pk){\n\t\t\t\t\t$this->handleEncapsulatedPacket($pk);\n\t\t\t\t}\n\t\t\t}else{\n\t\t\t\tif($packet instanceof ACK){\n\t\t\t\t\t$packet->decode();\n\t\t\t\t\tforeach($packet->packets as $seq){\n\t\t\t\t\t\tif(isset($this->recoveryQueue[$seq])){\n\t\t\t\t\t\t\tforeach($this->recoveryQueue[$seq]->packets as $pk){\n\t\t\t\t\t\t\t\tif($pk instanceof EncapsulatedPacket and $pk->needACK and $pk->messageIndex !== null){\n\t\t\t\t\t\t\t\t\tunset($this->needACK[$pk->identifierACK][$pk->messageIndex]);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tunset($this->recoveryQueue[$seq]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}elseif($packet instanceof NACK){\n\t\t\t\t\t$packet->decode();\n\t\t\t\t\tforeach($packet->packets as $seq){\n\t\t\t\t\t\tif(isset($this->recoveryQueue[$seq])){\n\t\t\t\t\t\t\t$pk = $this->recoveryQueue[$seq];\n\t\t\t\t\t\t\t$pk->seqNumber = $this->sendSeqNumber++;\n\t\t\t\t\t\t\t$this->packetToSend[] = $pk;\n\t\t\t\t\t\t\tunset($this->recoveryQueue[$seq]);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t}elseif($packet::$ID > 0x00 and $packet::$ID < 0x80){ //Not Data packet :)\n\t\t\t$packet->decode();\n\t\t\tif($packet instanceof OPEN_CONNECTION_REQUEST_1){\n\t\t\t\t$packet->protocol; //TODO: check protocol number and refuse connections\n\t\t\t\t$pk = new OPEN_CONNECTION_REPLY_1();\n\t\t\t\t$pk->mtuSize = $packet->mtuSize;\n\t\t\t\t$pk->serverID = $this->sessionManager->getID();\n\t\t\t\t$this->sendPacket($pk);\n\t\t\t\t$this->state = self::STATE_CONNECTING_1;\n\t\t\t}elseif($this->state === self::STATE_CONNECTING_1 and $packet instanceof OPEN_CONNECTION_REQUEST_2){\n\t\t\t\t$this->id = $packet->clientID;\n\t\t\t\tif($packet->serverPort === $this->sessionManager->getPort() or !$this->sessionManager->portChecking){\n \t\t\t\t\t$this->mtuSize = min(abs($packet->mtuSize), 1432);  //MTU — (Max IP Header Size) — (UDP Header Size) = 1500 — 60 — 8 = 1432 \n \t\t\t\t\t$pk = new OPEN_CONNECTION_REPLY_2();\n\t\t\t\t\t$pk->mtuSize = $this->mtuSize;\n\t\t\t\t\t$pk->serverID = $this->sessionManager->getID();\n\t\t\t\t\t$pk->clientAddress = $this->address;\n\t\t\t\t\t$pk->clientPort = $this->port;\n\t\t\t\t\t$this->sendPacket($pk);\n\t\t\t\t\t$this->state = self::STATE_CONNECTING_2;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function close(){\n\t\t$this->addEncapsulatedToQueue(EncapsulatedPacket::fromBinary(\"\\x60\\x00\\x08\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x15\")); //CLIENT_DISCONNECT packet 0x15\n\t\t$this->sessionManager = null;\n\t}\n}\n"
  },
  {
    "path": "src/raklib/server/SessionManager.php",
    "content": "<?php\n\n/*\n * RakLib network library\n *\n *\n * This project is not affiliated with Jenkins Software LLC nor RakNet.\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n */\n\nnamespace raklib\\server;\n\nuse raklib\\Binary;\nuse raklib\\protocol\\ACK;\nuse raklib\\protocol\\ADVERTISE_SYSTEM;\nuse raklib\\protocol\\DATA_PACKET_0;\nuse raklib\\protocol\\DATA_PACKET_1;\nuse raklib\\protocol\\DATA_PACKET_2;\nuse raklib\\protocol\\DATA_PACKET_3;\nuse raklib\\protocol\\DATA_PACKET_4;\nuse raklib\\protocol\\DATA_PACKET_5;\nuse raklib\\protocol\\DATA_PACKET_6;\nuse raklib\\protocol\\DATA_PACKET_7;\nuse raklib\\protocol\\DATA_PACKET_8;\nuse raklib\\protocol\\DATA_PACKET_9;\nuse raklib\\protocol\\DATA_PACKET_A;\nuse raklib\\protocol\\DATA_PACKET_B;\nuse raklib\\protocol\\DATA_PACKET_C;\nuse raklib\\protocol\\DATA_PACKET_D;\nuse raklib\\protocol\\DATA_PACKET_E;\nuse raklib\\protocol\\DATA_PACKET_F;\nuse raklib\\protocol\\EncapsulatedPacket;\nuse raklib\\protocol\\NACK;\nuse raklib\\protocol\\OPEN_CONNECTION_REPLY_1;\nuse raklib\\protocol\\OPEN_CONNECTION_REPLY_2;\nuse raklib\\protocol\\OPEN_CONNECTION_REQUEST_1;\nuse raklib\\protocol\\OPEN_CONNECTION_REQUEST_2;\nuse raklib\\protocol\\Packet;\nuse raklib\\protocol\\UNCONNECTED_PING;\nuse raklib\\protocol\\UNCONNECTED_PING_OPEN_CONNECTIONS;\nuse raklib\\protocol\\UNCONNECTED_PONG;\nuse raklib\\RakLib;\n\nclass SessionManager{\n\tprotected $packetPool = [];\n\n\t/** @var RakLibServer */\n\tprotected $server;\n\n\tprotected $socket;\n\n\tprotected $receiveBytes = 0;\n\tprotected $sendBytes = 0;\n\n\t/** @var Session[] */\n\tprotected $sessions = [];\n\n\tprotected $name = \"\";\n\n\tprotected $packetLimit = 1000;\n\n\tprotected $shutdown = false;\n\n\tprotected $ticks = 0;\n\tprotected $lastMeasure;\n\n\tprotected $block = [];\n\tprotected $ipSec = [];\n\n\tpublic $portChecking = true;\n\n\tpublic function __construct(RakLibServer $server, UDPServerSocket $socket){\n\t\t$this->server = $server;\n\t\t$this->socket = $socket;\n\t\t$this->registerPackets();\n\n\t\t$this->serverId = mt_rand(0, PHP_INT_MAX);\n\n\t\t$this->run();\n\t}\n\n\tpublic function getPort(){\n\t\treturn $this->server->getPort();\n\t}\n\n\tpublic function getLogger(){\n\t\treturn $this->server->getLogger();\n\t}\n\n\tpublic function run(){\n\t\t$this->tickProcessor();\n\t}\n\n\tprivate function tickProcessor(){\n\t\t$this->lastMeasure = microtime(true);\n\n\t\twhile(!$this->shutdown){\n\t\t\t$start = microtime(true);\n\t\t\t$max = 5000;\n\t\t\twhile(--$max and $this->receivePacket()) ;\n\t\t\twhile($this->receiveStream()) ;\n\t\t\t$time = microtime(true) - $start;\n\t\t\tif($time < 0.05){\n\t\t\t\t@time_sleep_until(microtime(true) + 0.05 - $time);\n\t\t\t}\n\t\t\t$this->tick();\n\t\t}\n\t}\n\n\tprivate function tick(){\n\t\t$time = microtime(true);\n\t\tforeach($this->sessions as $session){\n\t\t\t$session->update($time);\n\t\t}\n\n\t\tforeach($this->ipSec as $address => $count){\n\t\t\tif($count >= $this->packetLimit){\n\t\t\t\t$this->blockAddress($address);\n\t\t\t}\n\t\t}\n\t\t$this->ipSec = [];\n\n\n\t\tif(($this->ticks & 0b1111) === 0){\n\t\t\t$diff = max(0.005, $time - $this->lastMeasure);\n\t\t\t$this->streamOption(\"bandwidth\", serialize([\n\t\t\t\t\"up\" => $this->sendBytes / $diff,\n\t\t\t\t\"down\" => $this->receiveBytes / $diff\n\t\t\t]));\n\t\t\t$this->lastMeasure = $time;\n\t\t\t$this->sendBytes = 0;\n\t\t\t$this->receiveBytes = 0;\n\n\t\t\tif(count($this->block) > 0){\n\t\t\t\tasort($this->block);\n\t\t\t\t$now = microtime(true);\n\t\t\t\tforeach($this->block as $address => $timeout){\n\t\t\t\t\tif($timeout <= $now){\n\t\t\t\t\t\tunset($this->block[$address]);\n\t\t\t\t\t}else{\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t++$this->ticks;\n\t}\n\n\n\tprivate function receivePacket(){\n\t\t$len = $this->socket->readPacket($buffer, $source, $port);\n\t\tif($buffer !== null){\n\t\t\t$this->receiveBytes += $len;\n\t\t\tif(isset($this->block[$source])){\n\t\t\t\treturn true;\n\t\t\t}\n\n\t\t\tif(isset($this->ipSec[$source])){\n\t\t\t\t$this->ipSec[$source]++;\n\t\t\t}else{\n\t\t\t\t$this->ipSec[$source] = 1;\n\t\t\t}\n\n\t\t\tif($len > 0){\n\t\t\t\t$pid = ord($buffer{0});\n\n\t\t\t\tif($pid === UNCONNECTED_PING::$ID){\n\t\t\t\t\t//No need to create a session for just pings\n\t\t\t\t\t$packet = new UNCONNECTED_PING;\n\t\t\t\t\t$packet->buffer = $buffer;\n\t\t\t\t\t$packet->decode();\n\n\t\t\t\t\t$pk = new UNCONNECTED_PONG();\n\t\t\t\t\t$pk->serverID = $this->getID();\n\t\t\t\t\t$pk->pingID = $packet->pingID;\n\t\t\t\t\t$pk->serverName = $this->getName();\n\t\t\t\t\t$this->sendPacket($pk, $source, $port);\n\t\t\t\t}elseif($pid === UNCONNECTED_PONG::$ID){\n\t\t\t\t\t//ignored\n\t\t\t\t}elseif(($packet = $this->getPacketFromPool($pid)) !== null){\n\t\t\t\t\t$packet->buffer = $buffer;\n\t\t\t\t\t$this->getSession($source, $port)->handlePacket($packet);\n\t\t\t\t}else{\n\t\t\t\t\t$this->streamRaw($source, $port, $buffer);\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function sendPacket(Packet $packet, $dest, $port){\n\t\t$packet->encode();\n\t\t$this->sendBytes += $this->socket->writePacket($packet->buffer, $dest, $port);\n\t}\n\n\tpublic function streamEncapsulated(Session $session, EncapsulatedPacket $packet, $flags = RakLib::PRIORITY_NORMAL){\n\t\t$id = $session->getAddress() . \":\" . $session->getPort();\n\t\t$buffer = chr(RakLib::PACKET_ENCAPSULATED) . chr(strlen($id)) . $id . chr($flags) . $packet->toBinary(true);\n\t\t$this->server->pushThreadToMainPacket($buffer);\n\t}\n\n\tpublic function streamRaw($address, $port, $payload){\n\t\t$buffer = chr(RakLib::PACKET_RAW) . chr(strlen($address)) . $address . Binary::writeShort($port) . $payload;\n\t\t$this->server->pushThreadToMainPacket($buffer);\n\t}\n\n\tprotected function streamClose($identifier, $reason){\n\t\t$buffer = chr(RakLib::PACKET_CLOSE_SESSION) . chr(strlen($identifier)) . $identifier . chr(strlen($reason)) . $reason;\n\t\t$this->server->pushThreadToMainPacket($buffer);\n\t}\n\n\tprotected function streamInvalid($identifier){\n\t\t$buffer = chr(RakLib::PACKET_INVALID_SESSION) . chr(strlen($identifier)) . $identifier;\n\t\t$this->server->pushThreadToMainPacket($buffer);\n\t}\n\n\tprotected function streamOpen(Session $session){\n\t\t$identifier = $session->getAddress() . \":\" . $session->getPort();\n\t\t$buffer = chr(RakLib::PACKET_OPEN_SESSION) . chr(strlen($identifier)) . $identifier . chr(strlen($session->getAddress())) . $session->getAddress() . Binary::writeShort($session->getPort()) . Binary::writeLong($session->getID());\n\t\t$this->server->pushThreadToMainPacket($buffer);\n\t}\n\n\tprotected function streamACK($identifier, $identifierACK){\n\t\t$buffer = chr(RakLib::PACKET_ACK_NOTIFICATION) . chr(strlen($identifier)) . $identifier . Binary::writeInt($identifierACK);\n\t\t$this->server->pushThreadToMainPacket($buffer);\n\t}\n\n\tprotected function streamOption($name, $value){\n\t\t$buffer = chr(RakLib::PACKET_SET_OPTION) . chr(strlen($name)) . $name . $value;\n\t\t$this->server->pushThreadToMainPacket($buffer);\n\t}\n\n\tprivate function checkSessions(){\n\t\tif(count($this->sessions) > 4096){\n\t\t\tforeach($this->sessions as $i => $s){\n\t\t\t\tif($s->isTemporal()){\n\t\t\t\t\tunset($this->sessions[$i]);\n\t\t\t\t\tif(count($this->sessions) <= 4096){\n\t\t\t\t\t\tbreak;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic function receiveStream(){\n\t\tif(strlen($packet = $this->server->readMainToThreadPacket()) > 0){\n\t\t\t$id = ord($packet{0});\n\t\t\t$offset = 1;\n\t\t\tif($id === RakLib::PACKET_ENCAPSULATED){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\tif(isset($this->sessions[$identifier])){\n\t\t\t\t\t$flags = ord($packet{$offset++});\n\t\t\t\t\t$buffer = substr($packet, $offset);\n\t\t\t\t\t$this->sessions[$identifier]->addEncapsulatedToQueue(EncapsulatedPacket::fromBinary($buffer, true), $flags);\n\t\t\t\t}else{\n\t\t\t\t\t$this->streamInvalid($identifier);\n\t\t\t\t}\n\t\t\t}elseif($id === RakLib::PACKET_RAW){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$address = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$port = Binary::readShort(substr($packet, $offset, 2));\n\t\t\t\t$offset += 2;\n\t\t\t\t$payload = substr($packet, $offset);\n\t\t\t\t$this->socket->writePacket($payload, $address, $port);\n\t\t\t}elseif($id === RakLib::PACKET_CLOSE_SESSION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\tif(isset($this->sessions[$identifier])){\n\t\t\t\t\t$this->removeSession($this->sessions[$identifier]);\n\t\t\t\t}else{\n\t\t\t\t\t$this->streamInvalid($identifier);\n\t\t\t\t}\n\t\t\t}elseif($id === RakLib::PACKET_INVALID_SESSION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$identifier = substr($packet, $offset, $len);\n\t\t\t\tif(isset($this->sessions[$identifier])){\n\t\t\t\t\t$this->removeSession($this->sessions[$identifier]);\n\t\t\t\t}\n\t\t\t}elseif($id === RakLib::PACKET_SET_OPTION){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$name = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$value = substr($packet, $offset);\n\t\t\t\tswitch($name){\n\t\t\t\t\tcase \"name\":\n\t\t\t\t\t\t$this->name = $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"portChecking\":\n\t\t\t\t\t\t$this->portChecking = (bool) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t\tcase \"packetLimit\":\n\t\t\t\t\t\t$this->packetLimit = (int) $value;\n\t\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}elseif($id === RakLib::PACKET_BLOCK_ADDRESS){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$address = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$timeout = Binary::readInt(substr($packet, $offset, 4));\n\t\t\t\t$this->blockAddress($address, $timeout);\n\t\t\t}elseif($id === RakLib::PACKET_UNBLOCK_ADDRESS){\n\t\t\t\t$len = ord($packet{$offset++});\n\t\t\t\t$address = substr($packet, $offset, $len);\n\t\t\t\t$offset += $len;\n\t\t\t\t$this->unblockAddress($address);\n\t\t\t}elseif($id === RakLib::PACKET_SHUTDOWN){\n\t\t\t\tforeach($this->sessions as $session){\n\t\t\t\t\t$this->removeSession($session);\n\t\t\t\t}\n\n\t\t\t\t$this->socket->close();\n\t\t\t\t$this->shutdown = true;\n\t\t\t}elseif($id === RakLib::PACKET_EMERGENCY_SHUTDOWN){\n\t\t\t\t$this->shutdown = true;\n\t\t\t}else{\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\treturn true;\n\t\t}\n\n\t\treturn false;\n\t}\n\n\tpublic function blockAddress($address, $timeout = 300){\n\t\t$final = microtime(true) + $timeout;\n\t\tif(!isset($this->block[$address]) or $timeout === -1){\n\t\t\tif($timeout === -1){\n\t\t\t\t$final = PHP_INT_MAX;\n\t\t\t}else{\n\t\t\t\t$this->getLogger()->notice(\"Blocked $address for $timeout seconds\");\n\t\t\t}\n\t\t\t$this->block[$address] = $final;\n\t\t}elseif($this->block[$address] < $final){\n\t\t\t$this->block[$address] = $final;\n\t\t}\n\t}\n\t\n\tpublic function unblockAddress($address){\n\t\tunset($this->block[$address]);\n\t}\n\n\t/**\n\t * @param string $ip\n\t * @param int    $port\n\t *\n\t * @return Session\n\t */\n\tpublic function getSession($ip, $port){\n\t\t$id = $ip . \":\" . $port;\n\t\tif(!isset($this->sessions[$id])){\n\t\t\t$this->checkSessions();\n\t\t\t$this->sessions[$id] = new Session($this, $ip, $port);\n\t\t}\n\n\t\treturn $this->sessions[$id];\n\t}\n\n\tpublic function removeSession(Session $session, $reason = \"unknown\"){\n\t\t$id = $session->getAddress() . \":\" . $session->getPort();\n\t\tif(isset($this->sessions[$id])){\n\t\t\t$this->sessions[$id]->close();\n\t\t\tunset($this->sessions[$id]);\n\t\t\t$this->streamClose($id, $reason);\n\t\t}\n\t}\n\n\tpublic function openSession(Session $session){\n\t\t$this->streamOpen($session);\n\t}\n\n\tpublic function notifyACK(Session $session, $identifierACK){\n\t\t$this->streamACK($session->getAddress() . \":\" . $session->getPort(), $identifierACK);\n\t}\n\n\tpublic function getName() : string{\n\t\treturn $this->name;\n\t}\n\n\tpublic function getID(){\n\t\treturn $this->serverId;\n\t}\n\n\tprivate function registerPacket($id, $class){\n\t\t$this->packetPool[$id] = new $class;\n\t}\n\n\t/**\n\t * @param $id\n\t *\n\t * @return Packet\n\t */\n\tpublic function getPacketFromPool($id){\n\t\tif(isset($this->packetPool[$id])){\n\t\t\treturn clone $this->packetPool[$id];\n\t\t}\n\n\t\treturn null;\n\t}\n\n\tprivate function registerPackets(){\n\t\t//$this->registerPacket(UNCONNECTED_PING::$ID, UNCONNECTED_PING::class);\n\t\t$this->registerPacket(UNCONNECTED_PING_OPEN_CONNECTIONS::$ID, UNCONNECTED_PING_OPEN_CONNECTIONS::class);\n\t\t$this->registerPacket(OPEN_CONNECTION_REQUEST_1::$ID, OPEN_CONNECTION_REQUEST_1::class);\n\t\t$this->registerPacket(OPEN_CONNECTION_REPLY_1::$ID, OPEN_CONNECTION_REPLY_1::class);\n\t\t$this->registerPacket(OPEN_CONNECTION_REQUEST_2::$ID, OPEN_CONNECTION_REQUEST_2::class);\n\t\t$this->registerPacket(OPEN_CONNECTION_REPLY_2::$ID, OPEN_CONNECTION_REPLY_2::class);\n\t\t$this->registerPacket(UNCONNECTED_PONG::$ID, UNCONNECTED_PONG::class);\n\t\t$this->registerPacket(ADVERTISE_SYSTEM::$ID, ADVERTISE_SYSTEM::class);\n\t\t$this->registerPacket(DATA_PACKET_0::$ID, DATA_PACKET_0::class);\n\t\t$this->registerPacket(DATA_PACKET_1::$ID, DATA_PACKET_1::class);\n\t\t$this->registerPacket(DATA_PACKET_2::$ID, DATA_PACKET_2::class);\n\t\t$this->registerPacket(DATA_PACKET_3::$ID, DATA_PACKET_3::class);\n\t\t$this->registerPacket(DATA_PACKET_4::$ID, DATA_PACKET_4::class);\n\t\t$this->registerPacket(DATA_PACKET_5::$ID, DATA_PACKET_5::class);\n\t\t$this->registerPacket(DATA_PACKET_6::$ID, DATA_PACKET_6::class);\n\t\t$this->registerPacket(DATA_PACKET_7::$ID, DATA_PACKET_7::class);\n\t\t$this->registerPacket(DATA_PACKET_8::$ID, DATA_PACKET_8::class);\n\t\t$this->registerPacket(DATA_PACKET_9::$ID, DATA_PACKET_9::class);\n\t\t$this->registerPacket(DATA_PACKET_A::$ID, DATA_PACKET_A::class);\n\t\t$this->registerPacket(DATA_PACKET_B::$ID, DATA_PACKET_B::class);\n\t\t$this->registerPacket(DATA_PACKET_C::$ID, DATA_PACKET_C::class);\n\t\t$this->registerPacket(DATA_PACKET_D::$ID, DATA_PACKET_D::class);\n\t\t$this->registerPacket(DATA_PACKET_E::$ID, DATA_PACKET_E::class);\n\t\t$this->registerPacket(DATA_PACKET_F::$ID, DATA_PACKET_F::class);\n\t\t$this->registerPacket(NACK::$ID, NACK::class);\n\t\t$this->registerPacket(ACK::$ID, ACK::class);\n\t}\n}\n"
  },
  {
    "path": "src/raklib/server/UDPServerSocket.php",
    "content": "<?php\n\n/*\n *\n *  ____            _        _   __  __ _                  __  __ ____\n * |  _ \\ ___   ___| | _____| |_|  \\/  (_)_ __   ___      |  \\/  |  _ \\\n * | |_) / _ \\ / __| |/ / _ \\ __| |\\/| | | '_ \\ / _ \\_____| |\\/| | |_) |\n * |  __/ (_) | (__|   <  __/ |_| |  | | | | | |  __/_____| |  | |  __/\n * |_|   \\___/ \\___|_|\\_\\___|\\__|_|  |_|_|_| |_|\\___|     |_|  |_|_|\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * @author PocketMine Team\n * @link http://www.pocketmine.net/\n * \n *\n*/\n\nnamespace raklib\\server;\n\nclass UDPServerSocket{\n\t/** @var \\Logger */\n\tprotected $logger;\n\tprotected $socket;\n\n\tpublic function __construct(\\ThreadedLogger $logger, $port = 19132, $interface = \"0.0.0.0\"){\n\t\t$this->socket = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);\n\t\t//socket_set_option($this->socket, SOL_SOCKET, SO_BROADCAST, 1); //Allow sending broadcast messages\n\t\tif(@socket_bind($this->socket, $interface, $port) === true){\n\t\t\tsocket_set_option($this->socket, SOL_SOCKET, SO_REUSEADDR, 0);\n\t\t\t$this->setSendBuffer(1024 * 1024 * 8)->setRecvBuffer(1024 * 1024 * 8);\n\t\t}else{\n\t\t\t$logger->critical(\"**** FAILED TO BIND TO \" . $interface . \":\" . $port . \"!\", true, true, 0);\n\t\t\t$logger->critical(\"Perhaps a server is already running on that port?\", true, true, 0);\n\t\t\texit(1);\n\t\t}\n\t\tsocket_set_nonblock($this->socket);\n\t}\n\n\tpublic function getSocket(){\n\t\treturn $this->socket;\n\t}\n\n\tpublic function close(){\n\t\tsocket_close($this->socket);\n\t}\n\n\t/**\n\t * @param string &$buffer\n\t * @param string &$source\n\t * @param int    &$port\n\t *\n\t * @return int\n\t */\n\tpublic function readPacket(&$buffer, &$source, &$port){\n\t\treturn socket_recvfrom($this->socket, $buffer, 65535, 0, $source, $port);\n\t}\n\n\t/**\n\t * @param string $buffer\n\t * @param string $dest\n\t * @param int    $port\n\t *\n\t * @return int\n\t */\n\tpublic function writePacket($buffer, $dest, $port){\n\t\treturn socket_sendto($this->socket, $buffer, strlen($buffer), 0, $dest, $port);\n\t}\n\n\t/**\n\t * @param int $size\n\t *\n\t * @return $this\n\t */\n\tpublic function setSendBuffer($size){\n\t\t@socket_set_option($this->socket, SOL_SOCKET, SO_SNDBUF, $size);\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * @param int $size\n\t *\n\t * @return $this\n\t */\n\tpublic function setRecvBuffer($size){\n\t\t@socket_set_option($this->socket, SOL_SOCKET, SO_RCVBUF, $size);\n\n\t\treturn $this;\n\t}\n\n}\n\n?>"
  },
  {
    "path": "src/spl/ArrayOutOfBoundsException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass ArrayOutOfBoundsException extends OutOfBoundsException{\n\n}"
  },
  {
    "path": "src/spl/AttachableLogger.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\ninterface AttachableLogger extends \\Logger{\n\n    /**\n     * @param LoggerAttachment $attachment\n     */\n    public function addAttachment(\\LoggerAttachment $attachment);\n\n    /**\n     * @param LoggerAttachment $attachment\n     */\n    public function removeAttachment(\\LoggerAttachment $attachment);\n\n    public function removeAttachments();\n\n    /**\n     * @return \\LoggerAttachment[]\n     */\n    public function getAttachments();\n}"
  },
  {
    "path": "src/spl/AttachableThreadedLogger.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nabstract class AttachableThreadedLogger extends \\ThreadedLogger{\n\n    /** @var \\ThreadedLoggerAttachment */\n    protected $attachment = null;\n\n    /**\n     * @param ThreadedLoggerAttachment $attachment\n     */\n    public function addAttachment(\\ThreadedLoggerAttachment $attachment){\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            $this->attachment->addAttachment($attachment);\n        }else{\n            $this->attachment = $attachment;\n        }\n    }\n\n    /**\n     * @param ThreadedLoggerAttachment $attachment\n     */\n    public function removeAttachment(\\ThreadedLoggerAttachment $attachment){\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            if($this->attachment === $attachment){\n                $this->attachment = null;\n                foreach($attachment->getAttachments() as $attachment){\n                    $this->addAttachment($attachment);\n                }\n            }\n        }\n    }\n\n    public function removeAttachments(){\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            $this->attachment->removeAttachments();\n            $this->attachment = null;\n        }\n    }\n\n    /**\n     * @return \\ThreadedLoggerAttachment[]\n     */\n    public function getAttachments(){\n        $attachments = [];\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            $attachments[] = $this->attachment;\n            $attachments += $this->attachment->getAttachments();\n        }\n\n        return $attachments;\n    }\n}"
  },
  {
    "path": "src/spl/BaseClassLoader.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass BaseClassLoader extends \\Threaded implements ClassLoader{\n\n    /** @var \\ClassLoader */\n    private $parent;\n    /** @var string[] */\n    private $lookup;\n    /** @var string[] */\n    private $classes;\n\n\n    /**\n     * @param ClassLoader $parent\n     */\n    public function __construct(ClassLoader $parent = null){\n        $this->parent = $parent;\n        $this->lookup = new \\Threaded;\n        $this->classes = new \\Threaded;\n    }\n\n    /**\n     * Adds a path to the lookup list\n     *\n     * @param string $path\n     * @param bool   $prepend\n     */\n    public function addPath($path, $prepend = false){\n\n        foreach($this->lookup as $p){\n            if($p === $path){\n                return;\n            }\n        }\n\n        if($prepend){\n\t\t\t$this->synchronized(function($path){\n\t\t\t\t$entries = $this->getAndRemoveLookupEntries();\n\t\t\t\t$this->lookup[] = $path;\n\t\t\t\tforeach($entries as $entry){\n\t\t\t\t\t$this->lookup[] = $entry;\n\t\t\t\t}\n\t\t\t}, $path);\n        }else{\n            $this->lookup[] = $path;\n        }\n    }\n    \n    protected function getAndRemoveLookupEntries(){\n\t\t$entries = [];\n\t\twhile($this->count() > 0){\n\t\t\t$entries[] = $this->shift();\n\t\t}\n\t\treturn $entries;\n\t}\n\n    /**\n     * Removes a path from the lookup list\n     *\n     * @param $path\n     */\n    public function removePath($path){\n        foreach($this->lookup as $i => $p){\n            if($p === $path){\n                unset($this->lookup[$i]);\n            }\n        }\n    }\n\n    /**\n     * Returns an array of the classes loaded\n     *\n     * @return string[]\n     */\n    public function getClasses(){\n\t\t$classes = [];\n\t\tforeach($this->classes as $class){\n\t\t\t$classes[] = $class;\n\t\t}\n        return $classes;\n    }\n\n    /**\n     * Returns the parent ClassLoader, if any\n     *\n     * @return ClassLoader\n     */\n    public function getParent(){\n        return $this->parent;\n    }\n\n    /**\n     * Attaches the ClassLoader to the PHP runtime\n     *\n     * @param bool $prepend\n     *\n     * @return bool\n     */\n    public function register($prepend = false){\n        spl_autoload_register([$this, \"loadClass\"], true, $prepend);\n    }\n\n    /**\n     * Called when there is a class to load\n     *\n     * @param string $name\n     *\n     * @return bool\n     */\n    public function loadClass($name){\n        $path = $this->findClass($name);\n        if($path !== null){\n            include($path);\n            if(!class_exists($name, false) and !interface_exists($name, false) and !trait_exists($name, false)){\n\t            if($this->getParent() === null){\n\t\t            throw new ClassNotFoundException(\"Class $name not found\");\n\t            }\n                return false;\n            }\n\n\t        if(method_exists($name, \"onClassLoaded\") and (new ReflectionClass($name))->getMethod(\"onClassLoaded\")->isStatic()){\n\t\t        $name::onClassLoaded();\n\t        }\n\t        \n\t        $this->classes[] = $name;\n\n            return true;\n        }elseif($this->getParent() === null){\n\t        throw new ClassNotFoundException(\"Class $name not found\");\n        }\n\n        return false;\n    }\n\n    /**\n     * Returns the path for the class, if any\n     *\n     * @param string $name\n     *\n     * @return string|null\n     */\n    public function findClass($name){\n        $components = explode(\"\\\\\", $name);\n\n        $baseName = implode(DIRECTORY_SEPARATOR, $components);\n\n\n        foreach($this->lookup as $path){\n            if(PHP_INT_SIZE === 8 and file_exists($path . DIRECTORY_SEPARATOR . $baseName . \"__64bit.php\")){\n                return $path . DIRECTORY_SEPARATOR . $baseName . \"__64bit.php\";\n            }elseif(PHP_INT_SIZE === 4 and file_exists($path . DIRECTORY_SEPARATOR . $baseName . \"__32bit.php\")){\n                return $path . DIRECTORY_SEPARATOR . $baseName . \"__32bit.php\";\n            }elseif(file_exists($path . DIRECTORY_SEPARATOR . $baseName . \".php\")){\n                return $path . DIRECTORY_SEPARATOR . $baseName . \".php\";\n            }\n        }\n\n        return null;\n    }\n}\n"
  },
  {
    "path": "src/spl/ClassCastException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass ClassCastException extends InvalidArgumentException{\n\n}"
  },
  {
    "path": "src/spl/ClassLoader.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\ninterface ClassLoader{\n\n    /**\n     * @param ClassLoader $parent\n     */\n    public function __construct(ClassLoader $parent = null);\n\n    /**\n     * Adds a path to the lookup list\n     *\n     * @param string $path\n     * @param bool   $prepend\n     */\n    public function addPath($path, $prepend = false);\n\n    /**\n     * Removes a path from the lookup list\n     *\n     * @param $path\n     */\n    public function removePath($path);\n\n    /**\n     * Returns an array of the classes loaded\n     *\n     * @return string[]\n     */\n    public function getClasses();\n\n    /**\n     * Returns the parent ClassLoader, if any\n     *\n     * @return ClassLoader\n     */\n    public function getParent();\n\n    /**\n     * Attaches the ClassLoader to the PHP runtime\n     *\n     * @param bool $prepend\n     *\n     * @return bool\n     */\n    public function register($prepend = false);\n\n    /**\n     * Called when there is a class to load\n     *\n     * @param string $name\n     *\n     * @return bool\n     *\n     * @throws ClassNotFoundException\n     */\n    public function loadClass($name);\n\n    /**\n     * Returns the path for the class, if any\n     *\n     * @param string $name\n     *\n     * @return string|null\n     */\n    public function findClass($name);\n}"
  },
  {
    "path": "src/spl/ClassNotFoundException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass ClassNotFoundException extends LogicException{\n\n}"
  },
  {
    "path": "src/spl/InvalidArgumentCountException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass InvalidArgumentCountException extends InvalidArgumentException{\n\n}"
  },
  {
    "path": "src/spl/InvalidKeyException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass InvalidKeyException extends InvalidArgumentException{\n\n}"
  },
  {
    "path": "src/spl/InvalidStateException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass InvalidStateException extends InvalidArgumentException{\n\n}"
  },
  {
    "path": "src/spl/LogLevel.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\ninterface LogLevel{\n    const EMERGENCY = \"emergency\";\n    const ALERT = \"alert\";\n    const CRITICAL = \"critical\";\n    const ERROR = \"error\";\n    const WARNING = \"warning\";\n    const NOTICE = \"notice\";\n    const INFO = \"info\";\n    const DEBUG = \"debug\";\n}"
  },
  {
    "path": "src/spl/Logger.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\ninterface Logger{\n\n    /**\n     * System is unusable\n     *\n     * @param string $message\n     */\n    public function emergency($message);\n\n    /**\n     * Action must me taken immediately\n     *\n     * @param string $message\n     */\n    public function alert($message);\n\n    /**\n     * Critical conditions\n     *\n     * @param string $message\n     */\n    public function critical($message);\n\n    /**\n     * Runtime errors that do not require immediate action but should typically\n     * be logged and monitored.\n     *\n     * @param string $message\n     */\n    public function error($message);\n\n    /**\n     * Exceptional occurrences that are not errors.\n     *\n     * Example: Use of deprecated APIs, poor use of an API, undesirable things\n     * that are not necessarily wrong.\n     *\n     * @param string $message\n     */\n    public function warning($message);\n\n    /**\n     * Normal but significant events.\n     *\n     * @param string $message\n     */\n    public function notice($message);\n\n    /**\n     * Inersting events.\n     *\n     * @param string $message\n     */\n    public function info($message);\n\n    /**\n     * Detailed debug information.\n     *\n     * @param string $message\n     */\n    public function debug($message);\n\n    /**\n     * Logs with an arbitrary level.\n     *\n     * @param mixed  $level\n     * @param string $message\n     */\n    public function log($level, $message);\n\n    /**\n     * Logs a Throwable object\n     *\n     * @param Throwable $e\n     * @param $trace\n     */\n    public function logException(\\Throwable $e, $trace = null);\n}"
  },
  {
    "path": "src/spl/LoggerAttachment.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\ninterface LoggerAttachment{\n\n    /**\n     * @param mixed  $level\n     * @param string $message\n     */\n    public function log($level, $message);\n\n}"
  },
  {
    "path": "src/spl/SplFixedByteArray.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass SplFixedByteArray extends SplFixedArray{\n\n\tprivate $convert;\n\n\tpublic function __construct($size, $convert = false){\n\t\tparent::__construct($size);\n\t\t$this->convert = (bool) $convert;\n\t}\n\n\tpublic function chunk($start, $size, $normalize = true){\n\t\t$end = $start + $size;\n\t\tif($normalize and $this->convert){\n\t\t\t$d = \"\";\n\t\t\tfor($i = $start; $i < $end; ++$i){\n\t\t\t\t$d .= chr($this[$i]);\n\t\t\t}\n\t\t}else{\n\t\t\t$d = [];\n\t\t\tfor($i = $start; $i < $end; ++$i){\n\t\t\t\t$d[] = $this[$i];\n\t\t\t}\n\t\t}\n\t\treturn $d;\n\t}\n\n\t/**\n\t * @param string $str\n\t * @param bool   $convert\n\t *\n\t * @return SplFixedByteArray\n\t */\n\tpublic static function fromString($str, $convert = false){\n\t\t$len = strlen($str);\n\t\t$ob = new SplFixedByteArray($len, $convert);\n\n\t\tif($convert){\n\t\t\tfor($i = 0; $i < $len; ++$i){\n\t\t\t\t$ob[$i] = ord($str{$i});\n\t\t\t}\n\t\t}else{\n\t\t\tfor($i = 0; $i < $len; ++$i){\n\t\t\t\t$ob[$i] = $str{$i};\n\t\t\t}\n\t\t}\n\n\t\treturn $ob;\n\t}\n\n\t/**\n\t * @param string $str\n\t * @param int    $size\n\t * @param int    $start\n\t * @param bool   $convert\n\t *\n\t * @return SplFixedByteArray\n\t */\n\tpublic static function fromStringChunk($str, $size, $start = 0, $convert = false){\n\t\t$ob = new SplFixedByteArray($size, $convert);\n\n\t\tif($convert){\n\t\t\tfor($i = 0; $i < $size; ++$i){\n\t\t\t\t$ob[$i] = ord($str{$i + $start});\n\t\t\t}\n\t\t}else{\n\t\t\tfor($i = 0; $i < $size; ++$i){\n\t\t\t\t$ob[$i] = $str{$i + $start};\n\t\t\t}\n\t\t}\n\n\t\treturn $ob;\n\t}\n\n\tpublic function toString(){\n\t\t$result = \"\";\n\t\tif($this->convert){\n\t\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t\t$result .= chr($this[$i]);\n\t\t\t}\n\t\t}else{\n\t\t\tfor($i = 0; $i < $this->getSize(); ++$i){\n\t\t\t\t$result .= $this[$i];\n\t\t\t}\n\t\t}\n\t\treturn $result;\n\t}\n\n\tpublic function __toString(){\n\t\treturn $this->toString();\n\t}\n}"
  },
  {
    "path": "src/spl/StringOutOfBoundsException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass StringOutOfBoundsException extends OutOfBoundsException{\n\n}"
  },
  {
    "path": "src/spl/ThreadedLogger.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nabstract class ThreadedLogger extends \\Thread implements Logger{\n\n}"
  },
  {
    "path": "src/spl/ThreadedLoggerAttachment.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nabstract class ThreadedLoggerAttachment extends \\Threaded implements \\LoggerAttachment{\n\n    /** @var \\ThreadedLoggerAttachment */\n    protected $attachment = null;\n\n    /**\n     * @param mixed  $level\n     * @param string $message\n     */\n    public final function call($level, $message){\n        $this->log($level, $message);\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            $this->attachment->call($level, $message);\n        }\n    }\n\n    /**\n     * @param ThreadedLoggerAttachment $attachment\n     */\n    public function addAttachment(\\ThreadedLoggerAttachment $attachment){\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            $this->attachment->addAttachment($attachment);\n        }else{\n            $this->attachment = $attachment;\n        }\n    }\n\n    /**\n     * @param ThreadedLoggerAttachment $attachment\n     */\n    public function removeAttachment(\\ThreadedLoggerAttachment $attachment){\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            if($this->attachment === $attachment){\n                $this->attachment = null;\n                foreach($attachment->getAttachments() as $attachment){\n                    $this->addAttachment($attachment);\n                }\n            }\n        }\n    }\n\n    public function removeAttachments(){\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            $this->attachment->removeAttachments();\n            $this->attachment = null;\n        }\n    }\n\n    /**\n     * @return \\ThreadedLoggerAttachment[]\n     */\n    public function getAttachments(){\n        $attachments = [];\n        if($this->attachment instanceof \\ThreadedLoggerAttachment){\n            $attachments[] = $this->attachment;\n            $attachments += $this->attachment->getAttachments();\n        }\n\n        return $attachments;\n    }\n}"
  },
  {
    "path": "src/spl/UndefinedConstantException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass UndefinedConstantException extends InvalidStateException{\n\n}"
  },
  {
    "path": "src/spl/UndefinedPropertyException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass UndefinedPropertyException extends LogicException{\n\n}"
  },
  {
    "path": "src/spl/UndefinedVariableException.php",
    "content": "<?php\n\n/*\n * PocketMine Standard PHP Library\n * Copyright (C) 2014 PocketMine Team <https://github.com/PocketMine/PocketMine-SPL>\n *\n * This program is free software: you can redistribute it and/or modify\n * it under the terms of the GNU Lesser General Public License as published by\n * the Free Software Foundation, either version 3 of the License, or\n * (at your option) any later version.\n *\n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n * GNU General Public License for more details.\n*/\n\nclass UndefinedVariableException extends InvalidStateException{\n\n}"
  },
  {
    "path": "start.cmd",
    "content": "@echo off\r\nTITLE Elywing server software for Minecraft: Pocket Edition // No Real utility\r\ncd /d %~dp0\r\n\r\nif exist bin\\php\\php.exe (\r\n\tset PHPRC=\"\"\r\n\tset PHP_BINARY=bin\\php\\php.exe\r\n) else (\r\n\tset PHP_BINARY=php\r\n)\r\n\r\nif exist Elywing*.phar (\r\n\tset POCKETMINE_FILE=Elywing*.phar\r\n) else (\r\nif exist Elywing.phar (\r\n\tset POCKETMINE_FILE=Elywing.phar\r\n) else (\r\n\tif exist src\\pocketmine\\PocketMine.php (\r\n\t\tset POCKETMINE_FILE=src\\pocketmine\\PocketMine.php\r\n\t) else (\r\n\t\techo \"Couldn't find a valid Elywing installation\"\r\n\t\tpause\r\n\t\texit 1\r\n\t)\r\n)\r\n\r\nREM if exist bin\\php\\php_wxwidgets.dll (\r\nREM \t%PHP_BINARY% %POCKETMINE_FILE% --enable-gui %*\r\nREM ) else (\r\n\tif exist bin\\mintty.exe (\r\n\t\tstart \"\" bin\\mintty.exe -o Columns=88 -o Rows=32 -o AllowBlinking=0 -o FontQuality=3 -o Font=\"Consolas\" -o FontHeight=10 -o CursorType=0 -o CursorBlinks=1 -h error -t \"Elywing\" -w max %PHP_BINARY% %POCKETMINE_FILE% --enable-ansi %*\r\n\t) else (\r\n\t\t%PHP_BINARY% -c bin\\php %POCKETMINE_FILE% %*\r\n\t)\r\nREM )\r\n"
  },
  {
    "path": "start.sh",
    "content": "#!/bin/bash\nDIR=\"$(cd -P \"$( dirname \"${BASH_SOURCE[0]}\" )\" && pwd)\"\ncd \"$DIR\"\n\nDO_LOOP=\"no\"\n\nwhile getopts \"p:f:l\" OPTION 2> /dev/null; do\n\tcase ${OPTION} in\n\t\tp)\n\t\t\tPHP_BINARY=\"$OPTARG\"\n\t\t\t;;\n\t\tf)\n\t\t\tPOCKETMINE_FILE=\"$OPTARG\"\n\t\t\t;;\n\t\tl)\n\t\t\tDO_LOOP=\"yes\"\n\t\t\t;;\n\t\t\\?)\n\t\t\tbreak\n\t\t\t;;\n\tesac\ndone\n\nif [ \"$PHP_BINARY\" == \"\" ]; then\n\tif [ -f ./bin/php7/bin/php ]; then\n\t\texport PHPRC=\"\"\n\t\tPHP_BINARY=\"./bin/php7/bin/php\"\n\telif [ type php 2>/dev/null ]; then\n\t\tPHP_BINARY=$(type -p php)\n\telse\n\t\techo \"Couldn't find a working PHP 7 binary, please use the installer.\"\n\t\texit 1\n\tfi\nfi\n\nif [ \"$POCKETMINE_FILE\" == \"\" ]; then\n\tif [ -f ./PocketMine-MP.phar ]; then\n\t\tPOCKETMINE_FILE=\"./PocketMine-MP.phar\"\n        elif [ -f ./Elywing.phar ]; then\n\t\tPOCKETMINE_FILE=\"./Elywing.phar\"\n        elif [ -f ./Elywing*.phar ]; then\n\t\tPOCKETMINE_FILE=\"./Elywing*.phar\"\n\telif [ -f ./src/pocketmine/PocketMine.php ]; then\n\t\tPOCKETMINE_FILE=\"./src/pocketmine/PocketMine.php\"\n\telse\n\t\techo \"Couldn't find a valid Elywing installation\"\n\t\texit 1\n\tfi\nfi\n\nLOOPS=0\n\nset +e\nwhile [ \"$LOOPS\" -eq 0 ] || [ \"$DO_LOOP\" == \"yes\" ]; do\n\tif [ \"$DO_LOOP\" == \"yes\" ]; then\n\t\t\"$PHP_BINARY\" \"$POCKETMINE_FILE\" $@\n\telse\n\t\texec \"$PHP_BINARY\" \"$POCKETMINE_FILE\" $@\n\tfi\n\t((LOOPS++))\ndone\n\nif [ ${LOOPS} -gt 1 ]; then\n\techo \"Restarted $LOOPS times\"\nfi\n"
  }
]