From 273a74d5667e3ebe08c419566c7c58d0f0dc381c Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 25 Nov 2013 18:01:19 +0100 Subject: [PATCH 1/8] Added Beetroot Soup food value --- src/Player.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Player.php b/src/Player.php index 4c9938b09..b25d04794 100644 --- a/src/Player.php +++ b/src/Player.php @@ -1832,7 +1832,7 @@ class Player{ $items = array( APPLE => 2, MUSHROOM_STEW => 10, - //BEETROOT_SOUP => ??, + BEETROOT_SOUP => 10, BREAD => 5, RAW_PORKCHOP => 3, COOKED_PORKCHOP => 8, From a0fac713850228ec1e0a305d6957a162a7fec3bf Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 25 Nov 2013 18:34:06 +0100 Subject: [PATCH 2/8] Added coding standards by request of @sekjun9878. Fixed #949 [gh#949] --- CONTRIBUTING.md | 47 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 46 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 6e91d1d1d..3ed560835 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -20,8 +20,53 @@ 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 From 286b30cf4e8b4531177ead860894bd676a8e2f8b Mon Sep 17 00:00:00 2001 From: Shoghi Cervantes Date: Mon, 25 Nov 2013 18:36:03 +0100 Subject: [PATCH 3/8] Giant typo --- CONTRIBUTING.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3ed560835..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. @@ -28,6 +28,7 @@ __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. From 5fc192b73039e3fac3cbb76404c38d0b915b2e1d Mon Sep 17 00:00:00 2001 From: InusualZ Date: Mon, 25 Nov 2013 18:27:34 -0500 Subject: [PATCH 4/8] Fixed gh#332 Crafting with buckets (milk) returns the bucket --- src/Player.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/Player.php b/src/Player.php index b25d04794..c11f0cadc 100644 --- a/src/Player.php +++ b/src/Player.php @@ -791,6 +791,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; } @@ -840,6 +841,11 @@ class Player{ case DIAMOND: AchievementAPI::grantAchievement($this, "diamond"); break; + case CAKE: + for($i; $i <= 2; $i++){ + $this->addItem(BUCKET, 0, 1, false); + } + break; } } From c798a33363ca9ad4a3cd6157e3805da1441eb2fe Mon Sep 17 00:00:00 2001 From: InusualZ Date: Mon, 25 Nov 2013 18:53:02 -0500 Subject: [PATCH 5/8] Fixed gh#332 Crafting with buckets (milk) returns the bucket --- src/Player.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Player.php b/src/Player.php index c11f0cadc..58b792a7c 100644 --- a/src/Player.php +++ b/src/Player.php @@ -842,8 +842,11 @@ class Player{ AchievementAPI::grantAchievement($this, "diamond"); break; case CAKE: - for($i; $i <= 2; $i++){ - $this->addItem(BUCKET, 0, 1, false); + if($this->hasSpace(AIR, 0, 3) == true){ + $this->addItem(BUCKET, 0, 3, false); + } + else{ + $this->server->api->entity->drop(new Position($this->entity->x - 0.5, $this->entity->y, $this->entity->z - 0.5, $this->level), BlockAPI::getItem(BUCKET, 0, 3)); } break; From 0d25118eefb8bff10826ffc033d09b3588f5ca65 Mon Sep 17 00:00:00 2001 From: InusualZ Date: Mon, 25 Nov 2013 18:53:36 -0500 Subject: [PATCH 6/8] Fixed gh#332 Crafting with buckets (milk) returns the bucket --- src/Player.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Player.php b/src/Player.php index 58b792a7c..3c95224f3 100644 --- a/src/Player.php +++ b/src/Player.php @@ -842,7 +842,7 @@ class Player{ AchievementAPI::grantAchievement($this, "diamond"); break; case CAKE: - if($this->hasSpace(AIR, 0, 3) == true){ + if($this->hasSpace(AIR, 0, 0) == true){ $this->addItem(BUCKET, 0, 3, false); } else{ From 509e67bfb7e4773b82fb40d00a3fdc499519c895 Mon Sep 17 00:00:00 2001 From: InusualZ Date: Mon, 25 Nov 2013 19:28:59 -0500 Subject: [PATCH 7/8] No More Silk Touch On Explosion --- src/world/Explosion.php | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) 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 +} From 75e4174a2bbef39ef1e7b51d7341080cf06477ca Mon Sep 17 00:00:00 2001 From: InusualZ Date: Mon, 25 Nov 2013 19:31:40 -0500 Subject: [PATCH 8/8] Repaired --- src/Player.php | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Player.php b/src/Player.php index 3c95224f3..5457fc977 100644 --- a/src/Player.php +++ b/src/Player.php @@ -842,12 +842,7 @@ class Player{ AchievementAPI::grantAchievement($this, "diamond"); break; case CAKE: - if($this->hasSpace(AIR, 0, 0) == true){ - $this->addItem(BUCKET, 0, 3, false); - } - else{ - $this->server->api->entity->drop(new Position($this->entity->x - 0.5, $this->entity->y, $this->entity->z - 0.5, $this->level), BlockAPI::getItem(BUCKET, 0, 3)); - } + $this->addItem(BUCKET, 0, 3, false); break; }