diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e91d1d1d..a0675237f 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,6 +1,6 @@ ![](http://www.pocketmine.net/favicon.png) -# PocketMine-MP Contribution Gidelines +# PocketMine-MP Contribution Guidelines Before contributing to PocketMine-MP, please read this. @@ -20,8 +20,54 @@ Before contributing to PocketMine-MP, please read this. * Use the [Pull Request](https://github.com/PocketMine/PocketMine-MP/pull/new) system, your request will be checked and discussed. * __Create a single branch for that pull request__ * If you want to be part of PocketMine-MP, we will ask you to. -* Code using the syntax as in PocketMine-MP. +* Code using the syntax as in PocketMine-MP. See below for an example. * The code must be clear and written in English, comments included. __Thanks for contributing to PocketMine-MP!__ + + + + +#### Code syntax + +It is mainly [PSR-2](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md) with a few exceptions. +* Opening braces MUST go on the same line. +* `else if` MUST be written as `elseif`. _(It is in PSR-2, but using a SHOULD)_ +* Control structure keywords or opening braces MUST NOT have one space after them. +* Code MUST use tabs for indenting. +* Long arrays MAY be split across multiple lines, where each subsequent line is indented once. +* Files MUST use only the `` tag. +* Code MUST NOT use namespaces. _(This restriction will be lifted on the Alpha_1.4 code)_ +* Strings SHOULD use the double quote `"` except when the single quote is required. +* Arrays SHOULD be declared using `array()`, not the `[]` shortcut. +* Argument lists MAY NOT be split across multiple lines, except long arrays. + +```php + "value1", + 1 => "value2", + 2 => "value3", + 3 => "value4", + 4 => "value5", + 5 => "value6", + ); + } + } + } + +} +``` \ No newline at end of file diff --git a/src/Player.php b/src/Player.php index 207e63ca6..4bada15b9 100644 --- a/src/Player.php +++ b/src/Player.php @@ -802,6 +802,7 @@ class Player{ } if(is_array($res)){ + if($this->server->api->dhandle("player.craft", array("player" => $this, "recipe" => $recipe, "craft" => $craft, "type" => $type)) === false){ return false; } @@ -851,6 +852,9 @@ class Player{ case DIAMOND: AchievementAPI::grantAchievement($this, "diamond"); break; + case CAKE: + $this->addItem(BUCKET, 0, 3, false); + break; } } @@ -1852,7 +1856,7 @@ class Player{ $items = array( APPLE => 2, MUSHROOM_STEW => 10, - //BEETROOT_SOUP => ??, + BEETROOT_SOUP => 10, BREAD => 5, RAW_PORKCHOP => 3, COOKED_PORKCHOP => 8, diff --git a/src/world/Explosion.php b/src/world/Explosion.php index 952eb9e65..35efded3e 100644 --- a/src/world/Explosion.php +++ b/src/world/Explosion.php @@ -98,7 +98,28 @@ class Explosion{ $e = $server->api->entity->add($this->level, ENTITY_OBJECT, OBJECT_PRIMEDTNT, $data); $server->api->entity->spawnToAll($e); }elseif(mt_rand(0, 10000) < ((1/$this->size) * 10000)){ - $server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem($block->getID(), $this->level->level->getBlockDamage($block->x, $block->y, $block->z))); + switch ($block->getID()) { + + case GRASS: + $server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem(DIRT, $this->level->level->getBlockDamage($block->x, $block->y, $block->z))); + break; + + case STONE: + $server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem(COBBLESTONE, $this->level->level->getBlockDamage($block->x, $block->y, $block->z))); + break; + + case COAL_ORE: + $server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), new CoalItem()); + break; + + case DIAMOND_ORE: + $server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), new DiamondItem()); + break; + + default: + $server->api->entity->drop(new Position($block->x + 0.5, $block->y, $block->z + 0.5, $this->level), BlockAPI::getItem($block->getID(), $this->level->level->getBlockDamage($block->x, $block->y, $block->z))); + break; + } } $this->level->level->setBlockID($block->x, $block->y, $block->z, 0); $send[] = new Vector3($block->x - $source->x, $block->y - $source->y, $block->z - $source->z); @@ -112,4 +133,4 @@ class Explosion{ )); } -} \ No newline at end of file +}